package com.zy.asrs.task; import com.zy.asrs.task.core.ReturnT; import com.zy.asrs.task.handler.MesMatSyncHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; /** * 轮询MES接口,同步物料档案信息 */ @Slf4j @Component public class MesMatSyncScheduler { @Autowired MesMatSyncHandler handler; //@Scheduled(cron = "0/30 * * * * ?") // @Scheduled(cron = "0/30 * * * * ?") //@Scheduled(cron = "0 0/2 * * * ?") private void execute() { ReturnT result = null; try { result = handler.start(); } catch (IOException e) { e.printStackTrace(); } if (!result.isSuccess()) { log.error(""); } } }