123
chenjingwu
2024-04-23 c105d45d688045fddae6733776d7291482825011
force-app/main/default/classes/MaintenanceProductDataController.cls
@@ -51,8 +51,8 @@
    
    // chenjingwu 3+2多年保修 start
    public List<MultiYearWarranty__c> muList { get; set; }
    public List<String,Integer> muCountMap { get; set; }
    public Map<String,List<MultiYearWarranty__c>> muMap { get; set; }
    public Map<String,Integer> muCountMap {get; set; }
    // chenjingwu 3+2多年保修 end
     /*****************画面表示Bean******************/
@@ -869,7 +869,12 @@
                    }
                }
                // chenjingwu 3+2多年保修 20240417 start 
                muList = [select Id,AgeLimit__c,MultiOneYearWarrantyPrice__c,AmountWithheld__c,ProductName__c from MultiYearWarranty__c where ProductName__c in: idList order By ProductName__c];
                muCountMap = new Map<String,Integer>();
                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];
                  for(AggregateResult  objAgr: [select ProductName__c,COUNT(Id) total from MultiYearWarranty__c where ProductName__c in:idList group by ProductName__c]){
                    muCountMap.put((String)objAgr.get('ProductName__c'), (Integer)objAgr.get('total') + 1);
                  }
                  muMap = new Map<String,List<MultiYearWarranty__c>>();
                for(String id: idList){
                    List<MultiYearWarranty__c> mus = new List<MultiYearWarranty__c>();
                    for(MultiYearWarranty__c mu: muList){
@@ -877,10 +882,14 @@
                            mus.add(mu);
                        }
                    }
                    mus.add(new MultiYearWarranty__c({ProductName__c:id}));
                    mus.add(new MultiYearWarranty__c(ProductName__r = id,ProductName__c = id));
                    muMap.put(id,mus);
                }
                // chenjingwu 3+2多年保修 20240417 end
                System.debug('chenjingwu=>' + muCountMap);
                System.debug('chenjingwu=>' + muMap);
                System.debug('chenjingwu=>' + mpdDetailsRecordsView);
                // chenjingwu 3+2多年保修   20240417 end
                if(isWarning){
                    return null;
                }else{
@@ -893,6 +902,7 @@
                }
            }
        }catch(Exception e){
            System.debug('chenjingwu==>' + e.getMessage());
            ApexPages.addMessages(e);
            Database.rollback(sp);
            return null;
@@ -1437,9 +1447,6 @@
        public Boolean oldCheck { get; set; }
        public Boolean canSelect { get; set; }
        public Product2 Prod { get; set; }
        // chenjignwu 3+2多年保修 20240417 start
        public MultiYearWarranty__c myw { get; set; }
        // chenjignwu 3+2多年保修 20240417 end
        public Maintenance_Product_Data_Details__c mpdrdd {get; set;}
        // 20231103 chenjingwu  Lightning文件修改 Start
        public ContentDocument Concc { get; set; }
@@ -1450,14 +1457,6 @@
            oldCheck = true;
            mpdrdd = e;
            Prod = e.ProductsID__r;
            // chenjignwu 3+2多年保修 20240417 start
            myu = e.MultiYearWarranty__r;
            // chenjignwu 3+2多年保修 20240417 end
            canSelect = true;
        }
        public MaintenanceProductDataDetailsInfo(MultiYearWarranty__c mu) {
            mpdrdd = new Maintenance_Product_Data_Details__c();
            myw = mu;
            canSelect = true;
        }
        public MaintenanceProductDataDetailsInfo(Product2 e) {