| | |
| | | // lastbuy判断变更用户询价 start |
| | | , If_Account_Change__c |
| | | // lastbuy判断变更用户询价 end |
| | | // DB202303051651 产品报价金额自动计算 ssm start |
| | | , Salesdepartment_Owner__c |
| | | // DB202303051651 产品报价金额自动计算 ssm end |
| | | FROM Opportunity Where Id = :oppId]; |
| | | // 多年保修 start |
| | | trade = '外貿'; |
| | |
| | | } |
| | | } 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, |
| | |
| | | // 多年保修 end |
| | | //报价试算 start |
| | | ,IsQuoteTrial__c |
| | | //报价试算 end |
| | | //报价试算 end |
| | | FROM Quote Where Id = :quoId]; |
| | | List<QuoteLineItem> items = |
| | | [Select Id, Asset_Model_No__c, SFDA_Status__c, Product_Sales_Possibility__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 |
| | |
| | | xlscode = null; |
| | | xlsQuantity = null; |
| | | xlslist = xls.split('\t', -1); |
| | | system.debug('xlslist+++'+xlslist); |
| | | for (String s : xlslist) { |
| | | //odd number or even number |
| | | if (math.mod(i, 2) != 0) { |
| | | system.debug('xlslist1+++'+s); |
| | | //odd number |
| | | if (s == '' || s == null) { |
| | | errorflg = true; |
| | |
| | | Quantitylist.add(xlsQuantity); |
| | | } |
| | | } else { |
| | | system.debug('xlslist2+++'+s); |
| | | //even number |
| | | if (s == '' || s == null) { |
| | | errorflg = true; |
| | |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | system.debug('xlslist3+++'+xlscnt); |
| | | activities = tmpactivities; |
| | | errorflg = true; |
| | | errormessage = System.Label.Error_Message31; |
| | |
| | | if (codelist.size() == 0 || Quantitylist.size() == 0) { |
| | | activities = tmpactivities; |
| | | errorflg = true; |
| | | system.debug('codelist+++'+codelist); |
| | | system.debug('Quantitylist+++'+Quantitylist); |
| | | errormessage = System.Label.Error_Message31; |
| | | pageArrange(); |
| | | return null; |
| | |
| | | } |
| | | |
| | | } 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 询价报价画面规则变更 |
| | |
| | | // lastbuy判断变更用户询价 start |
| | | public Boolean is_changed_opp { get; set; } |
| | | // lastbuy判断变更用户询价 end |
| | | // DB202303051651 产品报价金额自动计算 ssm start |
| | | // 医院合同金额比例 |
| | | public Decimal rate_hospital { get; set; } |
| | | // 经销商1合同金额比例 |
| | | public Decimal rate_agency1 { get; set; } |
| | | // DB202303051651 产品报价金额自动计算 ssm end |
| | | |
| | | public OppInfo(Opportunity opp) { |
| | | Account_RecordType_DeveloperName = opp.Account.RecordType.DeveloperName; |
| | |
| | | // lastbuy判断变更用户询价 start |
| | | is_changed_opp = opp.If_Account_Change__c != null ? opp.If_Account_Change__c : false; |
| | | // lastbuy判断变更用户询价 end |
| | | // DB202303051651 产品报价金额自动计算 ssm start |
| | | String str_rate_hospital = ControllerUtil.getValueFromJSONString(System.Label.Quote_HospitalAmount_Rate, opp.Salesdepartment_Owner__c); |
| | | String str_rate_agency1 = ControllerUtil.getValueFromJSONString(System.Label.Quote_Agency1Amount_Rate, opp.Salesdepartment_Owner__c); |
| | | rate_hospital = String.isNotBlank(str_rate_hospital) ? Decimal.valueOf(str_rate_hospital) : 1.0; |
| | | rate_agency1 = String.isNotBlank(str_rate_agency1) ? Decimal.valueOf(str_rate_agency1) : 1.0; |
| | | // DB202303051651 产品报价金额自动计算 ssm end |
| | | } |
| | | } |
| | | //TODO 1.Quoteオブジェクト追加 |