| | |
| | | |
| | | // 询价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]; |
| | | } |
| | | system.debug('oppid:++++'+oppid); |
| | | // 报价id |
| | | String oppquoid = System.currentPageReference().getParameters().get('oppquoid'); |
| | |
| | | // 已经存在报价 |
| | | if (String.isNotBlank(oppquoid)) { |
| | | // 报价商品取得 |
| | | // CHAN-BHNBX6 2019/11/20 START |
| | | List<QuoteLineItem> qlis = [select id,PricebookEntry.Product2Id,Quantity__c,CurrencyIsoCode,GuaranteePeriod__c from QuoteLineItem where QuoteId = :oppquoid]; |
| | | // 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]; |
| | | // CHAN-BHNBX6 2019/11/20 END |
| | | List<String> productids = new List<String>(); |
| | | for (QuoteLineItem qli : qlis) { |
| | |
| | | FROM QuoteIrai__c Where Id =:quoId]; |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 End |
| | | // CHAN-BHNBX6 2019/11/20 START |
| | | List<QuoteIraiLineItem__c> items = |
| | | List<QuoteIraiLineItem__c> items = //lastbuy 2022/3/10 fy start LastbuyProductFLG__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, |
| | | Qty_Unit__c,Quantity__c,Product2__r.SFDA_Status__c,ProductCode__c,ListPrice__c,Product2__r.LastbuyProductFLG__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 |
| | |
| | | |
| | | public boolean dataCheck(){ |
| | | //20220310 fy lastbuy start |
| | | if(!ReservedProductVerification()){ |
| | | if(flglastbuy==1){ |
| | | errorflg = true; |
| | | errormessage = '预留产品表中没有录入该报价的预留产品' ; |
| | | return false; |
| | | }else if(flglastbuy==2){ |
| | | errorflg = true; |
| | | errormessage = errorProductmodel+'产品数量不可超过产品预留数量' ; |
| | | return false; |
| | | }else if(flglastbuy==3){ |
| | | errorflg = true; |
| | | errormessage = '预留产品'+errorProductmodel+'未录入预留产品表'; |
| | | return false; |
| | | if (quoId!=null){ |
| | | if(!ReservedProductVerification()){ |
| | | if(flglastbuy==1){ |
| | | errorflg = true; |
| | | errormessage = '预留产品表中没有录入该报价委托的预留产品' ; |
| | | return false; |
| | | }else if(flglastbuy==2){ |
| | | errorflg = true; |
| | | errormessage = errorProductmodel+'产品数量不可超过产品预留数量' ; |
| | | return false; |
| | | }else if(flglastbuy==3){ |
| | | errorflg = true; |
| | | errormessage = '预留产品'+errorProductmodel+'未录入预留产品表'; |
| | | return false; |
| | | } |
| | | // else if(flglastbuy==4){ |
| | | // errorflg = true; |
| | | // errormessage = '该报价委托存在预留产品'; |
| | | // return false; |
| | | // } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //20220310 fy lastbuy end |
| | | system.debug('○○○○○○○○○○○○Welcome to dataCheck class!!○○○○○○○○○○○○'); |
| | | errorflg = false; |
| | |
| | | if (error == true){ |
| | | if (quoId != null) { |
| | | Map<String,QuoteIraiLineItem__c> itemmap = new Map<String,QuoteIraiLineItem__c>(); |
| | | for (QuoteIraiLineItem__c item : [ |
| | | Select Id,Product2__r.SFDA_Status__c,Product2__r.Name,Product2__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 |
| | | From QuoteIraiLineItem__c where QuoteIrai__c = :quoId Order by Item_Order__c, Id]) { |
| | | itemmap.put(item.Product2__c,item); |
| | | } |
| | |
| | | } |
| | | //lastbuy 2022/3/10 fy start |
| | | public boolean ReservedProductVerification() { |
| | | |
| | | filg=true; |
| | | Map<string,QuoteIraiLineItem__c> quotlinitMap = new Map<string,QuoteIraiLineItem__c>(); |
| | | List<Id> lastProductFLGListId = new List<Id>(); |
| | | List<QuoteIraiLineItem__c> lastProductFLGList = new List<QuoteIraiLineItem__c>(); |
| | | List<QuoteIraiLineItem__c> act = new List<QuoteIraiLineItem__c>(); |
| | | List<QuoteIraiLineItem__c> act2 = new List<QuoteIraiLineItem__c>(); |
| | | Map<string,string> actMap = new Map<string,string>(); |
| | | for(QELine aaa :activities){ |
| | | System.debug('131313131!!!'+aaa.pageObject.Product2__r.LastbuyProductFLG__c); |
| | | if(aaa.pageObject.Product2__c!=null&&aaa.pageObject.Quantity__c!=null){ |
| | | actMap.put(aaa.pageObject.Product2__c,aaa.Asset_Model); |
| | | act.add(aaa.pageObject); |
| | | } |
| | | } |
| | |
| | | } |
| | | System.debug('3434343!!!'+activities); |
| | | System.debug('5656565!!!'+map1); |
| | | List<Product2> productlist = [select id,LastbuyProductFLG__c from Product2 where id in:map1.keySet()]; |
| | | Map<String,boolean> productMap = new Map<String,boolean>(); |
| | | System.debug('9999999666!!!'+productlist); |
| | | if(productlist!=null&&productlist.size()!=0){ |
| | | for(Product2 product : productlist){ |
| | | productMap.put(product.id,product.LastbuyProductFLG__c); |
| | | } |
| | | } |
| | | for (QuoteIraiLineItem__c value : map1.values()) { |
| | | if(value.Product2__r.LastbuyProductFLG__c){ |
| | | if(productMap.get(value.Product2__c)){ |
| | | lastProductFLGListId.add(value.Product2__c); |
| | | quotlinitMap.put(value.Product2__c,value); |
| | | lastProductFLGList.add(value); |
| | | } |
| | | } |
| | | } |
| | | System.debug('activities++++!!!'+activities); |
| | | System.debug('activities!!!'+map1.values()); |
| | | System.debug('oppId!!!'+oppId); |
| | | System.debug('lastProductFLGList!!!'+lastProductFLGListId); |
| | | if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){ |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true]; |
| | | // if(oppid==null){ |
| | | // flglastbuy=4; |
| | | // filg=false; |
| | | // return filg; |
| | | // } |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppid and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true]; |
| | | Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); |
| | | System.debug('LastbuyObjList+++++!!!'+LastbuyObjList); |
| | | if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ |
| | |
| | | quoteLItemNum=LastbuyObjMap.get(lastbuypr.Product2__c).LastbuyQuantity__c; |
| | | System.debug('quoteLItemNum!!!'+quoteLItemNum); |
| | | System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c); |
| | | if(lastbuypr.Quantity__c>quoteLItemNum){ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | if(lastbuypr.Quantity__c>quoteLItemNum){actMap.get(lastbuypr.Product2__c); |
| | | errorProductmodel=actMap.get(lastbuypr.Product2__c); |
| | | flglastbuy=2; |
| | | filg=false; |
| | | break; |
| | | } |
| | | }else{ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | errorProductmodel=actMap.get(lastbuypr.Product2__c); |
| | | flglastbuy=3; |
| | | filg=false; |
| | | break; |