| | |
| | | * @Author: chen jing wu |
| | | * @Date: 2023-04-12 11:16:07 |
| | | * @LastEditors: chen jing wu |
| | | * @LastEditTime: 2023-05-15 13:40:51 |
| | | * @LastEditTime: 2023-06-05 13:59:58 |
| | | */ |
| | | public with sharing class OpportunityLightingButtonController { |
| | | @AuraEnabled |
| | |
| | | res.systemProfileId = getProfileIdByName(lexLightingButtonConstant.SYSTEM_PROFILE_NAME); |
| | | res.s1ProfileId = getProfileIdByName(lexLightingButtonConstant.S1_PROFILE_NAME); |
| | | 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); |
| | | } |
| | |
| | | res.salesManagerDepartmentID = opportunity.Sales_manager_departmentID__c; |
| | | res.salesOwnerBuchang = opportunity.Sales_owner_buchang__c; |
| | | 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()); |
| | | } |
| | |
| | | CurrencyIsoCode |
| | | from Opportunity where Id =: recordId |
| | | ]; |
| | | Report cnyReport = [SELECT Id FROM Report WHERE Name = :lexLightingButtonConstant.REPORT_NAME_FOR_CNY limit 1]; |
| | | Report usdReport = [SELECT Id FROM Report WHERE Name = :lexLightingButtonConstant.REPORT_NAME_FOR_USD limit 1]; |
| | | res.currencyIsoCode = opportunity.CurrencyIsoCode; |
| | | res.reportForCNYId = cnyReport.Id; |
| | | res.reportForUSDId = usdReport.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | |
| | | res.accountId = opp.AccountId; |
| | | res.accountName = acc.Name; |
| | | 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()); |
| | | } |
| | |
| | | select id, |
| | | Tender_information__r.subInfoType__c |
| | | from Tender_Opportunity_Link__c |
| | | where (Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_SCRAPPED_LABEL OR Tender_information__r.subInfoType__c =:lexLightingButtonConstant.SUB_INFO_TYPE_FLOW_LABEL) and Opportunity__c =: recordId |
| | | 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 pro.Id; |
| | | } catch (Exception e) { |
| | | throw new AuraHandledException(e.getMessage()); |
| | | } |
| | | } |
| | | @AuraEnabled |
| | | public static String changeTrade(String oppId){ |
| | | |
| | | List<Quote> quoList = [select id from Quote where OpportunityId = :oppId]; |
| | | List<OpportunityLineItem> oppLI = [select id from OpportunityLineItem where Opportunity.id = :oppId]; |
| | | |
| | | Opportunity opp = new Opportunity(); |
| | | opp.id = oppId; |
| | | opp.Estimation_Decision__c = false; |
| | | opp.Estimation_Id__c = null; |
| | | opp.Quote_Update_Sum__c = null; |
| | | opp.Estimation_No__c = null; |
| | | opp.Estimation_Proposal_Date__c = null; |
| | | opp.Estimation_Name__c = null; |
| | | // LHJ SWAG-C9QAAJ 去掉 Start |
| | | // opp.Authorized_Finish_Sales__c = null; |
| | | // opp.Authorized_DB_No__c = null; |
| | | // opp.Authorized_Date__c = null; |
| | | // opp.Autholization_Activated_Date__c = null; |
| | | // opp.Bidding_Content__c = null; |
| | | // opp.Bid_Date__c = null; |
| | | // opp.Bidding_No__c = null; |
| | | // opp.Bidding_Project_Name__c = null; |
| | | // LHJ End |
| | | |
| | | Savepoint sp = Database.setSavepoint(); |
| | | try { |
| | | delete quoList; |
| | | delete oppLI; |
| | | update opp; |
| | | return '1'; |
| | | } catch (Exception ex) { |
| | | Database.rollback(sp); |
| | | return ex.getMessage() + ' | Line:' + ex.getLineNumber(); |
| | | } |
| | | } |
| | | public class InitData{ |
| | |
| | | public String s1ProfileId; |
| | | @AuraEnabled |
| | | public String accountName; |
| | | @AuraEnabled |
| | | public String recordTypeId; |
| | | @AuraEnabled |
| | | public String reportForCNYId; |
| | | @AuraEnabled |
| | | public String reportForUSDId; |
| | | } |
| | | } |