| | |
| | | // chenjingwu 3+2多年保修 20240417 start |
| | | exmpdDetailsRecordsMap = new Map<String,List<ExMpdDetailsInfo>>(); |
| | | muCountMap = new Map<String,Integer>(); |
| | | List<Maintenance_Product_Data_Details__c> exDetailList = [select Id,MultiYearWarranty__c,AgeLimit__c,AgeLimit_Old__c,MultiOneYearWarrantyPrice__c,MultiOneYearWarrantyPrice_Old__c,AmountWithheld__c,AmountWithheld_Old__c,ProductsID__c from Maintenance_Product_Data_Details__c where ProductsID__c in:idList and RecordTypeId = '012C50000000jefIAA']; |
| | | List<Maintenance_Product_Data_Details__c> exDetailList = [select Id,MultiYearWarranty__c,MultiYearWarranty__r.AgeLimit__c,MultiYearWarranty__r.MultiOneYearWarrantyPrice__c,MultiYearWarranty__r.AmountWithheld__c,AgeLimit__c,AgeLimit_Old__c,MultiOneYearWarrantyPrice__c,MultiOneYearWarrantyPrice_Old__c,AmountWithheld__c,AmountWithheld_Old__c,ProductsID__c,ProductsID__r.Name from Maintenance_Product_Data_Details__c where ProductsID__c in:idList and RecordTypeId = '012C50000000jefIAA']; |
| | | if(exDetailList.size() > 0){ |
| | | for(String id: idList){ |
| | | List<ExMpdDetailsInfo> exList = new List<ExMpdDetailsInfo>(); |
| | |
| | | exmpdDetailsRecordsMap.put(id,exList); |
| | | } |
| | | } |
| | | System.dubug('chenjingwu=>' + muCountMap); |
| | | System.dubug('chenjingwu=>' + exmpdDetailsRecordsMap); |
| | | System.debug('chenjingwu=>' + muCountMap); |
| | | System.debug('chenjingwu=>' + exmpdDetailsRecordsMap); |
| | | System.debug('chenjingwu=>' + mpdDetailsRecords); |
| | | // chenjingwu 3+2多年保修 20240417 end |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | List<Maintenance_Product_Data_Details__c> exIntList = new List<Maintenance_Product_Data_Details__c>(); |
| | | if(mpdDetailsRecords.size() > 0 && RecordTypeName.equals('GuranteeMain')){ |
| | | if(RecordTypeName.equals('GuranteeMain')){ |
| | | if(exmpdDetailsRecordsMap == null){ |
| | | |
| | | // chenjingwu 3+2多年保修 20240417 start |
| | |
| | | // chenjingwu 3+2多年保修 20240417 end |
| | | // chenjingwu 3+2多年保修 20240417 start |
| | | muList = [select Id,AgeLimit__c,MultiOneYearWarrantyPrice__c,AmountWithheld__c,ProductName__r.Name,ProductName__c from MultiYearWarranty__c where ProductName__c in: idList order By ProductName__c]; |
| | | Integer str = 0; |
| | | for(MultiYearWarranty__c mu: muList){ |
| | | Maintenance_Product_Data_Details__c insmpdd = new Maintenance_Product_Data_Details__c(); |
| | | insmpdd.Maintenance_Product_Data__c = mpd_Name[0].id; |
| | | insmpdd.Name = mpd_Name[0].Name + '-ex'+ str; |
| | | insmpdd.AgeLimit__c = mu.AgeLimit__c; |
| | | insmpdd.MultiYearWarranty__c = mu.Id; |
| | | insmpdd.MultiOneYearWarrantyPrice__c = mu.MultiOneYearWarrantyPrice__c; |
| | |
| | | insmpdd.AmountWithheld_Old__c = mu.AmountWithheld__c; |
| | | insmpdd.RecordTypeId = '012C50000000jefIAA'; |
| | | exIntList.add(insmpdd); |
| | | |
| | | str++; |
| | | } |
| | | } else{ |
| | | Integer str = 0; |
| | | for(List<ExMpdDetailsInfo> li: exmpdDetailsRecordsMap.values()){ |
| | | for(ExMpdDetailsInfo ex: li){ |
| | | Maintenance_Product_Data_Details__c InsAfterDel = new Maintenance_Product_Data_Details__c(); |
| | | InsAfterDel.Maintenance_Product_Data__c = mpd_Name[0].id; |
| | | InsAfterDel.Name = mpd_Name[0].Name + '-ex'+ str; |
| | | InsAfterDel.AgeLimit__c = ex.mpdrdd.AgeLimit__c; |
| | | InsAfterDel.MultiYearWarranty__c = ex.mpdrdd.MultiYearWarranty__c; |
| | | InsAfterDel.MultiOneYearWarrantyPrice__c = ex.mpdrdd.MultiOneYearWarrantyPrice__c; |
| | |
| | | InsAfterDel.AmountWithheld_Old__c = ex.Prod.AmountWithheld__c; |
| | | InsAfterDel.RecordTypeId = '012C50000000jefIAA'; |
| | | exIntList.add(InsAfterDel); |
| | | str++; |
| | | } |
| | | } |
| | | } |