| | |
| | | public static String limits { get; set; }//日期03 |
| | | |
| | | public static List<SelectOption> dateOpts { get; private set; } |
| | | public static List<CusOption> textCusOpts; |
| | | public static List<SelectOption> textOpts { get; private set; } |
| | | |
| | | public static List<CusOption> timeCusOpts; |
| | | public static List<SelectOption> timeOpts { get; private set; } |
| | | |
| | | public static List<CusOption> equalCusOpts; |
| | | public static List<SelectOption> equalOpts { get; private set; } |
| | | public static List<SelectOption> timeequalOpts { get; private set; } |
| | | public static List<CusOption> limitCusOpts; |
| | | public static List<SelectOption> limitOpts { get; private set; } |
| | | |
| | | /*****************画面表示Bean******************/ |
| | |
| | | @TestVisible private static String accTypeForSort = null; |
| | | private static Integer oppLimit = 500; |
| | | |
| | | // page |
| | | public static Integer pagesize { get; set; } |
| | | public static Integer pageToken { get; set; } |
| | | public static String sortField { get; set; } |
| | | // public static String sortOrder { get; set; } |
| | | |
| | | public static Integer totalcount { get; set; } |
| | | |
| | | public LexDealerInquiryModifyStateController() { |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results init(Integer pageSizeLWC,Integer pageTokenLWC) { |
| | | pageSize = pageSizeLWC; |
| | | pageToken = pageTokenLWC; |
| | | Results results = new Results(); |
| | | oppRecords = new List<OpportunityInfo>(); |
| | | |
| | | //dateOpts = new List<SelectOption>(); |
| | |
| | | //dateOpts.add(new SelectOption('Ban_On_Use_Date__c', '禁用日期')); |
| | | |
| | | //数据字段下拉列表 |
| | | textOpts = new List<SelectOption>(); |
| | | textOpts.add(new SelectOption('', '--无--')); |
| | | textOpts.add(new SelectOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | textOpts.add(new SelectOption('Agency__r.Name', '经销商')); |
| | | textOpts.add(new SelectOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | textOpts.add(new SelectOption('Department_Cateogy__c', '科室分类')); |
| | | textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | // textOpts.add(new SelectOption('Name', '询价名称')); |
| | | // textOpts = new List<SelectOption>(); |
| | | // textOpts.add(new SelectOption('', '--无--')); |
| | | // textOpts.add(new SelectOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | // textOpts.add(new SelectOption('Agency__r.Name', '经销商')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | // textOpts.add(new SelectOption('Department_Cateogy__c', '科室分类')); |
| | | // textOpts.add(new SelectOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | // // textOpts.add(new SelectOption('Name', '询价名称')); |
| | | // textOpts.add(new SelectOption('StageName__c', '询价阶段')); |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | // //精琢科技 zxk 2021-08-25 start |
| | | // // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '状态2')); |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | // //精琢科技 zxk 2021-08-25 end |
| | | // textOpts.add(new SelectOption('Hospital_City_Master__c', '市')); |
| | | |
| | | textOpts.add(new SelectOption('StageName__c', '询价阶段')); |
| | | textOpts.add(new SelectOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | //精琢科技 zxk 2021-08-25 start |
| | | // textOpts.add(new SelectOption('Oly_Inquiry_Status2__c', '状态2')); |
| | | textOpts.add(new SelectOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | //精琢科技 zxk 2021-08-25 end |
| | | textOpts.add(new SelectOption('Hospital_City_Master__c', '市')); |
| | | |
| | | //custom option |
| | | textCusOpts = new List<CusOption>(); |
| | | textCusOpts.add(new CusOption('', '--无--')); |
| | | textCusOpts.add(new CusOption('Agency_Opportunity_No__c', '经销商询价编码')); |
| | | textCusOpts.add(new CusOption('Agency__r.Name', '经销商')); |
| | | textCusOpts.add(new CusOption('Agency_Hospital__r.Name', '经销商医院')); |
| | | textCusOpts.add(new CusOption('Department_Cateogy__c', '科室分类')); |
| | | textCusOpts.add(new CusOption('Change_To_Opportunity_T__c', '询价名称')); |
| | | textCusOpts.add(new CusOption('StageName__c', '询价阶段')); |
| | | textCusOpts.add(new CusOption('Oly_Inquiry_Status1__c', '状态1')); |
| | | textCusOpts.add(new CusOption('Oly_Inquiry_Stage__c', 'Oly询价阶段')); |
| | | textCusOpts.add(new CusOption('Hospital_City_Master__c', '市')); |
| | | |
| | | |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.Salesdepartment_HP__c', '销售本部')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.State_Master__r.Name', '省')); |
| | | // textOpts.add(new SelectOption('Agency_Hospital__r.Hospital__r.City_Master__r.Name', '市')); |
| | | //日期字段下拉列表 |
| | | timeOpts = new List<SelectOption>(); |
| | | timeOpts.add(new SelectOption('', '--无--')); |
| | | timeOpts.add(new SelectOption('Created_Day__c', '创建日')); |
| | | timeOpts.add(new SelectOption('Bid_Planned_Date__c', '预测招标日')); |
| | | timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '取消日期')); |
| | | // timeOpts = new List<SelectOption>(); |
| | | // timeOpts.add(new SelectOption('', '--无--')); |
| | | // timeOpts.add(new SelectOption('Created_Day__c', '创建日')); |
| | | // timeOpts.add(new SelectOption('Bid_Planned_Date__c', '预测招标日')); |
| | | // timeOpts.add(new SelectOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | // timeOpts.add(new SelectOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | // timeOpts.add(new SelectOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | // timeOpts.add(new SelectOption('Deleted_Reason_Date__c', '取消日期')); |
| | | |
| | | timeCusOpts = new List<CusOption>(); |
| | | timeCusOpts.add(new CusOption('', '--无--')); |
| | | timeCusOpts.add(new CusOption('Created_Day__c', '创建日')); |
| | | timeCusOpts.add(new CusOption('Bid_Planned_Date__c', '预测招标日')); |
| | | timeCusOpts.add(new CusOption('Forecasted_Bid_Date__c', '预测中标日')); |
| | | timeCusOpts.add(new CusOption('Close_Forecasted_Date__c', '预测与OLY签约日')); |
| | | timeCusOpts.add(new CusOption('Lost_Opportunity_Date__c', '失单日期')); |
| | | timeCusOpts.add(new CusOption('Deleted_Reason_Date__c', '取消日期')); |
| | | |
| | | |
| | | |
| | | //数据字段中间连接符号 |
| | | equalOpts = new List<SelectOption>(); |
| | | equalOpts.add(new SelectOption('=', '等于')); |
| | | equalOpts.add(new SelectOption('<>', '不等于')); |
| | | equalOpts.add(new SelectOption('<', '<')); |
| | | equalOpts.add(new SelectOption('>', '>')); |
| | | equalOpts.add(new SelectOption('<=', '<=')); |
| | | equalOpts.add(new SelectOption('>=', '>=')); |
| | | equalOpts.add(new SelectOption('contains', '包含')); |
| | | equalOpts.add(new SelectOption('notcontains', '不包含')); |
| | | equalOpts.add(new SelectOption('starts with', '起始字符')); |
| | | // equalOpts = new List<SelectOption>(); |
| | | // equalOpts.add(new SelectOption('=', '等于')); |
| | | // equalOpts.add(new SelectOption('<>', '不等于')); |
| | | // equalOpts.add(new SelectOption('<', '<')); |
| | | // equalOpts.add(new SelectOption('>', '>')); |
| | | // equalOpts.add(new SelectOption('<=', '<=')); |
| | | // equalOpts.add(new SelectOption('>=', '>=')); |
| | | // equalOpts.add(new SelectOption('contains', '包含')); |
| | | // equalOpts.add(new SelectOption('notcontains', '不包含')); |
| | | // equalOpts.add(new SelectOption('starts with', '起始字符')); |
| | | |
| | | equalCusOpts = new List<CusOption>(); |
| | | equalCusOpts.add(new CusOption('=', '等于')); |
| | | equalCusOpts.add(new CusOption('<>', '不等于')); |
| | | equalCusOpts.add(new CusOption('<', '<')); |
| | | equalCusOpts.add(new CusOption('>', '>')); |
| | | equalCusOpts.add(new CusOption('<=', '<=')); |
| | | equalCusOpts.add(new CusOption('>=', '>=')); |
| | | equalCusOpts.add(new CusOption('contains', '包含')); |
| | | equalCusOpts.add(new CusOption('notcontains', '不包含')); |
| | | equalCusOpts.add(new CusOption('starts with', '起始字符')); |
| | | |
| | | //日期字段连接符号 |
| | | //timeequalOpts = new List<SelectOption>(); |
| | | //timeequalOpts.add(new SelectOption('=', '等于')); |
| | |
| | | //timeequalOpts.add(new SelectOption('<=', '<=')); |
| | | //timeequalOpts.add(new SelectOption('>=', '>=')); |
| | | //数据显示条数 |
| | | limitOpts = new List<SelectOption>(); |
| | | limitOpts.add(new SelectOption('10', '10')); |
| | | limitOpts.add(new SelectOption('20', '20')); |
| | | limitOpts.add(new SelectOption('50', '50')); |
| | | limitOpts.add(new SelectOption('100', '100')); |
| | | limitOpts.add(new SelectOption('200', '200')); |
| | | limitOpts.add(new SelectOption('1000', '全部')); |
| | | // limitOpts = new List<SelectOption>(); |
| | | // limitOpts.add(new SelectOption('10', '10')); |
| | | // limitOpts.add(new SelectOption('20', '20')); |
| | | // limitOpts.add(new SelectOption('50', '50')); |
| | | // limitOpts.add(new SelectOption('100', '100')); |
| | | // limitOpts.add(new SelectOption('200', '200')); |
| | | // limitOpts.add(new SelectOption('1000', '全部')); |
| | | //数据显示默认条数 |
| | | limits = '20'; |
| | | } |
| | | @AuraEnabled |
| | | public static Results init() { |
| | | Results results = new Results(); |
| | | |
| | | limitCusOpts = new List<CusOption>(); |
| | | limitCusOpts.add(new CusOption('10', '10')); |
| | | limitCusOpts.add(new CusOption('20', '20')); |
| | | limitCusOpts.add(new CusOption('50', '50')); |
| | | limitCusOpts.add(new CusOption('100', '100')); |
| | | limitCusOpts.add(new CusOption('200', '200')); |
| | | limitCusOpts.add(new CusOption('1000', '全部')); |
| | | try{ |
| | | PartnerSoapSforceCom.Soap soap = new PartnerSoapSforceCom.Soap(); |
| | | soap.SessionHeader = new PartnerSoapSforceCom.SessionHeader_element(); |
| | |
| | | tmpAO = new Agency_Opportunity__c(); |
| | | tmpBO = new Agency_Opportunity__c(); |
| | | setLayoutRWInfo(); |
| | | searchOppInner(); |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | System.debug('limitCusOpts==>'+limitCusOpts); |
| | | System.debug('searchOppInner==>'+ searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey)); |
| | | LexDealerInquiryModifyStateController.Results returnList = searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | System.debug('returnList==>'+ returnList); |
| | | //分页 |
| | | PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | totalCount = oppRecords.size(); |
| | | paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | paginatedAccounts.recordStart = pageToken + 1; |
| | | paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | Integer startIdx; |
| | | Integer endIdx; |
| | | List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>(); |
| | | startIdx = pageToken; |
| | | endIdx = startIdx + pageSize; |
| | | if (endIdx > oppRecords.size()) { |
| | | endIdx = oppRecords.size(); |
| | | } |
| | | for (Integer i = startIdx; i < endIdx; i++) { |
| | | pageoppRecords.add(oppRecords.get(i)); |
| | | } |
| | | //end |
| | | |
| | | //回传参数 |
| | | results.result = 'Success'; |
| | | results.oppRecords = oppRecords; |
| | | results.timeCusOpts = timeCusOpts; |
| | | results.equalCusOpts = equalCusOpts; |
| | | results.limitCusOpts = limitCusOpts; |
| | | results.textCusOpts = textCusOpts; |
| | | results.limits = limits; |
| | | results.strColumus = strColumus; |
| | | results.strRtColumus = strRtColumus; |
| | | results.paginatedAccounts = paginatedAccounts; |
| | | results.pageoppRecords = pageoppRecords; |
| | | results.Msg = returnList.Msg; |
| | | |
| | | |
| | | System.debug('results==>'+results); |
| | | |
| | | }catch (Exception e) { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = e.getLineNumber()+'---'+e.getMessage(); |
| | | results.Msg = e.getLineNumber()+'---'+e.getMessage(); |
| | | } |
| | | |
| | | // return null; |
| | |
| | | } |
| | | } |
| | | //用于拼接SOQL语句 根据不同检索条件拼接不同SOQL语句。 |
| | | public static void searchOppInner() { |
| | | @AuraEnabled |
| | | public static Results searchOppInner(String strColumus,String strRtColumus,String accSearch,String aooSearch,String numtext,String numtext1,String numtext2,String sortKeyLWC) { |
| | | Results results = new Results(); |
| | | sortKey = sortKeyLWC; |
| | | |
| | | //SOQL:拼接检索条件以及经销商询价的SOQL语句 |
| | | // List<User> userlist2 = [select id,name from user where Contactid in (select id from Contact)]; |
| | | // String querySoql = ''; |
| | |
| | | oppCount = oppRecords.size(); |
| | | //显示提示操作信息 |
| | | if (String.isBlank(saveType) && String.isBlank(sortKey)) { |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '取得最近的 ' + oppCount + ' 条数据')); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '取得最近的 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '取得最近的 ' + oppCount + ' 条数据'; |
| | | return results; |
| | | } else if (!String.isBlank(sortKey)) { |
| | | if (oppCount > oppLimit) { |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件')); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件')); |
| | | results.result = 'Success'; |
| | | results.Msg = '数据超过' + oppLimit + '件,只显示前' + oppLimit + '件'; |
| | | |
| | | } else { |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '共有 ' + oppCount + ' 条数据'; |
| | | |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | } |
| | | } else { |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '共有 ' + oppCount + ' 条数据')); |
| | | results.result = 'Success'; |
| | | results.Msg = '共有 ' + oppCount + ' 条数据'; |
| | | } |
| | | // //分页 |
| | | // PaginatedAccounts paginatedAccounts = new PaginatedAccounts(); |
| | | // totalCount = oppRecords.size(); |
| | | // paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null; |
| | | // paginatedAccounts.recordStart = pageToken + 1; |
| | | // paginatedAccounts.pageNumber = pageToken / pageSize + 1; |
| | | // Integer recordEnd = pageSize * paginatedAccounts.pageNumber; |
| | | // paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount; |
| | | // paginatedAccounts.totalRecords = totalCount; |
| | | |
| | | // Integer startIdx; |
| | | // Integer endIdx; |
| | | // List<OpportunityInfo> pageoppRecords = new List<OpportunityInfo>(); |
| | | // startIdx = pageToken; |
| | | // endIdx = startIdx + pageSize; |
| | | // if (endIdx > oppRecords.size()) { |
| | | // endIdx = oppRecords.size(); |
| | | // } |
| | | // for (Integer i = startIdx; i < endIdx; i++) { |
| | | // pageoppRecords.add(oppRecords.get(i)); |
| | | // } |
| | | // //end |
| | | |
| | | |
| | | //回传参数 |
| | | results.result = 'Success'; |
| | | results.oppRecords = oppRecords; |
| | | return results; |
| | | |
| | | } |
| | | //检索条件:数据字段1,数据字段2,数据字段3均满足进入此方法 判断多种情况 |
| | | private static String makeTextSql(String textOpts, String equalOpts, String numtext) { |
| | |
| | | } |
| | | |
| | | //检索按钮:点击检索按钮触发此方法; |
| | | public static PageReference chick() { |
| | | setLayoutRWInfo(); |
| | | searchOppInner(); |
| | | return null; |
| | | } |
| | | // public static PageReference chick() { |
| | | // setLayoutRWInfo(); |
| | | // searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey,pageSizeLWC,pageTokenLWC); |
| | | // return null; |
| | | // } |
| | | //页面内容有修改时,页面判断后传值给changeFlg以及changeFlgRt属性,点击保存时调用此方法,进行保存。 |
| | | public static PageReference save() { |
| | | @AuraEnabled |
| | | public static Results save(List<OpportunityInfo> oppRecordsLWC) { |
| | | //system.debug('oppRecords[1].opp:' + oppRecords[1].opp +' oppRecords[1].AgcOpp:' + oppRecords[1].AgcOpp ); |
| | | Results results = new Results(); |
| | | oppRecords = oppRecordsLWC; |
| | | try { |
| | | List<Agency_Opportunity__c> updTarget = new List<Agency_Opportunity__c>(); |
| | | // List<Opportunity> updOpps = new List<Opportunity>(); |
| | |
| | | // if (updOpps.size() > 0) { |
| | | // update updOpps; |
| | | // } |
| | | ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存完了')); |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '保存完了')); |
| | | results.result = 'Success'; |
| | | results.Msg = '保存完了'; |
| | | return results; |
| | | } catch (Exception e) { |
| | | //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '请确定科室分类和产品区分的关系')); |
| | | } |
| | | if (saveType == '1') { |
| | | searchOppInner(); |
| | | if(saveType == '1') { |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | saveType = ''; |
| | | } else if (saveType == '2') { |
| | | sortTable(); |
| | |
| | | preSortKey = sortKey; |
| | | |
| | | setLayoutRWInfo(); |
| | | searchOppInner(); |
| | | searchOppInner(strColumus,strRtColumus,accSearch,aooSearch,numtext,numtext1,numtext2,sortKey); |
| | | return null; |
| | | } |
| | | //分页Bean |
| | | public class PaginatedAccounts { |
| | | @AuraEnabled |
| | | public Integer nextPageToken; |
| | | @AuraEnabled |
| | | public Integer pageNumber { get; set; } |
| | | @AuraEnabled |
| | | public Integer totalRecords { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordStart { get; set; } |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | |
| | | //自定义类OpportunityInfo,用于创建虚拟字段,合并输出。 |
| | |
| | | @AuraEnabled |
| | | public String result; |
| | | @AuraEnabled |
| | | public String errorMsg; |
| | | |
| | | |
| | | public String Msg; |
| | | @AuraEnabled |
| | | public List<OpportunityInfo> oppRecords; |
| | | @AuraEnabled |
| | | public Integer oppCount ; |
| | | @AuraEnabled |
| | | public List<CusOption> timeCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> textCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> equalCusOpts; |
| | | @AuraEnabled |
| | | public List<CusOption> limitCusOpts; |
| | | @AuraEnabled |
| | | public String limits; |
| | | @AuraEnabled |
| | | public String strColumus; |
| | | @AuraEnabled |
| | | public String strRtColumus; |
| | | @AuraEnabled |
| | | public List<OpportunityInfo> pageoppRecords; |
| | | @AuraEnabled |
| | | public PaginatedAccounts paginatedAccounts; |
| | | @AuraEnabled |
| | | public Boolean canEdit; |
| | | @AuraEnabled |
| | | public String changeFlg; |
| | | } |
| | | public class CusOption { |
| | | CusOption(String value,String label) { |
| | | this.label = label; |
| | | this.value = value; |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public String label; |
| | | @AuraEnabled |
| | | public String value; |
| | | } |
| | | |
| | | } |