/** * 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); } }