高章伟
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
41
42
43
44
45
46
47
/**
 * Created by shentianyi on 2019/04/11.
 */
 
global class ET_Batch2_Scheduler implements Schedulable {
    private final Integer BATCH_SIZE = 200;
 
    // 毎日実行します
    // system.schedule('ET_Batch_Transaction','0 0 4 * * ?', new ET_Batch2_Scheduler());
    global void execute(SchedulableContext ctx) {
        // 产品分类价格表Batch
        Database.executeBatch(new ET_Product_CategoryPrice_Table_Batch(), BATCH_SIZE);
        // 经销商实绩Batch 今月
        Database.executeBatch(new ET_Agency_Target_Result_Table_Batch(), BATCH_SIZE);
        Database.executeBatch(new ET_Agency_Target_Result_Table_Batch2(), BATCH_SIZE);
        // 直销实绩Batch 今月
        Database.executeBatch(new ET_Product_ScoreTableHistory_Batch2(), BATCH_SIZE);
        Database.executeBatch(new ET_Product_ScoreTableHistory_Batch3(), BATCH_SIZE);
        
        Date date_limit_h = Date.today().addDays(-1).addMonths(-1);
        // 经销商实绩Batch 前月
        ET_Agency_Target_Result_Table_Batch bat = new ET_Agency_Target_Result_Table_Batch ();
        bat.isAllFlag = true;
        bat.cstYear = date_limit_h.year();
        bat.cstMonth = date_limit_h.month();
        Database.executeBatch(bat, BATCH_SIZE);
 
        ET_Agency_Target_Result_Table_Batch2 bat2 = new ET_Agency_Target_Result_Table_Batch2 ();
        bat2.isAllFlag = true;
        bat2.cstYear = date_limit_h.year();
        bat2.cstMonth = date_limit_h.month();
        Database.executeBatch(bat2, BATCH_SIZE);
 
        // 直销实绩Batch 前月
        ET_Product_ScoreTableHistory_Batch2 bat3 = new ET_Product_ScoreTableHistory_Batch2 ();
        bat3.isAllFlag = true;
        bat3.cstYear = date_limit_h.year();
        bat3.cstMonth = date_limit_h.month();
        Database.executeBatch(bat3, BATCH_SIZE);
 
        ET_Product_ScoreTableHistory_Batch3 bat4 = new ET_Product_ScoreTableHistory_Batch3 ();
        bat4.isAllFlag = true;
        bat4.cstYear = date_limit_h.year();
        bat4.cstMonth = date_limit_h.month();
        Database.executeBatch(bat4, BATCH_SIZE);
    }
}