高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
global class RepairReceiptBatch implements Database.Batchable<sObject> {
    //HWAG-BCM5AK;---2019-06-12-XHL---
    
 
    global RepairReceiptBatch() {
        
    }
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        
        return Database.getQueryLocator([select Id,Name,
                        Repair__c,Maintenance_Contract__c,DeadlineLastMonthPeriodPaymentAmount__c,
                        DeadlineLastMonthPeriodPaymentAmountFigu__c
                    from Repair_receipt__c where PaymentAmountContrast__c = 0
                    
        ]);
        
        
    }
 
       global void execute(Database.BatchableContext BC, List<Repair_receipt__c> repairReceiptss) {
 
           for (Repair_receipt__c rr :repairReceiptss) {
               //公式与文本不相等时,以公式值为准
               if ( rr.DeadlineLastMonthPeriodPaymentAmount__c != rr.DeadlineLastMonthPeriodPaymentAmountFigu__c) {
                   rr.DeadlineLastMonthPeriodPaymentAmountFigu__c = rr.DeadlineLastMonthPeriodPaymentAmount__c;
               }
               
           }
           if ( repairReceiptss.size() >0 ) {
               update repairReceiptss;
           }
    
    }
    
    global void finish(Database.BatchableContext BC) {
        
    }
    
}