global class IsValidLicenseBatch implements Database.Batchable<sObject> {
	
	String query;
	Boolean IsNeedExecute = false; // 2021-03-10  mzy  WLIG-BYHD79  SFDC环境batch合并调查  是否符合执行条件
	
	global IsValidLicenseBatch() {
		
	}
	// 2021-03-10  mzy  WLIG-BYHD79  SFDC环境batch合并调查  start
	global IsValidLicenseBatch(Boolean NeedExecute) {
	    this.IsNeedExecute = NeedExecute;
	}
	// 2021-03-10  mzy  WLIG-BYHD79  SFDC环境batch合并调查  end
	
	global Database.QueryLocator start(Database.BatchableContext BC) {

		return Database.getQueryLocator([select Id,Name,IsInquire__c from License_Information__c 
									where Is_Active_Formula__c = false
										AND IsInquire__c = false]);
	}

   	global void execute(Database.BatchableContext BC, List<sObject> scope) {
   		system.debug('licenseList__' + scope);
		List<License_Information__c> listLicense = new List<License_Information__c>();
		List<License_Information__c> licenseList = new List<License_Information__c>();
		licenseList = scope;
		
		for (License_Information__c li :licenseList) {
			li.IsInquire__c = true;
			listLicense.add(li);
		}

		if(licenseList.size() >0){
			update licenseList;
		}
	}
	
	global void finish(Database.BatchableContext BC) {
		//2021-03-05  mzy  WLIG-BYHD79  SFDC环境batch合并调查  start
        if(!Test.isRunningTest() &&IsNeedExecute==true){
            //batch里调用下一个batch时，希望跟原有的Schedule里面传的条数保持一致
            // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 start
            // Id execBTId = Database.executebatch(new ConsumAutoSelectBatch(true));
            Id execBTId = Database.executebatch(new SetOlympusCalendarWorkDayBatch(true),200);
            // 20220309 ljh  SFDC-CC73U5 132 动物实验&ET展箱 锁定已过期库存 end
        }
        //2021-03-05  mzy  WLIG-BYHD79  SFDC环境batch合并调查 end
	}
	
}