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/NewQuoteEntryControllerTest.cls | 224 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 214 insertions(+), 10 deletions(-) diff --git a/force-app/main/default/classes/NewQuoteEntryControllerTest.cls b/force-app/main/default/classes/NewQuoteEntryControllerTest.cls index 54c0591..3ac80b9 100644 --- a/force-app/main/default/classes/NewQuoteEntryControllerTest.cls +++ b/force-app/main/default/classes/NewQuoteEntryControllerTest.cls @@ -1151,7 +1151,7 @@ //System.Test.startTest(); //##銉氥兗銈搞儑銉愩儍銈般偦銈偡銉с兂銆�闁嬪 - PageReference page = new PageReference('/apex/NewQuoteEntry'); + PageReference page = new PageReference('/apex/NewQuoteEntry?copyid='+quote.Id); System.Test.setCurrentPage(page); Apexpages.currentPage().getParameters().put('oppid', opp.id); @@ -1301,6 +1301,7 @@ product1.Foreign_Trade_Cost_US_1__c = 200; product1.Foreign_Trade_Cost_US_Date1__c =date.today(); product1.Foreign_Trade_Cost_US_End_Date1__c=date.today().addDays(1); + product1.LastbuyProductFLG__c=true; insert product1; system.debug('##product.Id=[' + product1.Id + ']' ); @@ -1321,6 +1322,7 @@ product2.Foreign_Trade_Cost_US_1__c = 200; product2.Foreign_Trade_Cost_US_Date1__c =date.today(); product2.Foreign_Trade_Cost_US_End_Date1__c=date.today().addDays(1); + product2.LastbuyProductFLG__c=true; insert product2; system.debug('##product1.Id=[' + product1.Id + ']' ); system.debug('##product2.Id=[' + product2.Id + ']' ); @@ -1333,7 +1335,7 @@ pE.CurrencyIsoCode = 'USD'; //pE. insert pE; - + system.debug('##pE=[' + pE + ']' ); PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); pE2.UnitPrice = 0; @@ -1374,6 +1376,77 @@ quote.Agent1_Agent2_Price__c = 10; insert quote; + //棰勭暀浜у搧 + QuoteLineItem qa=new QuoteLineItem(); + qa.Name__c = '銉嗐偣銉堝晢鍝�'; + qa.QuoteId = quote.Id; + qa.Quantity = 3; + qa.Cost_Subtotal__c = 0; + qa.Cost__c = 200; + qa.UnitPrice = 10; + qa.PricebookEntryId = pE.Id; + qa.Id__c=pE.Product2Id; + // target.TotalPrice = 100; + + insert qa; + QuoteLineItem qb=new QuoteLineItem(); + qb.Name__c = '銉嗐偣銉堝晢鍝�'; + qb.QuoteId = quote.Id; + qb.Quantity = 3; + qb.Cost_Subtotal__c = 0; + qb.Cost__c = 200; + qb.UnitPrice = 10; + qb.PricebookEntryId = pE2.Id; + qb.Id__c=pE2.Product2Id; + + List<Id> QuoteLineItemList = new List<Id>(); + QuoteLineItemList.add(qa.Id); + QuoteLineItemList.add(qb.Id); + // List<QuoteLineItem> QuoteLineItemListss=[Select Id,Id__c, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__c, + // //CHAN-BKU3XH 妫�鏌ユ槸鍚﹀瓨鍦ㄤ笉鏄悓涓�涓緵閿�鍟嗗悕绉� 绮剧悽鎶�鏈� 2020/02/17 Start 澧炲姞瀛楁 涓嶅彲鍙栨秷澶氬勾淇�&&澧炲姞妫�绱㈤樋瑗胯禌澶� 2020/09/10 + // Name__c, BSS_Category__c, Quote.Quote_Print_Date__c,PricebookEntry.Product2.VenderName__c,PricebookEntry.Product2.CanNotCancelledGurantee__c,PricebookEntry.Product2.Is_DangerousChemicals__c, + // //CHAN-BKU3XH 妫�鏌ユ槸鍚﹀瓨鍦ㄤ笉鏄悓涓�涓緵閿�鍟嗗悕绉� 绮剧悽鎶�鏈� 2020/02/17 end 澧炲姞瀛楁 + // Qty_Unit__c, Cost__c, UnitPrice__c, ListPrice__c, Quantity, TotalPrice__c, + // PricebookEntry.Product2.SFDA_Status__c, ProductCode__c, Product_Cost__c, Product_ListPrice__c, PricebookEntry.Product2.Sales_Possibility__c, PricebookEntry.Product2.Name, + // PricebookEntryId, PricebookEntry.Product2Id, UnitPrice_Page__c, PricebookEntry.Product2.Packing_list_manual__c, PricebookEntry.Product2.StorageStatus__c + // , AgencyUnitPrice__c, AgencySubtotal__c, Present__c // CHAN-B4YAB8 2018/9/29 璧犻�併�佺粡閿�鍟嗗崟浠峰拰灏忚 + // // 澶氬勾淇濅慨 start + // //ET淇冮攢鏍囪 start + // , multiYearWarranty__c , If_Cancel_Guarantee__c , GuaranteePeriod__c, + // //ET淇冮攢鏍囪 end + // ServicePrice__c , GuranteePrice__c, ProductEntend_gurantee_period_all__c, + // ProductGuranteePrice__c, GuranteeType__c, + // warrantyType__c, productServicePrice__c, NoDiscountTotal__c + // , provistonPeriod__c + // , PricebookEntry.Product2.Entend_gurantee_period_all__c + // , PricebookEntry.Product2.Intra_Trade_Gurantee_RMB__c + // , PricebookEntry.Product2.Intra_Trade_Service_RMB__c + // , PricebookEntry.Product2.GuranteeType__c + // // 缁翠慨鍚堝悓鎶ヤ环 + // , PricebookEntry.Product2.Maintenance_Price_Year__c + // , Maintenance_Price_Year__c + // // 澶氬勾淇濅慨 end + // //澶栬锤澶氬勾淇� 2021/01/04 绮剧悽鎶�鏈� wql start + // //缁翠慨鍚堝悓鎶ヤ环锛圲SD锛� + // ,PricebookEntry.Product2.Repair_Contract_USD__c + // //璁℃彁閲戦锛堜笉鍚◣锛孶SD锛� + // ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c + // //NoDiscount 閲戦锛圲SD锛� + // ,PricebookEntry.Product2.NoDiscount_Foreign__c + // ,Quote.Opportunity.Trade__c + // //澶栬锤澶氬勾淇� 2021/01/04 绮剧悽鎶�鏈� wql end + + // //SFDC鍋滄棰勮 lt 20211009 start + // ,PricebookEntry.Product2.Estimated_ConsumptionDueDate__c + // //SFDC鍋滄棰勮 lt 20211009 end + // from QuoteLineItem where Id in :QuoteLineItemList]; + + LastbuyProduct__c lbp=new LastbuyProduct__c(); + lbp.effectiveFLG__c=true; + lbp.InquiryCode__c = opp.Id; + lbp.ProductName__c = product1.Id; + lbp.LastbuyQuantity__c=2; + insert lbp; // 銈汇儍銉堝搧 Product_Set__c ps1 = new Product_Set__c(); @@ -1438,6 +1511,7 @@ controller.quo.Quote_Expiration_Date__c = date.today(); controller.oppId = opp.id; // controller.PricebookId = pricebook.id; + NewQuoteEntryController.QELine act = new NewQuoteEntryController.QELine(oli, 0); act.Asset_Model = '11111'; @@ -1446,15 +1520,30 @@ act.pageObject.UnitPrice = 100; act.pageObject.Subtotal__c = 1000; act.pageObject.PricebookEntryId = pE2.id; + system.debug('##act.pageObject=[' + act.pageObject + ']' ); + Integer ge=0; List<NewQuoteEntryController.QELine> actList = new List<NewQuoteEntryController.QELine>(); actList.add(act); + // for(QuoteLineItem qqq : QuoteLineItemListss){ + // NewQuoteEntryController.QELine act2 = new NewQuoteEntryController.QELine(qqq, 0,''); + // if(ge== 0){ + // act2.Asset_Model = '11111'; + // }else if(ge== 1){ + // act2.Asset_Model = '22222'; + // } + // act2.pageObject=qqq; + // actList.add(act2); + // } controller.activities = actList; controller.dataCheck(); controller.quo.OCM_Agent1_Price_Page__c = 1243; controller.dataEntry(); controller.QuoteDecision(); controller.Print(); - + //鎶ラ敊 + // controller.ReservedProductVerification(); + // String[] azzz=new String[] {'1','2'}; + // System.debug(azzz[3]); actList = new List<NewQuoteEntryController.QELine>(); actList.add(act); controller.activities = actList; @@ -2401,7 +2490,7 @@ product2.Manual_Entry__c = false; product2.Asset_Model_No__c = '11112'; product2.MDM_Model_No__c = '11112'; -// product2.ProductCode = 'OTV-SP1H-NA-12E'; + // product2.ProductCode = 'OTV-SP1H-NA-12E'; insert product2; system.debug('##product1.Id=[' + product1.Id + ']' ); system.debug('##product2.Id=[' + product2.Id + ']' ); @@ -2427,7 +2516,7 @@ OpportunityLineItem oli = new OpportunityLineItem(); //target.QuoteId = input.Id; oli.Quantity = 1; -// target.TotalPrice = 100; + // target.TotalPrice = 100; oli.UnitPrice = 10; oli.PricebookEntryId = pE.Id; oli.OpportunityId = opp.id; @@ -2486,13 +2575,13 @@ controller.oppId = null; controller.quoId = null; controller.enableSales = false; -//System.Test.startTest(); + //System.Test.startTest(); controller.init(); controller.select_index = 0; controller.Product_text = product1.id; controller.setProduct_text = ps1.id; controller.setProductEntry(); -// controller.settingProduct2(); + // controller.settingProduct2(); controller.OppReflection(); controller.PriceStatusUpdate(); controller.SalesId1 = sellerA.id; @@ -2522,7 +2611,7 @@ controller.quo.Quote_Adjust_Amount__c = 10; controller.quo.Quote_Expiration_Date__c = date.today(); controller.oppId = opp.id; -// controller.PricebookId = pricebook.id; + // controller.PricebookId = pricebook.id; NewQuoteEntryController.QELine act = new NewQuoteEntryController.QELine(oli, 0); act.Asset_Model = '11111'; @@ -2549,7 +2638,7 @@ controller.excelImport(); Add_Report.getProduct2(product2.id); -// QELine(QELine tmp, Integer i) 闁㈡暟銈掋儐銈广儓 + // QELine(QELine tmp, Integer i) 闁㈡暟銈掋儐銈广儓 actList = new List<NewQuoteEntryController.QELine>(); //act.Asset_Model = null; //20211025 act.Asset_Model = '123'; //20211025 @@ -2560,7 +2649,7 @@ System.Test.stopTest(); Add_Report.getProduct2(product2.id); -// dataCheckDecide闁㈡暟銈掋儊銈с儍銈� + // dataCheckDecide闁㈡暟銈掋儊銈с儍銈� controller.enableSales = true; controller.QuoteDecision = true; controller.QuoteDecision(); @@ -2576,5 +2665,120 @@ } } //20211015 lt end + static testMethod void dataEntryTest2() { + RecordType recByoin = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_BYOUIN limit 1]; + Account hospital = new Account(Name = '銉嗐偣銉堢梾闄�'); + hospital.RecordTypeId = recByoin.id; + hospital.Site = '銉嗐偣銉堢梾闄㈤儴闁�'; + hospital.Alias_Name2__c = '銉嗐偣銉堢梾闄㈠垾鍚�'; + insert hospital; + RecordType recHanbaiten = [select id from RecordType where IsActive = true and SobjectType = 'Account' and Name = :RC_HANBAOITEN limit 1]; + Account sellerA = new Account(Name = '璨╁2搴�'); + sellerA.RecordTypeId = recHanbaiten.id; + sellerA.Hospital__c = hospital.id; + insert sellerA; + + Product2 product2 = new Product2( Name = '11112'); + product2.SFDA_Status__c = '涓嶈'; + product2.Intra_Trade_List_RMB_1__c = 100; + product2.Intra_Trade_List_RMB_Date1__c = date.today(); + product2.Intra_Trade_List_RMB_End_Date1__c = date.today().addDays(1); + product2.Intra_Trade_Cost_RMB_1__c = 200; + product2.Intra_Trade_Cost_RMB_Date1__c = date.today(); + product2.Intra_Trade_Cost_RMB_End_Date1__c = date.today().addDays(1); + product2.Manual_Entry__c = false; + product2.Asset_Model_No__c = '11112'; + product2.MDM_Model_No__c = '11112'; + insert product2; + + PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); + pE2.UnitPrice = 0; + pE2.IsActive = true; + pE2.UseStandardPrice = false; + pE2.CurrencyIsoCode = CurrencyIso; + insert pE2; + + Opportunity opp1 = buildOppInstance( trade, CurrencyIso); + opp1.Trade__c = trade; + opp1.owner_not_automatically_update__c = true; + opp1.Sales_Root__c = 'AAA'; + opp1.Pricebook2Id = pricebook.id; + opp1.Estimation_Decision__c=true; + insert opp1; + + OpportunityLineItem oli = new OpportunityLineItem(); + oli.Quantity = 1; + oli.UnitPrice = 10; + oli.PricebookEntryId = pE2.Id; + oli.OpportunityId = opp1.id; + oli.Cost__c = 100; + insert oli; + + NewQuoteEntryController.QELine act = new NewQuoteEntryController.QELine(oli, 0); + act.Asset_Model = ''; + act.pageObject.Quantity__c = 10; + act.pageObject.UnitPrice = 100; + act.pageObject.Subtotal__c = 1000; + act.pageObject.PricebookEntryId = pE2.id; + List<NewQuoteEntryController.QELine> actList = new List<NewQuoteEntryController.QELine>(); + actList.add(act); + + NewQuoteEntryController controller = new NewQuoteEntryController(); + controller.oppId=opp1.Id; + controller.enableSales=true; + Quote quote=new Quote(); + quote.QuoteName__c = '銉嗐偣銉堣绌�'; + quote.Dealer_Final_Price_Page__c = 100; + quote.Quote_Adjust_Amount_Page__c = 10; + quote.Quote_Expiration_Date__c = date.today(); + quote.Agency1__c = sellerA.id; + quote.OCM_Agent1_Price_Page__c = 1243; + quote.OpportunityId = opp1.id; + quote.Name ='銉嗐偣銉堣绌�'; + quote.Pricebook2Id = pricebook.id; + quote.Quote_No__c = quoteNo; + insert quote; + system.debug('act2++++++++++'+pE2); + + QuoteLineItem item02 = new QuoteLineItem(); + item02.Name__c = '銉嗐偣銉堝晢鍝�'; + item02.QuoteId = quote.Id; + item02.Quantity = 1; + item02.Cost_Subtotal__c = 0; + item02.Cost__c = 200; + item02.UnitPrice = 10; + item02.PricebookEntryId = pE2.Id; + insert item02; + + // quote.QuoteName__c = '銉嗐偣銉堣绌�'; + // quote.QuoteName__c = '銉嗐偣銉堣绌�'; + controller.quo=quote; + NewQuoteEntryController.QuoteBean qbs=new NewQuoteEntryController.QuoteBean(); + qbs.Quote_Adjust_Calculate = 100; + controller.qb = qbs; + controller.activities=actList; + controller.opp=opp1; + controller.dataEntry(); + + NewQuoteEntryController.QELine act2 = new NewQuoteEntryController.QELine(oli, 0); + act2.Asset_Model = '111111'; + act2.pageObject.Quantity__c = 1; + act2.pageObject.UnitPrice_Page__c = 100; + act2.pageObject.AgencyUnitPrice__c = 100; + act2.pageObject.PricebookEntryId = pE2.id; + List<NewQuoteEntryController.QELine> actList2 = new List<NewQuoteEntryController.QELine>(); + actList2.add(act2); + system.debug('act2++++++++++'+act2); + controller.activities=actList2; + controller.standardPricebook = pricebook; + for(NewQuoteEntryController.QELine aaa :controller.activities){ + aaa.Asset_Model = '111111'; + } + system.debug('activities++++++++++'+controller.activities); + NewQuoteEntryController.oppInfo opps = new NewQuoteEntryController.oppInfo(opp1); + + controller.oppInfo = opps; + controller.dataEntry(); + } } \ No newline at end of file -- Gitblit v1.9.1