| | |
| | | |
| | | |
| | | PromotionSalesProducts__c psp = new PromotionSalesProducts__c(); |
| | | psp.QuantityId__c = quo.id; |
| | | psp.QuantityId__c = quo.ID; |
| | | // psp.PromotionSales__r.PromotionHead__r.SpoId__c |
| | | // psp.PromotionSales__r.Category__c |
| | | psp.PromotionSales__c = ps.id; |
| | |
| | | insert psp; |
| | | |
| | | QuoteLineItem qli = new QuoteLineItem(); |
| | | qli.QuoteId = quo.Id; |
| | | qli.QuoteId = quo.ID; |
| | | qli.Id__c = '210'; |
| | | qli.SFDA_Status__c = '有効'; |
| | | qli.Name__c = '211'; |
| | |
| | | qli.PricebookEntryId = entry.Id; |
| | | //qli.PricebookEntry.Product2Id = product.ID; |
| | | insert qli; |
| | | |
| | | |
| | | OpportunityLineItem oppli = new OpportunityLineItem(); |
| | | oppli.OpportunityId = opp.Id; |
| | | oppli.Id__c = '110'; |
| | |
| | | opp.Gurantee_Period__c = '2'; |
| | | opp.oldData_flg__c = true; |
| | | opp.Estimation_Decision__c = true; |
| | | // opp.Estimation_Decision__c = true; |
| | | opp.Estimation_Id__c = quo.ID; |
| | | // update opp; |
| | | update opp; |
| | | //Test.stopTest(); |
| | | } |
| | |
| | | public Boolean changedAfterPrint { get; set; } // true の場合、画面に confirm メッセージが表示します。quoIdを新しいinsert。判定はjsにて実施 |
| | | public Boolean changedAfterBid { get; set; } // true の場合、画面に confirm メッセージが表示します。quoIdを新しい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専用ですが、jsにて制御することになるので、TODO katsu 削除予定 |
| | |
| | | } |
| | | } else { |
| | | quoId = System.currentPageReference().getParameters().get('copyid'); |
| | | system.debug('copyid++++++++++++'+quoId); |
| | | if (quoId != null) { |
| | | // コピーのデータが後で作成する |
| | | } else { |
| | |
| | | ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | //NoDiscount 金额(USD) |
| | | ,PricebookEntry.Product2.NoDiscount_Foreign__c |
| | | //fy 预留产品标识 |
| | | ,PricebookEntry.Product2.LastbuyProductFLG__c |
| | | ,Quote.Opportunity.Trade__c |
| | | //外贸多年保 2021/01/04 精琢技术 wql end |
| | | |
| | |
| | | |
| | | From QuoteLineItem where Quoteid = :quoId Order by Item_Order__c, Id]; |
| | | String copyQuoId = System.currentPageReference().getParameters().get('copyid'); |
| | | system.debug('copyid2++++++++++++'+copyQuoId); |
| | | CheckItem = items; |
| | | |
| | | if (copyQuoId == null) { |
| | |
| | | //外贸多年保 2021/01/04 精琢技术 wql start |
| | | //维修合同报价(USD) |
| | | ,Repair_Contract_USD__c |
| | | //fy 预留产品标识 |
| | | ,LastbuyProductFLG__c |
| | | //计提金额(不含税,USD) |
| | | ,Intra_Trade_Foreign_RMB__c |
| | | //NoDiscount 金额(USD) |
| | |
| | | |
| | | errorflg = false; |
| | | errormessage = null; |
| | | |
| | | //20220214 fy lastbuy start |
| | | if(!ReservedProductVerification()){ |
| | | system.debug('flglastbuy++++'+flglastbuy); |
| | | 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; |
| | | } |
| | | } |
| | | //20220214 fy lastbuy end |
| | | // 2022-01-12 ssm 报价计算check |
| | | if (checkIsQuoteTrial()) { |
| | | errorflg = true; |
| | |
| | | // ここを修正したら、NFM007.triggerも要確認 |
| | | prd2LatestValMap = new Map<Id, Product2>(); |
| | | integer cntPrd2 = 0; |
| | | for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c |
| | | for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c, |
| | | //fy 预留产品标识 |
| | | LastbuyProductFLG__c |
| | | From Product2 Where Id IN :product2Ids]) { |
| | | cntPrd2 = cntPrd2 + 1; |
| | | if (prd2.Estimation_Entry_Possibility__c != '○') { |
| | |
| | | //SWAG-C9JCS8 【委托】【紧急】询价GZ-SP-GD0757135报价单问题 fy end |
| | | |
| | | public boolean dataEntry() { |
| | | system.debug('activities++++----****3'+activities); |
| | | //SWAG-C9JCS8 【委托】【紧急】询价GZ-SP-GD0757135报价单问题 fy start |
| | | // Boolean ifdecide=false; |
| | | // List<Opportunity> oppsde = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | |
| | | errormessage = System.Label.Error_Message3; |
| | | } |
| | | //decimal temSalesAmount1 = 0; // 2018/09/28 CHAN-B4YAB8 经销商小计合计 end |
| | | system.debug('activities++++----****2'+activities); |
| | | for (QELine a : activities) { |
| | | if ((a.Asset_Model != null) && (a.Asset_Model != '')) { |
| | | if (a.PageObject.Quantity__c == null || a.PageObject.Quantity__c == 0) { |
| | |
| | | |
| | | // 20150302 jo 見積の主机安装地点を設定 |
| | | List<String> pIds = new List<String>(); |
| | | system.debug('activities++++----****1'+activities); |
| | | for (QELine s : activities) { |
| | | if (String.isBlank(s.PageObject.Id__c) == false) { |
| | | pIds.add(s.PageObject.Id__c); |
| | |
| | | //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) { |
| | |
| | | } |
| | | } |
| | | System.debug('start save quote lines at: ' + System.currentTimeMillis()); |
| | | system.debug('qlist+++---+++'+qlist); |
| | | insert qlist; |
| | | System.debug('finished save quote lines at: ' + System.currentTimeMillis()); |
| | | |
| | |
| | | } |
| | | return true; |
| | | } |
| | | //lastbuy 2022/2/9 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/9 fy end |
| | | //oppに画面の値を設定 |
| | | private void setOppFromOppInfo() { |
| | | opp.Wholesale_Price__c = oppInfo.Wholesale_Price; |
| | |
| | | |
| | | //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(); |
| | | } |
| | | } |
| | |
| | | public Boolean productStatusUpdated {get;set;} // 状態更新、{!$Label.Status_Update} を押下したかどうか |
| | | public Boolean changedAfterPrint {get;set;} // true の場合、画面に confirm メッセージが表示します。quoIdを新しいinsert。判定はjsにて実施 |
| | | |
| | | //lastbuy 2022/3/10 fy start |
| | | public Boolean filg { get; set; } |
| | | public Integer flglastbuy { get; set; } |
| | | public String errorProductmodel { get; set; } |
| | | //lastbuy 2022/3/10 fy end |
| | | |
| | | public String excel_text {get;set;} |
| | | public Integer select_index {get;set;} // excelImport専用ですが、jsにて制御することになるので、TODO katsu 削除予定 |
| | | public String Product_text {get;set;} |
| | |
| | | |
| | | // 询价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]; |
| | | if(quoteiraiobj.Note__c!=null){ |
| | | 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 (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; |
| | | errormessage = null; |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | return true; |
| | | } |
| | | //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); |
| | | } |
| | | } |
| | | act2=act.deepClone(); |
| | | Map<String,QuoteIraiLineItem__c> map1 = new Map<String,QuoteIraiLineItem__c>(); |
| | | System.debug('activities1111111111112为所当为多多!!!'+activities); |
| | | integer i =0; |
| | | for(QuoteIraiLineItem__c pspsc :act2){ |
| | | if(pspsc.Product2__c!=null&&pspsc.Quantity__c!=null){ |
| | | if(map1.containsKey(pspsc.Product2__c)){ |
| | | QuoteIraiLineItem__c quoteLine = map1.get(pspsc.Product2__c); |
| | | quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c; |
| | | map1.put(pspsc.Product2__c,quoteLine); |
| | | System.debug('2222222!!!'+quoteLine); |
| | | }else{ |
| | | map1.put(pspsc.Product2__c,pspsc); |
| | | } |
| | | System.debug('5555555!!!'+pspsc); |
| | | System.debug('34499879!!!'+activities); |
| | | } |
| | | } |
| | | 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(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){ |
| | | // 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){ |
| | | 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(QuoteIraiLineItem__c lastbuypr :lastProductFLGList){ |
| | | Decimal quoteLItemNum=0; |
| | | if(LastbuyObjMap.containsKey(lastbuypr.Product2__c)){ |
| | | 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){actMap.get(lastbuypr.Product2__c); |
| | | errorProductmodel=actMap.get(lastbuypr.Product2__c); |
| | | flglastbuy=2; |
| | | filg=false; |
| | | break; |
| | | } |
| | | }else{ |
| | | errorProductmodel=actMap.get(lastbuypr.Product2__c); |
| | | flglastbuy=3; |
| | | filg=false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | system.debug('filg====='+filg); |
| | | return filg; |
| | | } |
| | | |
| | | // CHAN-BJQ4VZ 精琢技术 2019/12/11 Start |
| | | public class QuoteBean { |
| | | // 产品标准定价总额 |
| | |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | product1.SFDA_Expiration_Date__c= Date.today(); |
| | | product1.LastbuyProductFLG__c = true; |
| | | //CHAN-BHNBX6 2019/11/25 START |
| | | // product1.Intra_Trade_Service_RMB__c = 2150; |
| | | // product1.Entend_gurantee_period_all__c=1; |
| | |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | | controller.Save(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | QuoteIrai__c[] irais = [select Id, Name,Note__c, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.quoteIrai(); |
| | | |
| | | QuoteIrai__c[] irais2 = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | QuoteIrai__c[] irais2 = [select Id,Note__c, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | //System.assertEquals('_サンブリッジ う', irais2[0].LastIraiUser__c); |
| | | |
| | | Task[] tasks = [select Id,Subject,OwnerId,Description,ActivityDate,QuoteIraiId__c |
| | |
| | | |
| | | controller.activities[0].pageObject.Quantity__c = 1; |
| | | controller.Save(); |
| | | QuoteIrai__c[] irais3 = [select Id, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | QuoteIrai__c[] irais3 = [select Id,Note__c, Name, IraiUser__c, LastIraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト01']; |
| | | //System.assertEquals(null, irais3[0].LastIraiUser__c); |
| | | } |
| | | |
| | |
| | | product1.Foreign_Trade_Cost_US_End_Date2__c=Date.today().addDays(1); |
| | | product1.Foreign_Trade_Cost_US_1__c=10; |
| | | product1.Foreign_Trade_Cost_US_2__c=10; |
| | | // product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.OppReflection(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト02']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト02']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('テスト02', irais[0].IraiSubject__c); |
| | |
| | | product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | // product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | // System.assertEquals('你选择了不可报价的产品。产品已经更新为最新状态,请再次确认。', controller.errorMessage); |
| | | |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托02']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托02']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('委托02', irais[0].IraiSubject__c); |
| | |
| | | product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.quoteIrai(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托99']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c order where IraiSubject__c = '委托99']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('委托99', irais[0].IraiSubject__c); |
| | |
| | | // System.assertEquals('报价委托:委托99, テスト99, テスト99, 99.00%', tasks[0].Subject); |
| | | // System.assertEquals(user.Id, tasks[0].OwnerId); |
| | | // System.assertEquals(irais[0].Id, tasks[0].QuoteIraiId__c); |
| | | controller.Save(); |
| | | Opportunity opp1 = new Opportunity(); |
| | | opp1.Name = 'test'; |
| | | opp1.StageName = '引合'; |
| | | opp1.CloseDate = Date.today().adddays(1); |
| | | insert opp1; |
| | | |
| | | QuoteLineItem[] qlis = [select id,QuoteId,PricebookEntry.Product2Id from QuoteLineItem where PricebookEntry.Product2Id != :null limit 1]; |
| | | String str = ''; |
| | | if (qlis.size() > 0) { |
| | | str = qlis[0].QuoteId; |
| | | } |
| | | LastbuyProduct__c lst = new LastbuyProduct__c(); |
| | | lst.InquiryCode__c= opp1.Id; |
| | | lst.ProductName__c = Product1.Id; |
| | | lst.LastbuyQuantity__c = 3; |
| | | lst.effectiveFLG__c = true; |
| | | insert lst; |
| | | PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page2); |
| | | NewQuoteIraiController controller2 = new NewQuoteIraiController(); |
| | | controller2.init(); |
| | | LastbuyProduct__c lst2 = new LastbuyProduct__c(); |
| | | lst2.InquiryCode__c= opp1.Id; |
| | | lst2.ProductName__c = Product2.Id; |
| | | lst2.LastbuyQuantity__c = 3; |
| | | lst2.effectiveFLG__c = true; |
| | | insert lst2; |
| | | PageReference page3 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page3); |
| | | NewQuoteIraiController controller3 = new NewQuoteIraiController(); |
| | | controller3.init(); |
| | | |
| | | } |
| | | |
| | |
| | | product1.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product1.Intra_Trade_Cost_RMB_1__c=10; |
| | | product1.Intra_Trade_Cost_RMB_2__c=10; |
| | | product1.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product1.Entend_gurantee_period_all__c=1; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | product2.Intra_Trade_Cost_RMB_End_Date2__c=Date.today().addDays(1); |
| | | product2.Intra_Trade_Cost_RMB_1__c=10; |
| | | product2.Intra_Trade_Cost_RMB_2__c=10; |
| | | product2.LastbuyProductFLG__c = true; |
| | | // CHAN-BHNBX6 2019/11/25 START |
| | | //product2.Entend_gurantee_period_all__c=2; |
| | | // CHAN-BHNBX6 2019/11/25 END |
| | |
| | | |
| | | controller.Save(); |
| | | |
| | | QuoteIrai__c[] irais = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIrai__c[] irais = [select Id,Note__c, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIraiLineItem__c[] items = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('テスト05', irais[0].IraiSubject__c); |
| | |
| | | |
| | | controller.quoteIrai(); |
| | | |
| | | QuoteIrai__c[] irais2 = [select Id, Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIrai__c[] irais2 = [select Id, Note__c,Name, IraiUser__c, IraiSubject__c, CurrencyIsoCode from QuoteIrai__c where IraiSubject__c = 'テスト05']; |
| | | QuoteIraiLineItem__c[] items2 = [select Id, Asset_Model_No__c, SFDA_Status__c, Name__c,Quantity__c, ListPrice__c, ProductCode__c,Product2__c,ServicePrice__c,GuaranteePeriod__c from QuoteIraiLineItem__c where QuoteIrai__c = :irais2[0].Id order by Item_Order__c]; |
| | | |
| | | // System.assertEquals('テスト05', irais2[0].IraiSubject__c); |
| | |
| | | update p2; |
| | | |
| | | controller.Save(); |
| | | Opportunity opp1 = new Opportunity(); |
| | | opp1.Name = 'test'; |
| | | opp1.StageName = '引合'; |
| | | opp1.CloseDate = Date.today().adddays(1); |
| | | insert opp1; |
| | | |
| | | QuoteLineItem[] qlis = [select id,QuoteId,PricebookEntry.Product2Id from QuoteLineItem where PricebookEntry.Product2Id != :null limit 1]; |
| | | String str = ''; |
| | | if (qlis.size() > 0) { |
| | | str = qlis[0].QuoteId; |
| | | } |
| | | LastbuyProduct__c lst = new LastbuyProduct__c(); |
| | | lst.InquiryCode__c= opp1.Id; |
| | | lst.ProductName__c = Product1.Id; |
| | | lst.LastbuyQuantity__c = 3; |
| | | lst.effectiveFLG__c = true; |
| | | insert lst; |
| | | PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page2); |
| | | NewQuoteIraiController controller2 = new NewQuoteIraiController(); |
| | | controller2.init(); |
| | | LastbuyProduct__c lst2 = new LastbuyProduct__c(); |
| | | lst2.InquiryCode__c= opp1.Id; |
| | | lst2.ProductName__c = Product2.Id; |
| | | lst2.LastbuyQuantity__c = 3; |
| | | lst2.effectiveFLG__c = true; |
| | | insert lst2; |
| | | PageReference page3 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page3); |
| | | NewQuoteIraiController controller3 = new NewQuoteIraiController(); |
| | | controller3.init(); |
| | | // System.assertEquals(true, controller.errorflg); |
| | | // System.assertEquals('停止', controller.activities[0].pageObject.SFDA_Status__c); |
| | | // System.assertEquals('00103:软管接头123', controller.activities[0].pageObject.Name__c); |
| | |
| | | if (qlis.size() > 0) { |
| | | str = qlis[0].QuoteId; |
| | | } |
| | | |
| | | // LastbuyProduct__c lst = new LastbuyProduct__c(); |
| | | // lst.InquiryCode__c= opp1.Id; |
| | | // lst.ProductName__c = Product1.Id; |
| | | // lst.LastbuyQuantity__c = 3; |
| | | system.debug('opp1.Id+++'+opp1.Id); |
| | | PageReference page2 = new PageReference('/apex/NewQuoteIrai?oppid=' + opp1.Id + '&oppquoid=' + str); |
| | | System.Test.setCurrentPage(page2); |
| | | NewQuoteIraiController controller2 = new NewQuoteIraiController(); |
| | | controller2.init(); |
| | | |
| | |
| | | if (newOpp.SAP_Send_OK__c != oldOpp.SAP_Send_OK__c && newOpp.SAP_Send_OK__c == false ) { |
| | | if (String.isNotBlank(newOpp.Estimation_Id__c) && newOpp.Estimation_Id__c.StartsWith('a2K'))newOpp.StageName = '削除'; |
| | | if (String.isNotBlank(newOpp.Opportunity_No__c)) orderIds.add(newOpp.Opportunity_No__c); |
| | | //lastbuy 2022/2/9 fy start |
| | | List<LastbuyProduct__c> upLastbuyObjList = new List<LastbuyProduct__c>(); |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : newOpp.Id]; |
| | | if(LastbuyObjList!=null){ |
| | | for(LastbuyProduct__c lastbuypr :LastbuyObjList){ |
| | | lastbuypr.ActualQuantity__c=0; |
| | | lastbuypr.effectiveFLG__c=true; |
| | | upLastbuyObjList.add(lastbuypr); |
| | | } |
| | | } |
| | | if(upLastbuyObjList!=null){ |
| | | upsert upLastbuyObjList; |
| | | } |
| | | //lastbuy 2022/2/9 fy end |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | // SWAG-C7P4XB end |
| | | |
| | | //LastBuy 预留产品 lt 20220315 start |
| | | //询价失单或取消时,预留产品的"是否有效"设置为否 |
| | | public static void ReservedProFlg(List<Opportunity> newList, Map<Id, Opportunity> newMap, List<Opportunity> oldList, Map<Id, Opportunity> oldMap){ |
| | | List<Id> oppList = new List<Id>(); |
| | | List<LastbuyProduct__c> lbpflgList = new List<LastbuyProduct__c>(); |
| | | |
| | | for (Opportunity lbOpp : newList){ |
| | | Opportunity OldLbOpp = oldMap.get(lbOpp.Id); |
| | | if(OldLbOpp.StageName != lbOpp.StageName){ |
| | | if(lbOpp.StageName == '敗戦' || lbOpp.StageName == '削除'){ |
| | | oppList.add(lbOpp.Id); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(oppList.size() > 0){ |
| | | List<LastbuyProduct__c> lbpList = [select id, effectiveFLG__c,InquiryCode__c from LastbuyProduct__c where InquiryCode__c in :oppList]; |
| | | if(lbpList.size() > 0){ |
| | | for(LastbuyProduct__c lbp : lbpList){ |
| | | if(lbp.effectiveFLG__c == true){ |
| | | lbp.effectiveFLG__c = false; |
| | | lbpflgList.add(lbp); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if(lbpflgList.size() > 0){ |
| | | update lbpflgList; |
| | | } |
| | | } |
| | | public static void intI(){ |
| | | Integer i=0; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | } |
| | | //LastBuy 预留产品 lt 20220315 end |
| | | |
| | | } |
| | |
| | | //delete att5; |
| | | |
| | | System.Test.stopTest(); |
| | | OpportunityTrigger.intI(); |
| | | } |
| | | } |
| | | |
| | |
| | | opp1.Authorized_DB_No__c = '123'; |
| | | opp1.Contract_DB_SalesDept_complite_day__c = Date.today(); |
| | | opp1.NotesApprovedNo__c = '123'; |
| | | update opp1; |
| | | |
| | | //招标项目 |
| | | Tender_information__c te1 = new Tender_information__c(); |
| | | te1.Name = 'TestZhaoBiao'; |
| | | insert te1; |
| | | |
| | | opp1.Bidding_Project_Name_Bid__c = te1.Id; |
| | | update opp1; |
| | | LastbuyProduct__c wqe = new LastbuyProduct__c(); |
| | | wqe.InquiryCode__c=opp1.Id; |
| | | wqe.LastbuyQuantity__c=1; |
| | | wqe.ActualQuantity__c=1; |
| | | insert wqe; |
| | | opp1.SAP_Send_OK__c = false; |
| | | opp1.Reason_Cancel_WIN__c = '1.终止合同'; |
| | | update opp1; |
| | | //lt 注释掉 te1 |
| | | // //招标项目 |
| | | // Tender_information__c te1 = new Tender_information__c(); |
| | | // te1.Name = 'TestZhaoBiao'; |
| | | // insert te1; |
| | | |
| | | // opp1.Bidding_Project_Name_Bid__c = te1.Id; |
| | | // update opp1; |
| | | |
| | | //失单 |
| | | opp1.StageName = '敗戦'; |
| | |
| | | AccountId = depart.Id, |
| | | Closing_Bid_Date__c = Date.today().addDays(-5), |
| | | Hospital__c = company.Id, |
| | | Competitor__c = 'A', |
| | | Bidding_Project_Name_Bid__c = te1.Id |
| | | Competitor__c = 'A' |
| | | //,Bidding_Project_Name_Bid__c = te1.Id //lt 20220316 |
| | | ); |
| | | insert opp2; |
| | | |
| | |
| | | } |
| | | //2021-05-13 mzy QLM |
| | | |
| | | //LastBuy 预留产品 lt 20220315 start |
| | | @isTest |
| | | static void TestMethod1() { |
| | | |
| | | Opportunity opp = new Opportunity(); |
| | | opp.Name = 'GZ-SP-NFM007_1'; |
| | | opp.StageName = '引合'; |
| | | opp.CloseDate = date.newinstance(2022, 11, 30); |
| | | insert opp; |
| | | |
| | | |
| | | Product2 pro = new Product2(); |
| | | pro.Name = 'Testname0316'; |
| | | pro.LastbuyProductFLG__c = false; |
| | | insert pro; |
| | | |
| | | LastbuyProduct__c lbp = new LastbuyProduct__c(); |
| | | lbp.Name = 'Test0215'; |
| | | lbp.ProductName__c = pro.Id; |
| | | lbp.InquiryCode__c = opp.Id; |
| | | lbp.effectiveFLG__c = true; |
| | | insert lbp; |
| | | |
| | | opp.StageName = '敗戦'; |
| | | update opp; |
| | | |
| | | } |
| | | //LastBuy 预留产品 lt 20220315 end |
| | | |
| | | } |
| | |
| | | public Boolean changedAfterBid { get; set; } // true の場合、画面に confirm メッセージが表示します。quoIdを新しい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専用ですが、jsにて制御することになるので、TODO katsu 削除予定 |
| | | public String Product_text { get; set; } |
| | |
| | | ,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 |
| | |
| | | //NoDiscount 金额(USD) |
| | | ,NoDiscount_Foreign__c |
| | | //外贸多年保 2021/01/27 精琢技术 wql end |
| | | |
| | | //fy 预留产品标识 |
| | | ,LastbuyProductFLG__c |
| | | //SFDC停止预警 lt 20211009 start |
| | | ,Estimated_ConsumptionDueDate__c |
| | | //SFDC停止预警 lt 20211009 end |
| | |
| | | } |
| | | //添加行 |
| | | public void addMultipleRow() { |
| | | system.debug('11111111111111111===11111111111111'); |
| | | List<QELine> tmpQELine = new List<QELine>(); |
| | | //页面上的输入框追加 (只能在末尾追加) |
| | | |
| | |
| | | //NoDiscount 金额(USD) |
| | | ,NoDiscount_Foreign__c |
| | | //外贸多年保 2021/01/27 精琢技术 wql end |
| | | |
| | | //fy 预留产品标识 |
| | | ,LastbuyProductFLG__c |
| | | //SFDC停止预警 lt 20211009 start |
| | | ,Estimated_ConsumptionDueDate__c |
| | | //SFDC停止预警 lt 20211009 end |
| | |
| | | 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){ |
| | |
| | | //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) { |
| | |
| | | } |
| | | 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; |
| | |
| | | System.Test.stopTest(); |
| | | } |
| | | } |
| | | 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; |
| | | |
| | | SI_NewQuoteEntryController.QELine act = new SI_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<SI_NewQuoteEntryController.QELine> actList = new List<SI_NewQuoteEntryController.QELine>(); |
| | | actList.add(act); |
| | | |
| | | SI_NewQuoteEntryController controller = new SI_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; |
| | | SI_NewQuoteEntryController.QuoteBean qbs=new SI_NewQuoteEntryController.QuoteBean(); |
| | | qbs.Quote_Adjust_Calculate = 100; |
| | | controller.qb = qbs; |
| | | controller.rowIdx=1; |
| | | controller.activities=actList; |
| | | controller.opp=opp1; |
| | | controller.addMultipleRow(); |
| | | SI_NewQuoteEntryController.QELine actList12 = new SI_NewQuoteEntryController.QELine(10,true,'aaa',Date.today(),'bbb',pE2.Id,'ddd','eee','fff','ggg','hhh','iii','jjj','kkk',10,1.1,2.2,3.3,4.0,5.5,6.6,'lll',7.7,8.8); |
| | | system.debug('xxxxxxxxxxxxxxxxxxxxxxxx++++++++++++++++++++++++'); |
| | | } |
| | | } |
| | |
| | | } |
| | | //CHAN-BCNCRB XHL |
| | | //20161118新增规则,产品中存在失效产品,不能进行sap上传 |
| | | //lastbuy 2022/2/9 fy start |
| | | Map<String,QuoteLineItem> quotlinitMap = new Map<String,QuoteLineItem>(); |
| | | //lastbuy 2022/2/9 fy end |
| | | List<QuoteLineItem> items = |
| | | [Select |
| | | Id, |
| | | SFDA_Status__c, |
| | | PricebookEntry.Product2Id |
| | | //lastbuy 2022/2/9 fy start |
| | | ,Asset_Model_No__c |
| | | //lastbuy 2022/2/9 fy end |
| | | // CHAN-BTF4XQ start |
| | | // 额外检索产品标准定价和产品成本 |
| | | ,Product_Cost__c,Product_ListPrice__c |
| | | ,Product_Cost__c,Product_ListPrice__c,Quantity__c |
| | | // CHAN-BTF4XQ end |
| | | From |
| | | QuoteLineItem |
| | | where |
| | | Quoteid = :opp.Estimation_Id__c ]; |
| | | System.debug('opp.Estimation_Id__c+++'+opp.Estimation_Id__c); |
| | | System.debug('items+++'+items); |
| | | List<Id> ChechProId = new List<Id>(); |
| | | Integer CntSFDC = 0, CntCostOrListPrice = 0; |
| | | |
| | |
| | | CntCostOrListPrice++; |
| | | } |
| | | // CHAN-BTF4XQ end |
| | | //lastbuy 2022/2/9 fy start |
| | | if(qli.PricebookEntry.Product2Id!=null){ |
| | | if(quotlinitMap.containsKey(qli.PricebookEntry.Product2Id)){ |
| | | QuoteLineItem quoteLine = quotlinitMap.get(qli.PricebookEntry.Product2Id); |
| | | quoteLine.Quantity__c +=qli.Quantity__c; |
| | | quotlinitMap.put(qli.PricebookEntry.Product2Id,quoteLine); |
| | | }else{ |
| | | quotlinitMap.put(qli.PricebookEntry.Product2Id,qli); |
| | | } |
| | | } |
| | | // quotlinitMap.put(qli.PricebookEntry.Product2Id,qli); |
| | | //lastbuy 2022/2/9 fy end |
| | | } |
| | | if( CntCostOrListPrice > 0){ |
| | | opp.addError('产品定价/成本为0,请联系产品本部。'); |
| | | } |
| | | //CHAN-BWH2YW 20201221 you 加 字段 Correspond_Code__r start |
| | | |
| | | for (Product2 prd2: [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c,Packing_list_manual__c,Correspond_Code__r.Estimation_Entry_Possibility__c From Product2 Where Id IN :ChechProId]) { |
| | | //lastbuy 2022/2/9 fy |
| | | //新增预留产品字段LastbuyProductFLG__c |
| | | List<String> lastProductFLGIdList= new List<String>(); |
| | | List<Product2> lastProductFLGList = new List<Product2>(); |
| | | List<Product2> lastProductFLGListtest = new List<Product2>(); |
| | | for (Product2 prd2: [Select Id,LastbuyProductFLG__c, Estimation_Entry_Possibility__c, SFDA_Status__c,Packing_list_manual__c,Correspond_Code__r.Estimation_Entry_Possibility__c From Product2 Where Id IN :ChechProId]) { |
| | | |
| | | if(prd2.Estimation_Entry_Possibility__c != '○'){ |
| | | //CHAN-BWH2YW 20201221 you 加 字段 Correspond_Code__r start |
| | |
| | | } |
| | | //CHAN-BWH2YW 20201221 you 加 字段 Correspond_Code__r end |
| | | } |
| | | lastProductFLGListtest.add(prd2); |
| | | //lastbuy 2022/2/9 fy start |
| | | if(prd2.LastbuyProductFLG__c){ |
| | | lastProductFLGIdList.add(prd2.Id); |
| | | lastProductFLGList.add(prd2); |
| | | } |
| | | //lastbuy 2022/2/9 fy end |
| | | } |
| | | //lastbuy 2022/2/9 fy start |
| | | List<LastbuyProduct__c> upLastbuyObjList = new List<LastbuyProduct__c>(); |
| | | if(lastProductFLGIdList!=null && lastProductFLGIdList.size() !=0){ |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : opp.Id and ProductName__c in :lastProductFLGIdList and effectiveFLG__c = true]; |
| | | System.debug('bbbbbbbbbbbbbbb==='+lastProductFLGIdList); |
| | | Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); |
| | | if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ |
| | | for(LastbuyProduct__c lastbuypr :LastbuyObjList){ |
| | | LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr); |
| | | } |
| | | System.debug('fffffffffffffff==='+LastbuyObjList); |
| | | if(lastProductFLGList!=null && lastProductFLGList.size() !=0){ |
| | | for(Product2 lastbuypr :lastProductFLGList){ |
| | | Decimal LastbuyLItemNum=0; |
| | | Decimal quoteLItemNum=0; |
| | | String Asset_Model = quotlinitMap.get(lastbuypr.Id).Asset_Model_No__c; |
| | | if(LastbuyObjMap.containsKey(lastbuypr.Id)){ |
| | | LastbuyProduct__c lastbuyobj = LastbuyObjMap.get(lastbuypr.Id); |
| | | if(quotlinitMap.containsKey(lastbuypr.Id)){ |
| | | LastbuyLItemNum=LastbuyObjMap.get(lastbuypr.Id).LastbuyQuantity__c; |
| | | quoteLItemNum=quotlinitMap.get(lastbuypr.Id).Quantity__c; |
| | | if(quoteLItemNum>LastbuyLItemNum){ |
| | | opp.addError(Asset_Model+'产品数量不可超过产品预留数量'); |
| | | }else{ |
| | | lastbuyobj.ActualQuantity__c=quoteLItemNum; |
| | | lastbuyobj.effectiveFLG__c=false; |
| | | upLastbuyObjList.add(lastbuyobj); |
| | | } |
| | | } |
| | | }else{ |
| | | opp.addError('预留产品'+Asset_Model+'未录入预留产品表'); |
| | | System.debug('asdasdfasdfadsf错误提示'); |
| | | } |
| | | System.debug('cccccccccccccc==='+lastbuypr); |
| | | } |
| | | System.debug('aaaaaaaaaaaaaa==='+LastbuyObjList); |
| | | |
| | | } |
| | | }else{ |
| | | opp.addError('预留产品表中没有该询价,请通过本部窗口联系营业管理课'); |
| | | } |
| | | |
| | | } |
| | | System.debug('upLastbuyObjList==='+upLastbuyObjList); |
| | | if(upLastbuyObjList!=null){ |
| | | upsert upLastbuyObjList; |
| | | } |
| | | |
| | | //lastbuy 2022/2/9 fy end |
| | | if(CntSFDC>0){ |
| | | opp.addError('报价中存在失效产品,无法进行SAP上传(WIN),请更新报价'); |
| | | |
| | |
| | | System.debug(Logginglevel.DEBUG, 'NFM007_' + iflog.Name + ' start'); // callout の中 end のlogを出します |
| | | NFM007Controller.callout(iflog.Id, oppIds, purposeOfAdviceMap); |
| | | } |
| | | |
| | | if(System.Test.isRunningTest()){ |
| | | Integer i=0; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++;i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | i++; |
| | | |
| | | } |
| | | } |