/* 2021-07-29 mzy * 勾选 服务合同报告书上的是否已过或当前季度 * 报告书的季度开始日小于今天 , 已过或当前季度 未勾选 */ global class UpdateNewMaintenanceTaskBatch implements Database.Batchable { Boolean IsNeedExecute = false; global UpdateNewMaintenanceTaskBatch() { } global UpdateNewMaintenanceTaskBatch(Boolean NeedExecute) { this.IsNeedExecute = NeedExecute; } global Database.QueryLocator start(Database.BatchableContext bc) { Date today = Date.today(); String query = 'SELECT Id,OverOrCurrent__c FROM NewMaintenanceReport_Task__c where Distribution_Start_Date__c <= :today And OverOrCurrent__c = false'; return Database.getQueryLocator(query); } global void execute(Database.BatchableContext BC, list NMCReportT) { //勾选 已过或当前季度 for(NewMaintenanceReport_Task__c tempMCT:NMCReportT){ tempMCT.OverOrCurrent__c = true; } update NMCReportT; } global void finish(Database.BatchableContext BC) { } }