From 82bab865cd68bf4d18d7e0e63342b5cbe76a6aa3 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期五, 19 四月 2024 13:56:33 +0800
Subject: [PATCH] 123
---
force-app/main/default/classes/lexNewQuoteEntryController.cls | 77 +++++++++++++++++++++++++-------------
1 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/force-app/main/default/classes/lexNewQuoteEntryController.cls b/force-app/main/default/classes/lexNewQuoteEntryController.cls
index 721187f..7c36ae0 100644
--- a/force-app/main/default/classes/lexNewQuoteEntryController.cls
+++ b/force-app/main/default/classes/lexNewQuoteEntryController.cls
@@ -71,7 +71,7 @@
Quote_Adjust_Amount__c, Quote_Adjust_Calculate__c, Discount_Amount__c, Discount_Amount_Calculate__c, Installation_location__c,
QuoteTotal_Page__c, Dealer_Final_Price_Page__c, Quote_Adjust_Amount_Page__c, OCM_Agent1_Price_Page__c, Agent1_Agent2_Price_Page__c
, AgencyDiscount__c,OCM_Sales_Forecast__c//棰勬祴閲戦淇敼 fy
- , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c,ExtendedWarrantyAmountTotalPrice__c
+ , Gurantee_Period__c , multiYearWarranty__c, MultiYearWarrantyTotalPrice__c,ExtendedWarrantyAmountTotalPrice__c,
Preferential_Gurantee_Period__c,LineItemCount
,IsQuoteTrial__c,OpportunityId,Opportunity.RecordType.DeveloperName
FROM Quote Where Id = :quoId];
@@ -232,27 +232,30 @@
// }
@AuraEnabled
public static Map<String,Object> addOptions(List<String> idList){
- Map<String,Integer> intList = new Map<String,Integer>();
- for(AggregateResult objAgr: [select ProductName__c,COUNT(Id) total from MultiYearWarranty__c where ProductName__c in:idList group by ProductName__c]){
- intList.put((String)objAgr.get('ProductName__c'), (Integer)objAgr.get('total'));
- }
- Map<String,List<OptionTemplete>> optionMap = new Map<String,List<OptionTemplete>>();
+ // Map<String,Integer> intList = new Map<String,Integer>();
+ // for(AggregateResult objAgr: [select ProductName__c,COUNT(Id) total from MultiYearWarranty__c where ProductName__c in:idList group by ProductName__c]){
+ // intList.put((String)objAgr.get('ProductName__c'), (Integer)objAgr.get('total'));
+ // }
+ // Map<String,List<OptionTemplete>> optionMap = new Map<String,List<OptionTemplete>>();
+ // Map<String,Object> allMap = new Map<String,Object>();
+ // Map<String,List<MultiYearWarranty__c>> priceMap = new Map<String,List<MultiYearWarranty__c>>();
+ // for(String id: idList){
+ // List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
+ // optionTempleteList.add(new OptionTemplete('0骞�','0'));
+ // if(intList.containsKey(id)){
+ // for(Integer j = 0;j < intList.get(id);j++){
+ // optionTempleteList.add(new OptionTemplete((j + 1) + '骞�',(j + 1) + ''));
+ // }
+ // optionMap.put(id,optionTempleteList);
+ // }else {
+ // optionMap.put(id,optionTempleteList);
+ // }
+ // }
+ // allMap.put('optionMap',optionMap);
Map<String,Object> allMap = new Map<String,Object>();
Map<String,List<MultiYearWarranty__c>> priceMap = new Map<String,List<MultiYearWarranty__c>>();
- for(String id: idList){
- List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
- optionTempleteList.add(new OptionTemplete('0骞�',''));
- if(intList.containsKey(id)){
- for(Integer j = 0;j < intList.get(id);j++){
- optionTempleteList.add(new OptionTemplete((j + 1) + '骞�',(j + 1) + ''));
- }
- optionMap.put(id,optionTempleteList);
- }else {
- optionMap.put(id,optionTempleteList);
- }
- }
- allMap.put('optionMap',optionMap);
- List<MultiYearWarranty__c> muList = [select Id,ProductName__c,MultiOneYearWarrantyPrice__c,AmountWithheld__c,AgeLimit__c from MultiYearWarranty__c where ProductName__c in:idList];
+ Map<String,List<OptionTemplete>> optionMap = new Map<String,List<OptionTemplete>>();
+ List<MultiYearWarranty__c> muList = [select Id,ProductName__c,MultiOneYearWarrantyPrice__c,AmountWithheld__c,AgeLimit__c from MultiYearWarranty__c where ProductName__c in:idList order by AgeLimit__c];
for(String id: idList){
List<MultiYearWarranty__c> muList1 = new List<MultiYearWarranty__c>();
for(MultiYearWarranty__c mu : muList){
@@ -263,6 +266,15 @@
priceMap.put(id,muList1);
}
allMap.put('priceMap',priceMap);
+ for(String id: idList){
+ List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
+ optionTempleteList.add(new OptionTemplete('0骞�','0'));
+ for(MultiYearWarranty__c mu: priceMap.get(id)){
+ optionTempleteList.add(new OptionTemplete(mu.AgeLimit__c + '骞�',mu.AgeLimit__c + ''));
+ }
+ optionMap.put(id,optionTempleteList);
+ }
+ allMap.put('optionMap',optionMap);
return allMap;
}
// chenjingwu 20240409 end
@@ -1308,6 +1320,7 @@
ql.UnitPrice__c = ql.UnitPrice_Page__c;
ql.UnitPrice_Page__c = 0;
ql.ListPrice__c = s.ListPrice_Page;
+ ql.ExtendedWarrantyAmount__c = s.exPrice;
ql.GuranteePrice__c = s.GuranteePrice;
ql.ProductGuranteePrice__c = s.ProductGuranteePrice;
ql.Maintenance_Price_Year__c = s.Maintenance_Price_Year;
@@ -2930,7 +2943,9 @@
// chenjingwu sp涓绘満绫诲瀷 20240318 end
// chenjingwu 3+2澶氬勾淇� 20240401 start
public String Learning_Community;
+ public String Learning_CommunityCopy;
public Decimal exPrice;
+ public Decimal exPriceCopy;
// public List<Map<String, String>> Learning_CommunityOptions = new List<Map<String, String>>();
public List<OptionTemplete> Learning_CommunityOptions;
public List<MultiYearWarranty__c> multiYearWarrantyList;
@@ -2962,7 +2977,7 @@
if(qli.ExtendedWarrantyPeriod__c != null && qli.ExtendedWarrantyPeriod__c != 0){
this.Learning_Community = String.valueof(qli.ExtendedWarrantyPeriod__c);
}
- this.multiYearWarrantyList = [select Id,MultiOneYearWarrantyPrice__c,AmountWithheld__c,AgeLimit__c from MultiYearWarranty__c where ProductName__c =: qli.PricebookEntry.Product2Id];
+ this.multiYearWarrantyList = [select Id,MultiOneYearWarrantyPrice__c,AmountWithheld__c,AgeLimit__c from MultiYearWarranty__c where ProductName__c =: qli.PricebookEntry.Product2Id order by AgeLimit__c];
Integer period = this.multiYearWarrantyList.size();
if(qli.ExtendedWarrantyPeriod__c != null && qli.ExtendedWarrantyPeriod__c != 0){
for(MultiYearWarranty__c mu: this.multiYearWarrantyList){
@@ -2970,14 +2985,24 @@
this.exPrice = mu.MultiOneYearWarrantyPrice__c;
}
}
+ }else{
+ this.Learning_Community = 0 + '';
+ this.exPrice = 0;
}
+ List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
+ optionTempleteList.add(new OptionTemplete('0骞�','0'));
if(period > 0){
- List<OptionTemplete> optionTempleteList = new List<OptionTemplete>();
- optionTempleteList.add(new OptionTemplete('0骞�',''));
- for(Integer j = 0;j < period;j++){
- optionTempleteList.add(new OptionTemplete((j + 1) + '骞�',(j + 1) + ''));
+ for(MultiYearWarranty__c mu: this.multiYearWarrantyList){
+ optionTempleteList.add(new OptionTemplete(mu.AgeLimit__c + '骞�',mu.AgeLimit__c + ''));
}
- this.Learning_CommunityOptions = optionTempleteList;
+ // for(Integer j = 0;j < period;j++){
+ // optionTempleteList.add(new OptionTemplete((j + 1) + '骞�',(j + 1) + ''));
+ // }
+ }
+ this.Learning_CommunityOptions = optionTempleteList;
+ if(qli.ExtendedWarrantyPeriod__c == null && this.Learning_CommunityOptions.size() > 1){
+ this.Learning_Community = this.multiYearWarrantyList.get(this.multiYearWarrantyList.size() - 1).AgeLimit__c + '';
+ this.exPrice = this.multiYearWarrantyList.get(this.multiYearWarrantyList.size() - 1).MultiOneYearWarrantyPrice__c;
}
// this.ExtendedWarrantyPeriod = new WarrantyPeriod(optionTempleteList,'');
--
Gitblit v1.9.1