| | |
| | | } |
| | | } else { |
| | | //添加行 |
| | | List<Quote> quoList = |
| | | [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c, |
| | | List<Quote> quoList =//SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | [ SELECT Id, Name, Cancel_Decide__c, CreatedDate, PriceRefreshDate__c, Quote_Print_Date__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | Dealer_Final_Price__c, TotalPrice__c, Estimation_List_Price__c, QuoteNumber, |
| | | QuoteToName, Quote_Expiration_Date__c, Quote_Comment__c, Stocking_Price__c, Unit_Price__c, |
| | | Offer_Amount__c, TOTAL__c, Discount__c, Pricing__c, Preferential_Trading_Price__c, Contract__c, |
| | |
| | | } |
| | | if (copyQuoId == null) { |
| | | quo = quoList[0]; |
| | | |
| | | quo.QuoteName__c = quo.Name; |
| | | // 多年保修 start |
| | | quoteGurantee_Period = quo.Gurantee_Period__c; |
| | |
| | | // CHAN-AVG3PW 询价报价画面规则变更 |
| | | Datetime cDate = quo.CreatedDate; |
| | | over3month = cDate != null && cDate.date().addMonths(3) < Date.today(); |
| | | |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | quo.Offer_Amount__c = true; |
| | | quo.TOTAL__c = true; |
| | | quo.Preferential_Gurantee_Period__c = true; |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | return null; |
| | | } |
| | | |
| | | |
| | | //Search Events============================================================ |
| | | // TODO ManualEntryと同様、jsにて解決できる、ここでwebserviceだけを実装、今後 by katsu |
| | |
| | | } |
| | | |
| | | } else { |
| | | List<Quote> qs = New List<Quote>(); |
| | | qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c, |
| | | List<Quote> qs = New List<Quote>();//SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | qs = [select Id, OpportunityId, CreatedDate, Pricebook2Id, Name, Estimation_List_Price__c, Dealer_Final_Price__c,QuotationChange__c,MainEngineWithoutMonitor__c,Interdepartmental__c, |
| | | Stocking_Price__c, Discount_Amount__c, Discount_Amount_Calculate__c, Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Quote_No__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, |
| | |
| | | q.Quote_Comment__c = quo.Quote_Comment__c; |
| | | |
| | | q.Installation_location__c = quo.Installation_location__c; |
| | | |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy start |
| | | q.QuotationChange__c = quo.QuotationChange__c; |
| | | q.MainEngineWithoutMonitor__c = quo.MainEngineWithoutMonitor__c; |
| | | q.Interdepartmental__c = quo.Interdepartmental__c; |
| | | //SWAG-CKDATG 【委托】【OBSAP-报价委托】报价委托项目改善1 fy end |
| | | /* |
| | | if (hasType3Machine) { |
| | | q.Installation_location__c = ''; |
| | | } |
| | | */ |
| | | System.debug('start save quote at: ' + System.currentTimeMillis()); |
| | | System.debug('q.QuotationChange__c+++'+q.QuotationChange__c); |
| | | System.debug('quo.QuotationChange__c++' + quo.QuotationChange__c); |
| | | System.debug('quo.MainEngineWithoutMonitor__c++' + quo.MainEngineWithoutMonitor__c); |
| | | if (quoId == null) { |
| | | insert q; |
| | | quo.Quote_No__c = q.Quote_No__c; |
| | | } else { |
| | | update q; |
| | | } |
| | | System.debug('q.QuotationChange__c2+++'+q.QuotationChange__c); |
| | | System.debug('quo.QuotationChange__c2++' + quo.QuotationChange__c); |
| | | System.debug('quo.MainEngineWithoutMonitor__c2++' + quo.MainEngineWithoutMonitor__c); |
| | | System.debug('finished save quote at: ' + System.currentTimeMillis()); |
| | | |
| | | system.debug('○○○○○Save1○○○○○'); |
| | |
| | | os = [select Id, Estimation_List_Price__c, Dealer_Final_Price__c, Estimation_List_Price_Without_Tax__c, |
| | | Agency1__c, OCM_Agent1_Price__c, Agency1_Profit__c, Agency1_Profit_Rate__c, Stocking_Price__c, |
| | | Agency2__c, Agent1_Agent2_Price__c, Agency2_Profit__c, Agency2_Profit_Rate__c, Quote_Update_Sum__c , Hospital__c,Is_Corrosion__c |
| | | // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | ,StageName ,OlyNumberHosts__c |
| | | // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 end |
| | | From Opportunity Where Id = :oppid]; |
| | | if (os.size() > 0) { |
| | | o = os[0]; |
| | |
| | | o.quoteSavedDate__c = Date.today(); |
| | | // 多年保修 end |
| | | |
| | | // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 start |
| | | System.debug('lt123询价状态(阶段): ' + o.StageName); |
| | | System.debug('lt123activities: ' + activities); |
| | | o.OlyNumberHosts__c = 0; |
| | | System.debug('lt123主机数: ' + o.OlyNumberHosts__c); |
| | | List<String> oppIds = New List<String>(); |
| | | List<String> product2Ids = New List<String>(); |
| | | Map<String,Decimal> product2IdsMap = new Map<String,Decimal>(); |
| | | if (activities.size() > 0) { |
| | | for (QELine a : activities) { |
| | | if (String.isBlank(a.PageObject.Id__c) == false) { |
| | | product2Ids.add(a.PageObject.Id__c); |
| | | product2IdsMap.put(a.PageObject.Id__c,a.PageObject.Quantity__c); |
| | | } |
| | | } |
| | | |
| | | for (Product2 prod : [Select Id,ProductClass__c |
| | | From Product2 Where Id IN :product2Ids]) { |
| | | System.debug('lt123产品市场类别: ' + prod.ProductClass__c); |
| | | |
| | | if(o.StageName == '引合' || o.StageName == '注残' || o.StageName == '出荷' || o.StageName == '完了'){ |
| | | if(prod.ProductClass__c == '主机'){ |
| | | if(product2IdsMap.containsKey(prod.Id)){ |
| | | o.OlyNumberHosts__c += product2IdsMap.get(prod.Id); |
| | | oppIds.add(o.Id); |
| | | ControllerUtil.UpdateBiddingFlag(oppIds); |
| | | } |
| | | }else{ |
| | | o.OlyNumberHosts__c += 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 end |
| | | |
| | | if (o.Quote_Update_Sum__c == null) { |
| | | o.Quote_Update_Sum__c = 1; |
| | |
| | | //価格、単位、小計、OCM売上予測金額(税抜)、価格表 |
| | | List<OpportunityLineItem> ols = New List<OpportunityLineItem>(); |
| | | OpportunityLineItem ol = New OpportunityLineItem(); |
| | | ols = [select Id from OpportunityLineItem Where OpportunityId = :oppid]; |
| | | // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 end |
| | | ols = [select Id, Quantity from OpportunityLineItem Where OpportunityId = :oppid]; //update |
| | | System.debug('lt123询价产品: ' + ols); |
| | | // lt 20221008 SWAG-CHL5XA【FY23询价改善】-统计主机台数 end |
| | | if (ols.size() > 0) { |
| | | //delete |
| | | ControllerUtil.delOppLine(ols); |
| | |
| | | if (s.Asset_Model != null && s.Asset_Model != '') { |
| | | if (s.PageObject.PricebookEntryId != null) { |
| | | ol = New OpportunityLineItem(); |
| | | System.debug('lt123询价产品数量: ' + ol.Quantity); //lt CHL5XA【FY23询价改善】 |
| | | ol.OpportunityId = oppid; |
| | | ol.Id__c = s.PageObject.Id__c; |
| | | // CHAN-AVG3PW 询价报价画面规则变更 |