| | |
| | | |
| | | //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); |
| | |
| | | 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 + ']' ); |
| | | |
| | |
| | | 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 + ']' ); |
| | |
| | | pE.CurrencyIsoCode = 'USD'; |
| | | //pE. |
| | | insert pE; |
| | | |
| | | system.debug('##pE=[' + pE + ']' ); |
| | | PricebookEntry pE2 = new PricebookEntry( Pricebook2Id = pricebook.Id, Product2Id = product2.Id); |
| | | |
| | | pE2.UnitPrice = 0; |
| | |
| | | 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 |
| | | // //维修合同报价(USD) |
| | | // ,PricebookEntry.Product2.Repair_Contract_USD__c |
| | | // //计提金额(不含税,USD) |
| | | // ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | // //NoDiscount 金额(USD) |
| | | // ,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(); |
| | |
| | | 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'; |
| | |
| | | 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; |
| | |
| | | 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 + ']' ); |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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'; |
| | |
| | | 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 |
| | |
| | | System.Test.stopTest(); |
| | | Add_Report.getProduct2(product2.id); |
| | | |
| | | // dataCheckDecide関数をチェック |
| | | // dataCheckDecide関数をチェック |
| | | controller.enableSales = true; |
| | | controller.QuoteDecision = true; |
| | | controller.QuoteDecision(); |
| | |
| | | } |
| | | } |
| | | //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 = '販売店'); |
| | | 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(); |
| | | } |
| | | } |