/*
|
* @Description:
|
* @version:
|
* @Author: chen jing wu
|
* @Date: 2023-04-12 11:16:07
|
* @LastEditors: chen jing wu
|
* @LastEditTime: 2023-04-13 17:02:46
|
*/
|
public with sharing class OpportunityLightingButtonController {
|
@AuraEnabled
|
public static InitData initForPredictedDateChangeButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
DirectLossFLG__c,
|
Created_Day__c
|
from Opportunity where Id =: recordId];
|
res.createdDay = opportunity.Created_Day__c;
|
res.directLossFLG = opportunity.DirectLossFLG__c;
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initForAgencyAuthorizeButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
Agency1_ID_18__c,
|
StageName,
|
SAP_Send_OK__c,
|
Opp_order_Type__c,
|
If_Have_170__c,
|
If_Have_AH__c,
|
Cnt_Lost_cancel_Draft__c,
|
Cnt_Lost_cancel_report__c,
|
Estimation_Id__c,
|
DetailNum__c,
|
Estimation_Decision__c,
|
Sales_Root__c,
|
AcecideCntCheck__c,
|
IF_Submit__c ,
|
Trade__c,
|
Is_Corrosion__c,
|
If_Authorizing_Lock__c
|
from Opportunity where Id =: recordId
|
];
|
res.agency1Id = opportunity.Agency1_ID_18__c;
|
res.stageName = opportunity.StageName;
|
res.sapSendOK = opportunity.SAP_Send_OK__c;
|
res.oppOrderType = opportunity.Opp_order_Type__c;
|
res.ifHave170 = opportunity.If_Have_170__c;
|
res.ifHaveAH = opportunity.If_Have_AH__c;
|
res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
|
res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
|
res.estimationId = opportunity.Estimation_Id__c;
|
res.detailNum = opportunity.DetailNum__c;
|
res.estimationDecision = opportunity.Estimation_Decision__c;
|
res.salesRoot = opportunity.Sales_Root__c;
|
res.acecideCntCheck = opportunity.AcecideCntCheck__c;
|
res.ifSubmit = opportunity.IF_Submit__c;
|
res.trade = opportunity.Trade__c;
|
res.isCorrosion = opportunity.Is_Corrosion__c;
|
res.ifAuthorizingLock = opportunity.If_Authorizing_Lock__c;
|
String profile18 = UserInfo.getProfileId();
|
res.profileId = profile18.substring(0,profile18.length() - 3);
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initForLoseBidButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
ifOpenBid__c
|
from Opportunity where Id =: recordId
|
];
|
res.ifOpenBid = opportunity.ifOpenBid__c;
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initForOLYwinBidButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
ifOpenBid__c
|
from Opportunity where Id =: recordId
|
];
|
res.ifOpenBid = opportunity.ifOpenBid__c;
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initForCreateEventButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
AccountId
|
from Opportunity where Id =: recordId];
|
res.accountId = opportunity.AccountId;
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initFoBeforeOPDPDFBtnButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
AccountId
|
from Opportunity where Id =: recordId
|
];
|
res.accountId = opportunity.AccountId;
|
res.userId = UserInfo.getUserId();
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initFoBeforeOPDPDFBtnSISButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
AccountId
|
from Opportunity where Id =: recordId
|
];
|
res.accountId = opportunity.AccountId;
|
res.userId = UserInfo.getUserId();
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static InitData initForRequestDBButton(String recordId){
|
InitData res = new InitData();
|
try {
|
Opportunity opportunity = [
|
select
|
StageName,
|
SAP_Send_OK__c,
|
Cnt_Lost_cancel_report__c,
|
Cnt_Lost_cancel_Draft__c,
|
Agency1__c,
|
Agency1_ID_18__c,
|
Name,
|
Bid_Planned_Date__c,
|
Sales_assistant_name__c,
|
Sales_assistant_ID__c
|
from Opportunity where Id =: recordId
|
];
|
res.stageName = opportunity.StageName;
|
res.sapSendOK = opportunity.SAP_Send_OK__c;
|
res.cntLostCancelReport = opportunity.Cnt_Lost_cancel_report__c;
|
res.cntLostCancelDraft = opportunity.Cnt_Lost_cancel_Draft__c;
|
res.agency1 = opportunity.Agency1__c;
|
res.agency1Id = opportunity.Agency1_ID_18__c;
|
res.name = opportunity.Name;
|
res.bidPlannedDate = opportunity.Bid_Planned_Date__c;
|
res.salesAssistantName = opportunity.Sales_assistant_name__c;
|
res.salesAssistantID = opportunity.Sales_assistant_ID__c;
|
String profileId18 = UserInfo.getProfileId();
|
res.profileId = profileId18.substring(0, profileId18.length() - 3);
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return res;
|
}
|
@AuraEnabled
|
public static string updateForAgencyAuthorizeButton(String recordId){
|
try {
|
Opportunity opp = new Opportunity();
|
opp.Id = recordId;
|
opp.If_Authorizing__c = true;
|
opp.if_Interface_Lock__c = true;
|
opp.IF_Submit__c = true;
|
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);
|
}
|
}
|
@AuraEnabled
|
public static string updateForLoseBidButton(String recordId){
|
try {
|
Opportunity opp = new Opportunity();
|
opp.Id = recordId;
|
opp.ConfirmationofAward__c = '竞争对手中标';
|
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);
|
}
|
}
|
@AuraEnabled
|
public static string updateForOLYwinBidButton(String recordId){
|
try {
|
Opportunity opp = [select ConfirmationofAward__c,Closing_Bid_Date__c from Opportunity where Id =: recordId];
|
opp.ConfirmationofAward__c = 'OLY中标';
|
if (opp.Closing_Bid_Date__c == null) {
|
opp.Closing_Bid_Date__c = Date.today();
|
}
|
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);
|
}
|
}
|
@AuraEnabled
|
public static List<InquiryPredictsDateChange__c> queryForPredictedDateChangeButton(String recordId){
|
List<InquiryPredictsDateChange__c> rac = null;
|
try {
|
rac = [
|
select
|
id
|
from InquiryPredictsDateChange__c where Predicted_Date_Status__c = '审批中' and Opportunity__c =:recordId];
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return rac;
|
}
|
@AuraEnabled
|
public static List<task__c> queryForLoseBidButton(String recordId){
|
List<task__c> tasks = null;
|
try {
|
tasks = [
|
select
|
taskStatus__c
|
from task__c where OpportunityId__c =: recordId and name like '%中标结果确认%'];
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return tasks;
|
}
|
@AuraEnabled
|
public static List<task__c> queryForOLYwinBidButton(String recordId){
|
List<task__c> tasks = null;
|
try {
|
tasks = [
|
select
|
taskStatus__c
|
from task__c where OpportunityId__c =: recordId and name like '%中标结果确认%'];
|
} catch (Exception e) {
|
System.debug('e:****' + e);
|
}
|
return tasks;
|
}
|
public class InitData{
|
@AuraEnabled
|
public Boolean directLossFLG;
|
@AuraEnabled
|
public Date createdDay;
|
@AuraEnabled
|
public String agency1Id;
|
@AuraEnabled
|
public String agency1;
|
@AuraEnabled
|
public String stageName;
|
@AuraEnabled
|
public Boolean sapSendOK;
|
@AuraEnabled
|
public String oppOrderType;
|
@AuraEnabled
|
public Boolean ifHave170;
|
@AuraEnabled
|
public Boolean ifHaveAH;
|
@AuraEnabled
|
public Decimal cntLostCancelDraft;
|
@AuraEnabled
|
public Decimal cntLostCancelReport;
|
@AuraEnabled
|
public String estimationId;
|
@AuraEnabled
|
public Decimal detailNum;
|
@AuraEnabled
|
public Boolean estimationDecision;
|
@AuraEnabled
|
public String salesRoot;
|
@AuraEnabled
|
public Boolean acecideCntCheck;
|
@AuraEnabled
|
public Boolean ifSubmit;
|
@AuraEnabled
|
public String trade;
|
@AuraEnabled
|
public Boolean isCorrosion;
|
@AuraEnabled
|
public Boolean ifAuthorizingLock;
|
@AuraEnabled
|
public String profileId;
|
@AuraEnabled
|
public String ifOpenBid;
|
@AuraEnabled
|
public String accountId;
|
@AuraEnabled
|
public String userId;
|
@AuraEnabled
|
public String name;
|
@AuraEnabled
|
public Date bidPlannedDate;
|
@AuraEnabled
|
public String salesAssistantName;
|
@AuraEnabled
|
public String salesAssistantID;
|
}
|
}
|