涂煌豪
2022-03-21 18177a0121022fed55c578471785e4c2c6b9691b
force-app/main/default/classes/RepairTrigger.cls
@@ -706,13 +706,14 @@
        List<Repair__c> updateRepairList = new List<Repair__c>();
        System.debug('newList1:' + newList);
        for(Repair__c rep : newList){
            Repair__c oldRep = oldMap.get(rep.Id);
            if(rep.Repair_Quotation_Id__c != null){
                RepairQuotationIdList.add(rep.Repair_Quotation_Id__c);
            }else{
                NoRepairQuotationList.add(rep);
            }
        }
        System.debug('RepairQuotationIdList1:' + RepairQuotationIdList);
        System.debug('NoRepairQuotationList1:' + NoRepairQuotationList);
        //同期中的修理修理报价有值时,看报价上的先款标识进行赋值
        if(RepairQuotationIdList.size() > 0){
            RepairQuotationList = [select Id, Is_RecognitionModel__c from Repair_Quotation__c where Id IN :RepairQuotationIdList];
@@ -721,7 +722,7 @@
            for(Repair__c rep : newList){
                if(rq.Id == rep.Repair_Quotation_Id__c){
                    rep.Advance_Payment_Flag__c = rq.Is_RecognitionModel__c;
                    updateRepairList.add(rep);
                    // updateRepairList.add(rep);
                }
            }
        }
@@ -738,19 +739,13 @@
            for(Repair__c rep : newList){
                if(rep.Dealer__c == dealer.Id){
                    rep.Advance_Payment_Flag__c = dealer.FirstParagraphEnd__c;
                    updateRepairList.add(rep);
                    // updateRepairList.add(rep);
                }
            }
        }
        Savepoint sp = Database.setSavepoint();
        try {
            if(updateRepairList.size() > 0){
                update updateRepairList;
            }
        } catch (System.Exception e) {
            Database.rollback(sp);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
        }
        // if(updateRepairList.size() > 0){
        //     update updateRepairList;
        // }
    }
    //先款后修-修理增加先款标识 thh 20220318 end