彭锟
2022-04-01 216f61fcfdd0bc469cec809c31e4d49c1d86158e
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
global class NFM112Batch implements Database.Batchable<SObject>,Database.AllowsCallouts{
    public String query;
    
    public NFM112Batch() {
        this.query = query;
    }
    // public static void sendToSAP(String qisId) {
    //     BatchIF_Log__c iflog = new BatchIF_Log__c();
    //     iflog.Type__c = 'NFM112';
    //     iflog.Log__c  = 'callout start\n';
    //     insert iflog;
    //     iflog = [Select Id, Name from BatchIF_Log__c where Id = :iflog.Id];
    //     //System.debug(Logginglevel.DEBUG, 'NFM112_' + iflog.Name + ' start');                  
    //     NFM112Controller.executeNotFuture(iflog.Id, qisId);
    // }
    global Database.QueryLocator start(Database.BatchableContext bc) {
        Date SendDay = Date.newInstance(Date.today().year(),4,1);
        system.debug('SendDay               '+SendDay);
        return Database.getQueryLocator([select Id,Approved_Confirm_Date__c from Account where Need_Send__c = :SendDay]);
    }
    global void execute(Database.BatchableContext BC, list<Account> scope) {
        string tempId;
        for(Account temp : scope){
            tempId = temp.Id;
        }
        NFM112Controller.executeNotFuture(null,tempId);
    }
 
    global void finish(Database.BatchableContext BC) {
     
    }
}