From 8ea597d3c67631cd702415d43bc3d2961f6bc94d Mon Sep 17 00:00:00 2001 From: 付煜 <fuyu3103346691@163.com> Date: 星期五, 25 三月 2022 09:49:28 +0800 Subject: [PATCH] lastbuy询价相关 --- force-app/main/default/classes/SI_NewQuoteEntryController.cls | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 114 insertions(+), 4 deletions(-) diff --git a/force-app/main/default/classes/SI_NewQuoteEntryController.cls b/force-app/main/default/classes/SI_NewQuoteEntryController.cls index cc6d526..04bda2a 100644 --- a/force-app/main/default/classes/SI_NewQuoteEntryController.cls +++ b/force-app/main/default/classes/SI_NewQuoteEntryController.cls @@ -10,6 +10,12 @@ public Boolean changedAfterBid { get; set; } // true 銇牬鍚堛�佺敾闈€伀 confirm 銉°儍銈汇兗銈搞亴琛ㄧず銇椼伨銇欍�俼uoId銈掓柊銇椼亜insert銆傚垽瀹氥伅js銇仹瀹熸柦 //public Id qlistId { get; set; } + //lastbuy 2022/2/9 fy start + public Boolean filg { get; set; } + public Integer flglastbuy { get; set; } + public String errorProductmodel { get; set; } + //lastbuy 2022/2/9 fy end + public String excel_text { get; set; } public Integer select_index { get; set; } // excelImport灏傜敤銇с仚銇屻�乯s銇仸鍒跺尽銇欍倠銇撱仺銇仾銈嬨伄銇с�乀ODO katsu 鍓婇櫎浜堝畾 public String Product_text { get; set; } @@ -414,7 +420,8 @@ ,PricebookEntry.Product2.NoDiscount_Foreign__c ,Quote.Opportunity.Trade__c //澶栬锤澶氬勾淇� 2021/01/27 绮剧悽鎶�鏈� wql end - + //fy 棰勭暀浜у搧鏍囪瘑 + ,PricebookEntry.Product2.LastbuyProductFLG__c //SFDC鍋滄棰勮 lt 20211009 start ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c //SFDC鍋滄棰勮 lt 20211009 end @@ -813,7 +820,8 @@ //NoDiscount 閲戦锛圲SD锛� ,NoDiscount_Foreign__c //澶栬锤澶氬勾淇� 2021/01/27 绮剧悽鎶�鏈� wql end - + //fy 棰勭暀浜у搧鏍囪瘑 + ,LastbuyProductFLG__c //SFDC鍋滄棰勮 lt 20211009 start ,Estimated_ConsumptionDueDate__c //SFDC鍋滄棰勮 lt 20211009 end @@ -1014,6 +1022,7 @@ } //娣诲姞琛� public void addMultipleRow() { + system.debug('11111111111111111===11111111111111'); List<QELine> tmpQELine = new List<QELine>(); //椤甸潰涓婄殑杈撳叆妗嗚拷鍔� (鍙兘鍦ㄦ湯灏捐拷鍔�) @@ -1225,7 +1234,8 @@ //NoDiscount 閲戦锛圲SD锛� ,NoDiscount_Foreign__c //澶栬锤澶氬勾淇� 2021/01/27 绮剧悽鎶�鏈� wql end - + //fy 棰勭暀浜у搧鏍囪瘑 + ,LastbuyProductFLG__c //SFDC鍋滄棰勮 lt 20211009 start ,Estimated_ConsumptionDueDate__c //SFDC鍋滄棰勮 lt 20211009 end @@ -1675,6 +1685,23 @@ StockFlg++; } } + //20220215 fy lastbuy start + if(!ReservedProductVerification()){ + if(flglastbuy==1){ + errorflg = true; + errormessage = '棰勭暀浜у搧琛ㄤ腑娌℃湁璇ヨ浠凤紝璇烽�氳繃鏈儴绐楀彛鑱旂郴钀ヤ笟绠$悊璇�' ; + return null; + }else if(flglastbuy==2){ + errorflg = true; + errormessage = errorProductmodel+'浜у搧鏁伴噺涓嶅彲瓒呰繃浜у搧棰勭暀鏁伴噺' ; + return null; + }else if(flglastbuy==3){ + errorflg = true; + errormessage = '棰勭暀浜у搧'+errorProductmodel+'鏈綍鍏ラ鐣欎骇鍝佽〃'; + return null; + } + } + //20220215 fy lastbuy end system.debug('PassFlg:'+PassFlg); system.debug('StockFlg:'+StockFlg); if(PassFlg == 0&&oldListCheck[0].Old_Opportunity_ID__c==null){ @@ -2560,6 +2587,7 @@ //Sap閫佷俊,Print銇悎銈忋仜銇�1锝� Integer i=1; if (activities.size()>0) { + system.debug('activities+++***+++'+activities); for (QELine s:activities) { if (s.Asset_Model != null && s.Asset_Model != '') { if (s.pageObject.PricebookEntryId != null) { @@ -2757,7 +2785,89 @@ } return true; } - +//lastbuy 2022/2/15 fy start +public boolean ReservedProductVerification() { + filg=true; + Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>(); + List<Id> lastProductFLGListId = new List<Id>(); + List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>(); + List<QuoteLineItem> act = new List<QuoteLineItem>(); + List<QuoteLineItem> act2 = new List<QuoteLineItem>(); + for(QELine aaa :activities){ + if(aaa.pageObject.PricebookEntry.Product2Id!=null){ + act.add(aaa.pageObject); + } + } + act2=act.deepClone(); + Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>(); + System.debug('activities1111111111112涓烘墍褰撲负澶氬!!!'+activities); + integer i =0; + for(QuoteLineItem pspsc :act2){ + if(pspsc.PricebookEntry.Product2Id!=null){ + if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){ + QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id); + quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c; + map1.put(pspsc.PricebookEntry.Product2Id,quoteLine); + }else{ + map1.put(pspsc.PricebookEntry.Product2Id,pspsc); + } + // System.debug('34499879!!!'+activities); + } + } + System.debug('3434343!!!'+activities); + System.debug('5656565!!!'+map1); + for (QuoteLineItem value : map1.values()) { + if(value.PricebookEntry.Product2.LastbuyProductFLG__c){ + lastProductFLGListId.add(value.PricebookEntry.Product2Id); + quotlinitMap.put(value.PricebookEntry.Product2Id,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]; + Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); + System.debug('LastbuyObjList+++++!!!'+LastbuyObjList); + if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ + for(LastbuyProduct__c lastbuypr :LastbuyObjList){ + LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr); + } + }else{ + flglastbuy=1; + filg=false; + return filg; + } + System.debug('LastbuyObjMap!!!'+LastbuyObjMap); + System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList); + if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){ + for(QuoteLineItem lastbuypr :lastProductFLGList){ + Decimal quoteLItemNum=0; + if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){ + quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).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; + flglastbuy=2; + filg=false; + break; + } + }else{ + errorProductmodel=lastbuypr.Asset_Model_No__c; + flglastbuy=3; + filg=false; + break; + } + } + } + } + system.debug('filg====='+filg); + return filg; + } + //lastbuy 2022/2/15 fy end //opp銇敾闈€伄鍊ゃ倰瑷畾 private void setOppFromOppInfo() { opp.Wholesale_Price__c = oppInfo.Wholesale_Price; -- Gitblit v1.9.1