123
chenjingwu
2024-04-24 cd74a602ecfc22cae4b425d12b1b027d1d087ec4
force-app/main/default/classes/MaintenanceProductDataController.cls
@@ -553,8 +553,8 @@
                        exmpdDetailsRecordsMap.put(id,exList);
                    }
                }
                System.dubug('chenjingwu=>' + muCountMap);
                System.dubug('chenjingwu=>' + exmpdDetailsRecordsMap);
                System.debug('chenjingwu=>' + muCountMap);
                System.debug('chenjingwu=>' + exmpdDetailsRecordsMap);
                // chenjingwu 3+2多年保修   20240417 end
            } 
        }    
@@ -892,7 +892,7 @@
                    }
                }
                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 
@@ -905,8 +905,11 @@
                        // 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;
@@ -918,12 +921,15 @@
                            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;
@@ -935,6 +941,7 @@
                                InsAfterDel.AmountWithheld_Old__c = ex.Prod.AmountWithheld__c;
                                InsAfterDel.RecordTypeId = '012C50000000jefIAA';
                                exIntList.add(InsAfterDel);
                                str++;
                            }
                        }
                    }