| | |
| | | public Integer quoteEntryMaxLine {get; private set;} |
| | | public Id quoId {get;set;} |
| | | public String oppid; |
| | | public String leadid; |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | public String tenderid; |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | public Boolean productStatusUpdated {get;set;} // 状態更新、{!$Label.Status_Update} を押下したかどうか |
| | | public Boolean changedAfterPrint {get;set;} // true の場合、画面に confirm メッセージが表示します。quoIdを新しいinsert。判定はjsにて実施 |
| | | |
| | |
| | | public Boolean filg { get; set; } |
| | | public Integer flglastbuy { get; set; } |
| | | public String errorProductmodel { get; set; } |
| | | public Boolean is_changed_opp { get; set; } |
| | | //lastbuy 2022/3/10 fy end |
| | | |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 start |
| | | public String erroraxsdmodel { get; set; } |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 end |
| | | public String excel_text {get;set;} |
| | | public Integer select_index {get;set;} // excelImport専用ですが、jsにて制御することになるので、TODO katsu 削除予定 |
| | | public String Product_text {get;set;} |
| | |
| | | public User loginUser {get;set;} |
| | | |
| | | private Map<Id, Product2> prd2LatestValMap; |
| | | //obsap 新增经销商1字段 fy satrt |
| | | public Decimal Salesprofit1 { get; set; } |
| | | public Decimal SalesCalculation1 { get; set; } |
| | | public Boolean displayFlg { get; set; } |
| | | //obsap 新增经销商1字段 fy end |
| | | |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | | public QuoteBean qb { get; set; } |
| | |
| | | // 经销商询价报价委托 2020-02-28 update by vivek start |
| | | public Map<Id,Id> userProfileId; |
| | | // 经销商询价报价委托 2020-02-28 update by vivek end |
| | | |
| | | |
| | | // obsap对应 obsap人员检索 2022-04-27 ssm start |
| | | public class UserSelect { |
| | | public String user_name { get; set; } |
| | | public User user { get; set; } |
| | | public UserSelect(User u) { |
| | | this.user_name = u.Alias; |
| | | this.user = u; |
| | | } |
| | | } |
| | | public String obsap_mail { get; set; } |
| | | //obsap obsap人员检索 fy satrt |
| | | // public String selectObsapUsers { get; set; } |
| | | public List<SelectOption> ObsapUsers { get; set; } |
| | | public boolean obsflag { get; set; } |
| | | //obsap obsap人员检索 fy end |
| | | // obsap对应 obsap人员检索 2022-04-27 ssm end |
| | | |
| | | public NewQuoteIraiController() { |
| | | quoteEntryMaxLine = Integer.valueOf(System.Label.QuoteEntryMaxLine); |
| | | baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); |
| | |
| | | |
| | | public PageReference init() { |
| | | system.debug('============start init=============='); |
| | | obsap_mail = System.Label.OBSAP_Group_Mail; |
| | | errorflg = false; |
| | | pdf_button = true; |
| | | obsflag = false; |
| | | //loginUser |
| | | loginUser = [select Id, ProfileId, State_Hospital__c from User where Id = :UserInfo.getUserId()]; |
| | | loginUser = [select Id, ProfileId, State_Hospital__c, Salesdepartment_text__c from User where Id = :UserInfo.getUserId()]; |
| | | if (loginUser.ProfileId == System.Label.ProfileId_SystemAdmin) { |
| | | pdf_button = false; |
| | | } |
| | | String obsap_Login_area=System.Label.obsap_Login_area; |
| | | List<String> obsaplogareaList =obsap_Login_area.split(','); |
| | | if(obsaplogareaList.contains(loginUser.Salesdepartment_text__c)){ |
| | | obsflag = true; |
| | | } |
| | | // obsap对应 obsap人员检索 2022-04-27 ssm start |
| | | // if (loginUser != null && String.isNotBlank(loginUser.Salesdepartment_text__c) && (loginUser.Salesdepartment_text__c == '5.华东' || loginUser.Salesdepartment_text__c == '6.华南')) { |
| | | //fy 20220512 |
| | | if (loginUser != null && String.isNotBlank(loginUser.Salesdepartment_text__c) && obsflag) { |
| | | |
| | | // obsflag = true; |
| | | // 这里做了个比较2的修改 |
| | | // 由于客户不想给公共小组的每个人都创建一个任务,只能用队列 |
| | | // 这样才能实现一个任务,小组成员都能看到,谁完成都算完成 |
| | | // 又由于需要发送邮件,工作流里发送邮件只能到公共小组,不能发给队列 |
| | | // 所以把公共小组当作队列成员扔进去 |
| | | // 这里只能取两次才能取到小组里的某一个人 |
| | | String obsap_group_id = System.Label.obsap_group_opp; |
| | | List<GroupMember> queue = [SELECT Id, GroupId, UserOrGroupId FROM GroupMember where GroupId = :obsap_group_id]; |
| | | system.debug('queue++'+queue); |
| | | if (queue != null && queue.size() > 0) { |
| | | List<GroupMember> members = [SELECT Id, GroupId, UserOrGroupId FROM GroupMember where GroupId = :queue[0].UserOrGroupId]; |
| | | GroupMember member = members != null && members.size() > 0 ? members[0] : new GroupMember(); |
| | | User obsap_user = [SELECT Id, Name, Alias FROM User WHERE Id =: member.UserOrGroupId]; |
| | | ObsapUsers = new List<SelectOption>(); |
| | | // ObsapUsers.add(new SelectOption('','')); |
| | | // for (User u : obsaps) { |
| | | // ObsapUsers.add(new SelectOption(u.Id,u.Alias)); |
| | | // } |
| | | ObsapUsers.add(new SelectOption(obsap_user.Id, 'OBSAP小组')); |
| | | } |
| | | } |
| | | // obsap对应 obsap人员检索 2022-04-27 ssm end |
| | | //Quote |
| | | quo = new QuoteIrai__c(); |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | |
| | | } |
| | | |
| | | // 潜在客户id |
| | | String leadid = System.currentPageReference().getParameters().get('leadid'); |
| | | // String leadid = System.currentPageReference().getParameters().get('leadid'); |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy start |
| | | leadid = System.currentPageReference().getParameters().get('leadid'); |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy end |
| | | // 经销商询价报价委托 2020-02-28 update by vivek start |
| | | // 经销商询价 |
| | | String agencyoppid = System.currentPageReference().getParameters().get('agencyoppid'); |
| | |
| | | |
| | | // 招投标报价委托 2021-06-21 update by gzw start |
| | | // 招投标 |
| | | String tenderid = System.currentPageReference().getParameters().get('tenderid'); |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | // String tenderid = System.currentPageReference().getParameters().get('tenderid'); |
| | | tenderid = System.currentPageReference().getParameters().get('tenderid'); |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | |
| | | // 招投标报价委托 2021-06-21 update by gzw start |
| | | |
| | | // 询价id |
| | | oppid = System.currentPageReference().getParameters().get('oppid'); |
| | | QuoteIrai__c quoteiraiobj = new QuoteIrai__c(); |
| | | if(oppid==null&&tenderid==null&&quoId!=null&&leadid==null&&agencyoppid==null){ |
| | | quoteiraiobj = [select id,Note__c from QuoteIrai__c where id=:quoId]; |
| | | String[] quosub=quoteiraiobj.Note__c.split('/'); |
| | | oppid=quosub[quosub.size()-1]; |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | if(oppid==null&&quoId!=null&&leadid==null&&agencyoppid==null){ |
| | | // if(oppid==null&&tenderid==null&&quoId!=null&&leadid==null&&agencyoppid==null){ |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | quoteiraiobj = [select id,Note__c,Noteplus__c from QuoteIrai__c where id=:quoId]; |
| | | if(quoteiraiobj.Note__c!=null){ |
| | | String[] quosub=quoteiraiobj.Note__c.split('/'); |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | oppid=quosub[quosub.size()-1].substring(0,15); |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | // oppid=quosub[quosub.size()-1]; |
| | | } |
| | | } |
| | | system.debug('oppid:++++'+oppid); |
| | | system.debug('leadid:++++'+leadid); |
| | | system.debug('tenderid:++++'+tenderid); |
| | | // 报价id |
| | | String oppquoid = System.currentPageReference().getParameters().get('oppquoid'); |
| | | //将报价委托的币种与外贸币种一致 防止后续外贸有需要用USD判断显示的地方 精琢技术 wql 2021/01/06 start |
| | | List<Opportunity> oppList = [Select id,CurrencyIsoCode from Opportunity where id =:oppid]; |
| | | |
| | | List<Opportunity> oppList = [Select id,CurrencyIsoCode, If_Account_Change__c from Opportunity where id =:oppid]; |
| | | // lastbuy变更用户询价判断 |
| | | // 如果取得了询价,则取询价上的是否变更用户,否则false |
| | | is_changed_opp = oppList != null && oppList.size() > 0 ? oppList[0].If_Account_Change__c : false; |
| | | |
| | | //Quote |
| | | Integer i; |
| | | if (quoId==null){ |
| | |
| | | } |
| | | // 经销商询价报价委托 2020-02-28 update by vivek end |
| | | // 招投标报价委托 2021-06-21 update by gzw start |
| | | if (String.isNotBlank(tenderid)) { |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | // if (String.isNotBlank(tenderid)) { |
| | | if (String.isNotBlank(tenderid)&&String.isBlank(leadid)) { |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | quo.Note__c = Tender_information__c.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + tenderid; |
| | | } |
| | | // 招投标报价委托 2021-06-21 update by gzw end |
| | | if (String.isNotBlank(oppid)) { |
| | | quo.Note__c = Opportunity.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + oppid; |
| | | } |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | quo.Noteplus__c = quo.Note__c; |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | //新規リストコントローラの取得 |
| | | if (activities==null){ |
| | | activities = new List<QELine>(); |
| | |
| | | } else { |
| | | // 已经存在报价 |
| | | if (String.isNotBlank(oppquoid)) { |
| | | //DB202302464682【报价委托】报价委托改善224 fy start |
| | | Quote quo2 = new Quote(); |
| | | List<Quote> quote = [select Id,Agency1__c,Agency2__c From Quote Where Id =:oppquoid]; |
| | | if(quote.size()>0){ |
| | | quo2=quote[0]; |
| | | } |
| | | quo.Agency1_entrust__c = quo2.Agency1__c; |
| | | quo.Agency2_entrust__c = quo2.Agency2__c; |
| | | //DB202302464682【报价委托】报价委托改善224 fy end |
| | | // 报价商品取得 |
| | | // CHAN-BHNBX6 2019/11/20 START//fy lastbuy 20220310 PricebookEntry.Product2.LastbuyProductFLG__c |
| | | List<QuoteLineItem> qlis = [select id,PricebookEntry.Product2Id,PricebookEntry.Product2.LastbuyProductFLG__c,Quantity__c,CurrencyIsoCode,GuaranteePeriod__c from QuoteLineItem where QuoteId = :oppquoid]; |
| | |
| | | // 招投标报价委托 2021-06-21 update by gzw end |
| | | }else{ |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | | List<QuoteIrai__c> quoList = |
| | | [ SELECT Id,Name,Cancel_Decide__c,Agency_Hospital_Link__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c, |
| | | Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c, |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy Lead__c,Opportunity__c, |
| | | List<QuoteIrai__c> quoList = //obsap 新增经销商1字段 fy satrt Agency1_entrust__c ,SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start cancelMultiyearInsurance__c, |
| | | [ SELECT Id,Name,Cancel_Decide__c,Agency_Hospital_Link__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,Agency1_entrust__c,cancelMultiyearInsurance__c, |
| | | Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Noteplus__c,Lead__c,Opportunity__c, |
| | | TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, |
| | | Agency2_entrust__c,//DB202302464682【报价委托】报价委托改善224 fy |
| | | Print_HP_Name__c,Account__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c |
| | | , urgent__c //20230104 lt DB202212427301 |
| | | FROM QuoteIrai__c Where Id =:quoId]; |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 End |
| | | // CHAN-BHNBX6 2019/11/20 START |
| | | List<QuoteIraiLineItem__c> items = //lastbuy 2022/3/10 fy start LastbuyProductFLG__c |
| | | List<QuoteIraiLineItem__c> items = //lastbuy 2022/3/10 fy start LastbuyProductFLG__c //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 start Is_DangerousChemicals__c,CanNotCancelledGurantee__c |
| | | [Select Id,Asset_Model_No__c,SFDA_Status__c,Name__c,BSS_Category__c,QuoteIrai__r.Quote_Print_Date__c, |
| | | Qty_Unit__c,Quantity__c,Product2__r.SFDA_Status__c,ProductCode__c,ListPrice__c,Product2__r.LastbuyProductFLG__c, |
| | | Qty_Unit__c,Quantity__c,Product2__r.SFDA_Status__c,ProductCode__c,ListPrice__c,Product2__r.LastbuyProductFLG__c,Product2__r.Is_DangerousChemicals__c,CanNotCancelledGurantee__c, |
| | | Product2__r.Sales_Possibility__c,Product2__r.Name,Product2__c,ServicePrice__c,NoDiscountTotal__c,GuaranteePeriod__c |
| | | From QuoteIraiLineItem__c where QuoteIrai__c = :quoId Order by Item_Order__c, Id]; |
| | | // CHAN-BHNBX6 2019/11/20 END |
| | |
| | | if (quo.Quote_Expiration_Date__c==null){ |
| | | quo.Quote_Expiration_Date__c = Date.today() + 30; |
| | | } |
| | | |
| | | //--Savebutton |
| | | Save_button=true; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | this.Save_button=false; |
| | | if(quo.QuoteIrai_Status__c != '草案中'&& String.isNotBlank(quo.QuoteIrai_Status__c)){ |
| | | this.Save_button=true; |
| | | } |
| | | // Save_button=true; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | system.debug('===fff==='+quo.QuoteIrai_Status__c); |
| | | system.debug('===ccc==='+this.Save_button); |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | // if( quo.Note__c!=''){ |
| | | if(String.isNotBlank(quo.Note__c)){ |
| | | system.debug('===111==='+quo.Note__c.split('\r\n')); |
| | | List<String> str=quo.Note__c.split('\r\n'); |
| | | if(str.size()==1){ |
| | | quo.Note__c=''; |
| | | }else{ |
| | | quo.Note__c=str[1]; |
| | | } |
| | | } |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | system.debug('===000==='+quo); |
| | | return null; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | // System.debug('---lt123---descriptions---'+descriptions); |
| | | if (descriptions.size() <= 0) { |
| | | errorflg = true; |
| | | errorMessage = '没有要委托的产品。'; |
| | |
| | | } |
| | | |
| | | String description = ''; |
| | | //20230116 fy start |
| | | String descriptionsendEmailp = ''; |
| | | String descriptionsendEmailbody = ''; |
| | | //20230116 fy end |
| | | Integer i = 1; |
| | | for (String d : descriptions) { |
| | | if (i == 1) { |
| | | description += d; |
| | | //20230116 fy start |
| | | descriptionsendEmailp += d; |
| | | //20230116 fy end |
| | | } else { |
| | | description += '\r\n' + d; |
| | | //20230116 fy start |
| | | descriptionsendEmailp += '\r\n' + d; |
| | | //20230116 fy end |
| | | } |
| | | i += 1; |
| | | } |
| | | if (!String.isBlank(quo.Note__c)) { |
| | | description += '\r\n' + quo.Note__c; |
| | | // System.debug('---lt123---description---'+description); |
| | | //obsap 新增经销商1字段 fy start |
| | | if (!String.isBlank(quo.Agency1_entrust__c)) { |
| | | Account quoteAeName = [select Id,Name from Account where Id =:quo.Agency1_entrust__c]; |
| | | description += '\r\n' + '第一经销商名称' + ':' + quoteAeName.Name; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + '第一经销商名称' + ':' + quoteAeName.Name; |
| | | //20230116 fy end |
| | | } |
| | | //DB202302464682【报价委托】报价委托改善224 fy start |
| | | if (!String.isBlank(quo.Agency2_entrust__c)) { |
| | | Account quoteAeName2 = [select Id,Name from Account where Id =:quo.Agency2_entrust__c]; |
| | | description += '\r\n' + '第二经销商名称' + ':' + quoteAeName2.Name; |
| | | descriptionsendEmailbody += '\r\n' + '第二经销商名称' + ':' + quoteAeName2.Name; |
| | | } |
| | | //DB202302464682【报价委托】报价委托改善224 fy end |
| | | if (quo.QuoteProportion__c!=null) { |
| | | description += '\r\n' + '报价比例' + ':' + quo.QuoteProportion__c; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + '报价比例' + ':' + quo.QuoteProportion__c; |
| | | //20230116 fy end |
| | | } |
| | | if (!String.isBlank(quo.IraiComment__c)) { |
| | | description += '\r\n' + '报价备注' + ':' + quo.IraiComment__c; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + '报价备注' + ':' + quo.IraiComment__c; |
| | | //20230116 fy end |
| | | } |
| | | //obsap 新增经销商1字段 fy end |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | String node; |
| | | if(!String.isBlank(quo.Note__c)){ |
| | | node=quo.Noteplus__c+'\r\n'+quo.Note__c; |
| | | }else{ |
| | | node=quo.Noteplus__c; |
| | | } |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | if (!String.isBlank(node)) { |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | description += '\r\n' + node; |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | // description += '\r\n' + quo.Note__c; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + node; |
| | | //20230116 fy end |
| | | } |
| | | if (!String.isBlank(quo.Account__c)) { |
| | | description += '\r\n' + Account.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + quo.Account__c; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + Account.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + quo.Account__c; |
| | | //20230116 fy end |
| | | } |
| | | // 经销商询价报价委托 2020-02-28 update by vivek start |
| | | if (!String.isBlank(quo.Agency_Hospital_Link__c)) { |
| | | description += '\r\n' + Agency_Hospital_Link__c.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + quo.Agency_Hospital_Link__c; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + Agency_Hospital_Link__c.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + quo.Agency_Hospital_Link__c; |
| | | //20230116 fy end |
| | | } |
| | | // 经销商询价报价委托 2020-02-28 update by vivek end |
| | | |
| | | //obsap 新增经销商1字段 fy start |
| | | if (!String.isBlank(quo.Agency1_entrust__c)) { |
| | | description += '\r\n' + '第一经销商' + ':' + baseUrl + '/' + quo.Agency1_entrust__c; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + '第一经销商' + ':' + baseUrl + '/' + quo.Agency1_entrust__c; |
| | | //20230116 fy end |
| | | } |
| | | //DB202302464682【报价委托】报价委托改善224 fy start |
| | | if (!String.isBlank(quo.Agency2_entrust__c)) { |
| | | description += '\r\n' + '第二经销商' + ':' + baseUrl + '/' + quo.Agency2_entrust__c; |
| | | descriptionsendEmailbody += '\r\n' + '第二经销商' + ':' + baseUrl + '/' + quo.Agency2_entrust__c; |
| | | } |
| | | //DB202302464682【报价委托】报价委托改善224 fy end |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | if (!String.isBlank(tenderid)&&!description.contains('招标项目') ) { |
| | | description += '\r\n' + '招标项目' + ':' + baseUrl + '/' + tenderid; |
| | | //20230116 fy start |
| | | descriptionsendEmailbody += '\r\n' + '招标项目' + ':' + baseUrl + '/' + tenderid; |
| | | //20230116 fy end |
| | | } |
| | | //SWAG-CKDATG【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | //obsap 新增经销商1字段 fy end |
| | | // 招投标报价委托 2020-06-21 update by gzw start |
| | | // if (!String.isBlank(quo.Tender_information__c)) { |
| | | // description += '\r\n' + Tender_information__c.sObjectType.getDescribe().getLabel() + ':' + baseUrl + '/' + quo.Tender_information__c; |
| | | // } |
| | | // 招投标报价委托 2020-06-21 update by gzw end |
| | | // obsap 委托人按公共小组区分,检索数量增加 2022-05-09 ssm start |
| | | List<String> irai_userids = new List<String>(); |
| | | // if (loginUser != null && String.isNotBlank(loginUser.Salesdepartment_text__c) && (loginUser.Salesdepartment_text__c == '5.华东' || loginUser.Salesdepartment_text__c == '6.华南')) { |
| | | //fy 20220512 |
| | | if (loginUser != null && String.isNotBlank(loginUser.Salesdepartment_text__c) && obsflag) { |
| | | |
| | | // obsflag = true; |
| | | // String obsap_group_id = System.Label.obsap_group_opp; |
| | | // List<GroupMember> members = [SELECT Id, GroupId, UserOrGroupId FROM GroupMember where GroupId = :obsap_group_id]; |
| | | // system.debug('members++'+members); |
| | | // if (members != null && members.size() > 0) { |
| | | // for (GroupMember member : members) { |
| | | // irai_userids.add(member.UserOrGroupId); |
| | | // } |
| | | // } |
| | | irai_userids.add(System.Label.obsap_group_opp); |
| | | }else{ |
| | | irai_userids.add(quo.IraiUser__c); |
| | | } |
| | | // 把委托上绑定的人加到list里 |
| | | //20220512 lt add |
| | | // Map<String,String> iuMap = new Map<String,String>(); |
| | | // for(String iu : irai_userids){ |
| | | // iuMap.put(iu,iu); |
| | | // } |
| | | // if(!iuMap.containsKey(quo.IraiUser__c)){ |
| | | // irai_userids.add(quo.IraiUser__c); |
| | | // } |
| | | //irai_userids.add(quo.IraiUser__c); |
| | | // Task[] tasks = [select Id,Subject,OwnerId,Description,ActivityDate,QuoteIraiId__c |
| | | // from Task |
| | | // where QuoteIraiId__c = :quoId and OwnerId = :quo.IraiUser__c]; |
| | | Task[] tasks = [select Id,Subject,OwnerId,Description,ActivityDate,QuoteIraiId__c |
| | | from Task |
| | | where QuoteIraiId__c = :quoId and OwnerId = :quo.IraiUser__c]; |
| | | String todoSubject = '报价委托:' + quo.IraiSubject__c; |
| | | where QuoteIraiId__c = :quoId and OwnerId in :irai_userids]; |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy start |
| | | List<String> HeadquartersArray= quo.Headquarters__c.split('\\.'); |
| | | String Headquarters = ''; |
| | | if(HeadquartersArray.size()>0){ |
| | | Headquarters = HeadquartersArray.size()>=2 ? HeadquartersArray[1]:HeadquartersArray[0]; |
| | | } |
| | | // String todoSubject = '报价委托:' + quo.IraiSubject__c; |
| | | String todoSubject = Headquarters+'报价委托:' + quo.IraiSubject__c; |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy end |
| | | // 20230104 lt DB202212427301 start |
| | | if(quo.Urgent__c){ |
| | | todoSubject = '【紧急】' + todoSubject; |
| | | } |
| | | |
| | | // 20230104 lt DB202212427301 end |
| | | if (!String.isBlank(quo.IraiName__c)) { |
| | | todoSubject += ', ' + quo.IraiName__c; |
| | | } |
| | |
| | | if (quo.QuoteProportion__c != null) { |
| | | todoSubject += ', ' + quo.QuoteProportion__c + '%'; |
| | | } |
| | | String taskid = ''; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | todoSubject += quo.cancelMultiyearInsurance__c=='不要' ?',取消多年保':',需要多年保'; |
| | | // if (quo.cancelMultiyearInsurance__c=='不要') { |
| | | // todoSubject += ',取消多年保'; |
| | | // }else{ |
| | | // todoSubject += ',需要多年保'; |
| | | // } |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | // String taskid = ''; |
| | | // 改成对多人的 |
| | | // if (tasks.size() > 0) { |
| | | // Task task = tasks[0]; |
| | | // task.Subject = todoSubject; |
| | | // task.Description = description; |
| | | // task.ActivityDate = Date.today(); |
| | | |
| | | // Database.DMLOptions dmlo = new Database.DMLOptions(); |
| | | // dmlo.EmailHeader.triggerUserEmail = true; |
| | | // Database.update(task, dmlo); |
| | | // taskid = task.Id; |
| | | // } else { |
| | | // Task task = new Task(); |
| | | // task.Subject = todoSubject; |
| | | // task.OwnerId = quo.IraiUser__c; |
| | | // task.Description = description; |
| | | // task.ActivityDate = Date.today(); |
| | | // task.QuoteIraiId__c = quoId; |
| | | |
| | | // Database.DMLOptions dmlo = new Database.DMLOptions(); |
| | | // dmlo.EmailHeader.triggerUserEmail = true; |
| | | // Database.insert(task, dmlo); |
| | | // taskid = task.Id; |
| | | // } |
| | | List<String> new_task_users = new List<String>(); |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy start |
| | | List<String> taskIdL = new List<String>(); |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy end |
| | | if (tasks.size() > 0) { |
| | | Task task = tasks[0]; |
| | | task.Subject = todoSubject; |
| | | task.Description = description; |
| | | task.ActivityDate = Date.today(); |
| | | |
| | | Database.DMLOptions dmlo = new Database.DMLOptions(); |
| | | dmlo.EmailHeader.triggerUserEmail = true; |
| | | Database.update(task, dmlo); |
| | | taskid = task.Id; |
| | | List<String> task_users = new List<String>(); |
| | | for (Task task : tasks) { |
| | | task_users.add(task.OwnerId); |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy start |
| | | taskIdL.add(task.Id); |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy end |
| | | task.Subject = todoSubject; |
| | | task.Description = description; |
| | | task.ActivityDate = Date.today(); |
| | | } |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy start |
| | | // Database.DMLOptions dmlo = new Database.DMLOptions(); |
| | | // dmlo.EmailHeader.triggerUserEmail = true; |
| | | // Database.update(tasks, dmlo); |
| | | update tasks; |
| | | if(taskIdL.size()>0){ |
| | | sendEmail(todoSubject,descriptionsendEmailp,descriptionsendEmailbody,taskIdL[0],Headquarters); |
| | | } |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy end |
| | | for (String uid : irai_userids) { |
| | | if (!task_users.contains(uid)) { |
| | | new_task_users.add(uid); |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | Task task = new Task(); |
| | | task.Subject = todoSubject; |
| | | task.OwnerId = quo.IraiUser__c; |
| | | task.Description = description; |
| | | task.ActivityDate = Date.today(); |
| | | task.QuoteIraiId__c = quoId; |
| | | |
| | | Database.DMLOptions dmlo = new Database.DMLOptions(); |
| | | dmlo.EmailHeader.triggerUserEmail = true; |
| | | Database.insert(task, dmlo); |
| | | taskid = task.Id; |
| | | new_task_users = irai_userids; |
| | | } |
| | | if (new_task_users.size() > 0) { |
| | | List<Task> new_tasks = new List<Task>(); |
| | | for (String uid : new_task_users) { |
| | | Task new_task = new Task(); |
| | | new_task.Subject = todoSubject; |
| | | new_task.OwnerId = uid; |
| | | new_task.Description = description; |
| | | new_task.ActivityDate = Date.today(); |
| | | new_task.QuoteIraiId__c = quoId; |
| | | // 20230109 lt DB202212427301 start |
| | | if(quo.Urgent__c){ |
| | | new_task.Priority = '高'; |
| | | } |
| | | // 20230109 lt DB202212427301 start |
| | | |
| | | new_tasks.add(new_task); |
| | | } |
| | | system.debug('new_tasks++'+new_tasks); |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy start |
| | | // Database.DMLOptions dmlo = new Database.DMLOptions(); |
| | | // dmlo.EmailHeader.triggerUserEmail = true; |
| | | // Database.insert(new_tasks, dmlo); |
| | | insert new_tasks; |
| | | sendEmail(todoSubject,descriptionsendEmailp,descriptionsendEmailbody,new_tasks[0].Id,Headquarters); |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy end |
| | | } |
| | | // obsap 委托人按公共小组区分,检索数量增加 2022-05-09 ssm end |
| | | |
| | | User u = [select Id,Name from user where Id = :quo.IraiUser__c]; |
| | | quo.LastIraiUser__c = u.Name; |
| | | QuoteIrai__c qi = new QuoteIrai__c(Id = quoId); |
| | | qi.LastIraiUser__c = quo.LastIraiUser__c; |
| | | qi.Urgent__c = quo.Urgent__c; //20230104 lt DB202212427301 shart |
| | | //报价委托状态更新 已经委托 |
| | | qi.QuoteIrai_Status__c = '已经委托'; |
| | | //DB202211607582 fy 【报价委托】报价委托页面需求 start |
| | | qi.EntrustmentDate__c = Date.today(); |
| | | //DB202211607582 fy 【报价委托】报价委托页面需求 end |
| | | update qi; |
| | | |
| | | if(String.isNotBlank(quoId)){ |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | | quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c, |
| | | Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c, |
| | | TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy Lead__c,Opportunity__c, |
| | | quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 新增经销商1字段 fy satrt Agency1_entrust__c,SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start cancelMultiyearInsurance__c, |
| | | Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c, |
| | | TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,Agency2_entrust__c,//DB202302464682【报价委托】报价委托改善224 fy |
| | | Print_HP_Name__c,Account__c,Agency_Hospital_Link__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c |
| | | , urgent__c //20230104 lt DB202212427301 |
| | | FROM QuoteIrai__c Where Id =:quoId]; |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 End |
| | | } |
| | | |
| | | // 招投标报价委托 2020-06-21 update by gzw start |
| | | if (!String.isBlank(quo.Tender_information__c)) { |
| | | Tender_information__c tender = new Tender_information__c(Id = quo.Tender_information__c); |
| | |
| | | // 招投标报价委托 2020-06-21 update by gzw end |
| | | errorflg = true; |
| | | errorMessage = '邮件发送完成。'; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | this.Save_button=true; |
| | | //XLIU-CHY4KW 20220907 lt start --- 报价委托发送邮件成功之后 反向更新意向 报价委托字段为1 |
| | | Lead lea = new Lead(); |
| | | if(String.isNotBlank(leadid)){ |
| | | lea.Id = leadid; |
| | | lea.OfferToEntrust__c = 1; |
| | | //20230227 lt DB202302251962 start |
| | | List<Lead> leadlist = [select Id,Firsttime_Quote_Irai__c from Lead where Id = :leadid]; |
| | | System.debug('lt123日期1'+ leadlist[0].Firsttime_Quote_Irai__c); |
| | | System.debug('lt123日期2'+ lea.Firsttime_Quote_Irai__c); |
| | | if(leadlist.size() > 0){ |
| | | if(leadlist[0].Firsttime_Quote_Irai__c == null){ |
| | | lea.Firsttime_Quote_Irai__c = Date.today(); |
| | | } |
| | | } |
| | | //20230227 lt DB202302251962 end |
| | | update lea; |
| | | } |
| | | //XLIU-CHY4KW 20220907 lt end |
| | | |
| | | pageArrange(); |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | // if(quo.Note__c!=''){ |
| | | if(String.isNotBlank(quo.Note__c)){ |
| | | system.debug('===555==='+quo.Note__c.split('\r\n')); |
| | | List<String> str=quo.Note__c.split('\r\n'); |
| | | if(str.size()==1){ |
| | | quo.Note__c=''; |
| | | }else{ |
| | | quo.Note__c=str[1]; |
| | | } |
| | | } |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | return null; |
| | | //报价委托状态更新 已经委托 |
| | | } catch (DmlException de) { |
| | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | public String getoppId(){ |
| | | String opptext = null; |
| | | if(String.isNotBlank(quoId)){ |
| | | QuoteIrai__c getnote = [ SELECT Id,Name,Note__c FROM QuoteIrai__c Where Id =:quoId]; |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy Lead__c,Opportunity__c, |
| | | QuoteIrai__c getnote = [ SELECT Id,Name,Note__c,Noteplus__c,Lead__c,Opportunity__c FROM QuoteIrai__c Where Id =:quoId]; |
| | | if(String.isNotBlank(getnote.Note__c) && getnote.Note__c.indexOf( 'com/') > 0){ |
| | | opptext = getnote.Note__c.SubString(getnote.Note__c.LastIndexOf('/')+1,getnote.Note__c.LastIndexOf('/')+16); |
| | | } |
| | |
| | | } |
| | | |
| | | public boolean dataCheck(){ |
| | | //20220310 fy lastbuy start |
| | | if (quoId!=null){ |
| | | //20220310 fy lastbuy start |
| | | // 增加变更用户询价判断 |
| | | // if (quoId!=null){ |
| | | if (String.isNotBlank(this.oppid) && !is_changed_opp){ |
| | | if(!ReservedProductVerification()){ |
| | | if(flglastbuy==1){ |
| | | errorflg = true; |
| | |
| | | // errormessage = '该报价委托存在预留产品'; |
| | | // return false; |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //20220310 fy lastbuy end |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 start |
| | | String resalt = assdproductCheck(); |
| | | if(resalt!='OK'){ |
| | | errorflg = true; |
| | | errormessage = resalt ; |
| | | return false; |
| | | } |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 end |
| | | system.debug('○○○○○○○○○○○○Welcome to dataCheck class!!○○○○○○○○○○○○'); |
| | | errorflg = false; |
| | | errormessage = null; |
| | |
| | | if (error == true){ |
| | | if (quoId != null) { |
| | | Map<String,QuoteIraiLineItem__c> itemmap = new Map<String,QuoteIraiLineItem__c>(); |
| | | for (QuoteIraiLineItem__c item : [//lastbuy 2022/3/10 fy start LastbuyProductFLG__c |
| | | Select Id,Product2__r.SFDA_Status__c,Product2__r.Name,Product2__c,Product2__r.LastbuyProductFLG__c |
| | | for (QuoteIraiLineItem__c item : [//lastbuy 2022/3/10 fy start LastbuyProductFLG__c //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 start Product2__r.Is_DangerousChemicals__c |
| | | Select Id,Product2__r.SFDA_Status__c,Product2__r.Name,Product2__c,Product2__r.LastbuyProductFLG__c,Product2__r.Is_DangerousChemicals__c |
| | | From QuoteIraiLineItem__c where QuoteIrai__c = :quoId Order by Item_Order__c, Id]) { |
| | | itemmap.put(item.Product2__c,item); |
| | | } |
| | |
| | | q = New QuoteIrai__c(); |
| | | }else{ |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | | List<QuoteIrai__c> qs = New List<QuoteIrai__c>(); |
| | | qs = [select Id,Account__c,Agency_Hospital_Link__c,Name,IraiUser__c,IraiSubject__c,Tender_information__c, |
| | | Preferential_Trading_Price__c,Discount__c,Pricing__c,Unit_Price__c,Offer_Amount__c,TOTAL__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, |
| | | List<QuoteIrai__c> qs = New List<QuoteIrai__c>();//obsap 新增经销商1字段 fy satrt Agency1_entrust__c,SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start cancelMultiyearInsurance__c, |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy Lead__c,Opportunity__c, |
| | | qs = [select Id,Account__c,Agency_Hospital_Link__c,Name,IraiUser__c,IraiSubject__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c, |
| | | Preferential_Trading_Price__c,Discount__c,Pricing__c,Unit_Price__c,Offer_Amount__c,TOTAL__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,Agency2_entrust__c,//DB202302464682【报价委托】报价委托改善224 fy |
| | | Contract__c,Print_HP_Name__c,Quote_Expiration_Date__c,Quote_Comment__c,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c |
| | | , urgent__c //20230104 lt DB202212427301 |
| | | From QuoteIrai__c Where Id =:quoId]; |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 End |
| | | if (qs.size()>0){ |
| | |
| | | // 招投标报价委托 2020-06-21 update by gzw end |
| | | q.IraiUser__c = quo.IraiUser__c; |
| | | q.IraiName__c = quo.IraiName__c; |
| | | //obsap 新增经销商1字段 fy staty |
| | | q.Agency1_entrust__c = quo.Agency1_entrust__c; |
| | | //obsap 新增经销商1字段 fy staty |
| | | //DB202302464682【报价委托】报价委托改善224 fy start |
| | | q.Agency2_entrust__c = quo.Agency2_entrust__c; |
| | | //DB202302464682【报价委托】报价委托改善224 fy end |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | q.cancelMultiyearInsurance__c = quo.cancelMultiyearInsurance__c; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | q.QuoteProportion__c = quo.QuoteProportion__c; |
| | | q.CurrencyIsoCode = quo.CurrencyIsoCode; |
| | | q.Note__c = quo.Note__c; |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | q.Noteplus__c=quo.Noteplus__c; |
| | | if(!String.isBlank(quo.Note__c)){ |
| | | q.Note__c = quo.Noteplus__c+'\r\n'+quo.Note__c; |
| | | }else { |
| | | q.Note__c = quo.Noteplus__c; |
| | | } |
| | | |
| | | System.debug('===222==='+quo.Noteplus__c+' ===333=== '+q.Note__c); |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | // q.Note__c = quo.Note__c; |
| | | q.IraiComment__c = quo.IraiComment__c; |
| | | //----checkbox は印刷直前に保存 |
| | | q.Quote_Expiration_Date__c = quo.Quote_Expiration_Date__c; |
| | | q.Quote_Comment__c = quo.Quote_Comment__c; |
| | | q.LastIraiUser__c = quo.LastIraiUser__c; |
| | | q.Urgent__c = quo.Urgent__c; //20230104 lt DB202212427301 shart |
| | | system.debug('标准价格2:'+qb.Estimation_List_Price); |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/10 Start |
| | | q.Estimation_List_Price__c = qb.Estimation_List_Price; |
| | | q.MultiYearWarrantyTotalPrice__c = qb.MultiYearWarrantyTotalPrice; |
| | | q.QuoteTotal_Page__c = qb.QuoteTotal_Page; |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/10 END |
| | | |
| | | |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy start |
| | | q.Lead__c=leadid; |
| | | q.Opportunity__c=oppid; |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy end |
| | | if (quoId==null){ |
| | | insert q; |
| | | }else{ |
| | | update q; |
| | | } |
| | | quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c, |
| | | Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c, |
| | | TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c, |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy Noteplus__c |
| | | //SWAG-CF589P【委托】【P:OBSAP】报价委托相关新需求评估 fy Lead__c,Opportunity__c, |
| | | quo =[ SELECT Id,Name,Cancel_Decide__c,CreatedDate, PriceRefreshDate__c,Quote_Print_Date__c,//obsap 新增经销商1字段 fy satrt Agency1_entrust__c,SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start cancelMultiyearInsurance__c, |
| | | Quote_Date__c,QuoteToName__c,Quote_Expiration_Date__c,Quote_Comment__c,Tender_information__c,Agency1_entrust__c,Noteplus__c,Lead__c,Opportunity__c,cancelMultiyearInsurance__c,Headquarters__c,//DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy Headquarters__c |
| | | TOTAL__c,Discount__c,Pricing__c,Preferential_Trading_Price__c,Contract__c,LastIraiUser__c,MultiYearWarrantyTotalPrice__c,QuoteTotal_Page__c,Estimation_List_Price__c,Agency2_entrust__c,//DB202302464682【报价委托】报价委托改善224 fy |
| | | Print_HP_Name__c,Account__c,Agency_Hospital_Link__c,IraiUser__c,IraiSubject__c,CurrencyIsoCode,IraiName__c,QuoteIrai_Status__c,QuoteProportion__c,Note__c,IraiComment__c |
| | | , urgent__c //20230104 lt DB202212427301 |
| | | FROM QuoteIrai__c Where Id =:q.Id]; |
| | | |
| | | system.debug('○○○○○Save1○○○○○'); |
| | |
| | | quoId = q.Id; |
| | | |
| | | } |
| | | |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy start |
| | | // if(quo.Note__c!=''){ |
| | | if(String.isNotBlank(quo.Note__c)){ |
| | | system.debug('===444==='+quo.Note__c.split('\r\n')); |
| | | List<String> str=quo.Note__c.split('\r\n'); |
| | | if(str.size()==1){ |
| | | quo.Note__c=''; |
| | | }else{ |
| | | quo.Note__c=str[1]; |
| | | } |
| | | } |
| | | //XLIU-CFE8M7 【委托】【P-OBSAP】报价委托任务改善 fy end |
| | | return true; |
| | | } |
| | | //lastbuy 2022/3/10 fy start |
| | |
| | | system.debug('filg====='+filg); |
| | | return filg; |
| | | } |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 start |
| | | //阿西赛多验证 |
| | | public String assdproductCheck(){ |
| | | Boolean falg = false; |
| | | String str = 'OK'; |
| | | List<Product2> axsdQuoteIItem = new List<Product2>(); |
| | | List<Product2> QuoteIItem = new List<Product2>(); |
| | | List<Id> Product2List = new List<Id>(); |
| | | System.debug('activities111111!!!'+activities); |
| | | for(QELine aaa :activities){ |
| | | if(String.isNotBlank(aaa.pageObject.Product2__c)){ |
| | | Product2List.add(aaa.pageObject.Product2__c); |
| | | } |
| | | } |
| | | List<Product2> productlist = [select id,Is_DangerousChemicals__c from Product2 where id in:Product2List]; |
| | | for(Product2 pro :productlist){ |
| | | System.debug('Is_DangerousChemicals__c111111!!!'+pro.Is_DangerousChemicals__c); |
| | | if(pro.Is_DangerousChemicals__c){ |
| | | falg = true; |
| | | axsdQuoteIItem.add(pro); |
| | | }else if(!pro.Is_DangerousChemicals__c){ |
| | | QuoteIItem.add(pro); |
| | | } |
| | | } |
| | | if(QuoteIItem.size() > 0 && axsdQuoteIItem.size() > 0){ |
| | | str = '阿西赛多产品不能和其他产品一起报价'; |
| | | }else{ |
| | | if(falg){ |
| | | str = OpportunityWebService.checkDangerItem(quo.Agency1_entrust__c); |
| | | } |
| | | } |
| | | return str; |
| | | } |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 end |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy start |
| | | private static void sendEmail(String title , String bodyTextp , String bodyTextbody,String TaskId,String Headquarters) { |
| | | system.debug('bodyText++'+bodyTextp+bodyTextbody); |
| | | bodyTextbody = bodyTextbody.replaceFirst('\r\n', ''); |
| | | List<Task> TaskList = [select Id,Request_staff__c,ActivityDate,Priority from Task where Id =:TaskId]; |
| | | Task Taskobj = TaskList[0]; |
| | | //20230116 fy start |
| | | String bodyTextbu ='新建任务'; |
| | | bodyTextbu += '\r\n\r\n'+'到:OBSAP成员'; |
| | | if(String.isNotBlank(Headquarters)){ |
| | | Headquarters='('+Headquarters+')'; |
| | | } |
| | | bodyTextbu += '\r\n'+Taskobj.Request_staff__c +Headquarters+' 已分配给您以下新建任务:'; |
| | | bodyTextbu += '\r\n'+'主题: '+title; |
| | | bodyTextbu += '\r\n'+'结束期限: '+Taskobj.ActivityDate; |
| | | bodyTextbu += '\r\n'+'优先级: '+Taskobj.Priority; |
| | | bodyTextbu += '\r\n' +'评论:<pre>'+bodyTextp+'</pre>'; |
| | | bodyTextbu += bodyTextbody; |
| | | bodyTextbu += '\r\n\r\n' +'有关更多详细信息,请单击以下链接:'+'\r\n\r\n'+'https://ocsm.my.salesforce.com/'+Taskobj.Id; |
| | | bodyTextbu = bodyTextbu.replace('\r\n', '<br/>'); |
| | | bodyTextbu = bodyTextbu.replaceFirst('<br/>', ''); |
| | | System.debug('bodyTextbu+++'+bodyTextbu); |
| | | //20230116 fy end |
| | | Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); |
| | | List<String> toAddresses = new List<String>(); |
| | | toAddresses.add(System.Label.OBSAP_Group_Mail); |
| | | // toAddresses.add('fuyu@prec-tech.com'); |
| | | //收件人地址 |
| | | mail.setToAddresses(toAddresses); |
| | | String Detection = System.Label.OBSAP_QuoteIrai_Mail_Detection; |
| | | if(!Detection.equals('invalid') && String.isNotBlank(Detection)){ |
| | | String[] toccAddresses = System.Label.OBSAP_QuoteIrai_Mail_Detection.split(','); |
| | | //抄送人地址 |
| | | mail.setCcAddresses(toccAddresses); |
| | | } |
| | | //邮件主题 |
| | | mail.setSubject(title); |
| | | //内容的编码 |
| | | mail.setCharset('UTF-8'); |
| | | //邮件内容 |
| | | mail.setHtmlBody(bodyTextbu); |
| | | //使用电子邮件模板设置对象id |
| | | // mail.setTargetObjectId(TaskId); |
| | | //设置电子邮件模板id |
| | | // EmailTemplate temp = [ |
| | | // SELECT Id, Name, Subject, HtmlValue, Body, BrandTemplateId |
| | | // FROM EmailTemplate |
| | | // WHERE DeveloperName = 'Task_To_Queue' |
| | | // LIMIT 1 |
| | | // ]; |
| | | // mail.setTemplateId(temp.Id); |
| | | //发送邮件 |
| | | Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); |
| | | } |
| | | //DB202301106714 【报价委托改善】OBSAP通知邮件发送邮箱修改 fy end |
| | | |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | | public class QuoteBean { |
| | |
| | | public Decimal QuoteTotal_Page { get; set; } |
| | | //NoDiscount price 合计 |
| | | public Decimal MultiYearWarrantyTotalPrice { get; set; } |
| | | |
| | | //obsap 新增经销商1字段 fy |
| | | public Decimal SalesCalculation1 { get; set; } |
| | | } |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 End |
| | | |
| | |
| | | public Decimal NoDiscount_Page { get; set; } |
| | | public Decimal NoDiscountTotal_Page { get; set; } |
| | | // CHAN-BHNBX6 2019/11/20 END |
| | | |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | public String CanNotCancelledGurantee { get; set; } |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | |
| | | // TODO ほんとうはいらない、使うところのロジックを修正しなければいけない、削除するようにしたいです。 |
| | | public QELine(Integer i) { |
| | |
| | | } |
| | | |
| | | // CHAN-BHNBX6 2019/11/20 END |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | this.CanNotCancelledGurantee = qli.CanNotCancelledGurantee__c?'true':'false'; |
| | | // SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | } |
| | | |
| | | // TODO Subtotal__c、以前のロジックを確認 |