|
|
@ -7,6 +7,7 @@ import com.xujie.sys.modules.pms.service.Impl.QcServiceImpl; |
|
|
import com.xujie.sys.modules.reader.service.GetInformationForExcelService; |
|
|
import com.xujie.sys.modules.reader.service.GetInformationForExcelService; |
|
|
import com.xujie.sys.modules.reader.service.ModbusCommunicateService; |
|
|
import com.xujie.sys.modules.reader.service.ModbusCommunicateService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.context.annotation.Configuration; |
|
|
import org.springframework.context.annotation.Configuration; |
|
|
import org.springframework.scheduling.annotation.EnableScheduling; |
|
|
import org.springframework.scheduling.annotation.EnableScheduling; |
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
@ -34,6 +35,9 @@ public class TaskUtils { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private ModbusCommunicateService modbusCommunicateService; |
|
|
private ModbusCommunicateService modbusCommunicateService; |
|
|
|
|
|
// 全局任务开关 |
|
|
|
|
|
@Value("${task.enabled:true}") |
|
|
|
|
|
private boolean taskEnabled; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@ -41,6 +45,9 @@ public class TaskUtils { |
|
|
*/ |
|
|
*/ |
|
|
@Scheduled(cron = "${task.data.eamWorkPlanTime}") |
|
|
@Scheduled(cron = "${task.data.eamWorkPlanTime}") |
|
|
public void doTask() { |
|
|
public void doTask() { |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
eamService.eamWorkPlanTask(); |
|
|
eamService.eamWorkPlanTask(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -49,6 +56,10 @@ public class TaskUtils { |
|
|
*/ |
|
|
*/ |
|
|
@Scheduled(cron = "${task.data.getExcelInformation}" ) //每五秒执行 读取文件数据 |
|
|
@Scheduled(cron = "${task.data.getExcelInformation}" ) //每五秒执行 读取文件数据 |
|
|
public void getExcel(){ |
|
|
public void getExcel(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
getInformationForExcelService.saveByExcel(); |
|
|
getInformationForExcelService.saveByExcel(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -57,6 +68,9 @@ public class TaskUtils { |
|
|
*/ |
|
|
*/ |
|
|
@Scheduled(cron = "${task.data.sendEmail}" ) |
|
|
@Scheduled(cron = "${task.data.sendEmail}" ) |
|
|
public void sendEmail() throws MessagingException, UnsupportedEncodingException { |
|
|
public void sendEmail() throws MessagingException, UnsupportedEncodingException { |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
eamProjectService.sendEmail(); |
|
|
eamProjectService.sendEmail(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -65,33 +79,59 @@ public class TaskUtils { |
|
|
*/ |
|
|
*/ |
|
|
@Scheduled(cron = "${task.data.modbusCommunicate}") |
|
|
@Scheduled(cron = "${task.data.modbusCommunicate}") |
|
|
public void getModbus(){ |
|
|
public void getModbus(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
modbusCommunicateService.getInfoByModbus(); |
|
|
modbusCommunicateService.getInfoByModbus(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Scheduled(cron = "${task.data.readPerSecond}") |
|
|
@Scheduled(cron = "${task.data.readPerSecond}") |
|
|
public void readPerSecond(){ |
|
|
public void readPerSecond(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
modbusCommunicateService.readPerSecond(); |
|
|
modbusCommunicateService.readPerSecond(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Scheduled(cron = "${loraurl.getLoraWatchTime}") |
|
|
@Scheduled(cron = "${loraurl.getLoraWatchTime}") |
|
|
//@Scheduled(cron = "0/30 * * * * ?") |
|
|
//@Scheduled(cron = "0/30 * * * * ?") |
|
|
public void getLoraWatchMessage(){eamService.getLoraWatch();}; |
|
|
|
|
|
|
|
|
public void getLoraWatchMessage(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
eamService.getLoraWatch();}; |
|
|
|
|
|
|
|
|
//@Scheduled(cron = "${loraurl.sendLoraWatchTime}") |
|
|
//@Scheduled(cron = "${loraurl.sendLoraWatchTime}") |
|
|
public void sendLoraWatchMessage(){eamService.sendLoraWatch();}; |
|
|
|
|
|
|
|
|
public void sendLoraWatchMessage(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
eamService.sendLoraWatch();}; |
|
|
|
|
|
|
|
|
//@Scheduled(cron = "${loraurl.sendThreeColourTime}") |
|
|
//@Scheduled(cron = "${loraurl.sendThreeColourTime}") |
|
|
public void sendThreeColourLight(){eamService.sendThreeColourLight();}; |
|
|
|
|
|
|
|
|
public void sendThreeColourLight(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
eamService.sendThreeColourLight();}; |
|
|
|
|
|
|
|
|
@Scheduled(cron = "${loraurl.sendRedColourTime}") |
|
|
@Scheduled(cron = "${loraurl.sendRedColourTime}") |
|
|
//@Scheduled(cron = "0/10 * * * * ?") |
|
|
//@Scheduled(cron = "0/10 * * * * ?") |
|
|
public void sendLoraRedLight(){eamService.sendLoraRedLight();} |
|
|
|
|
|
|
|
|
public void sendLoraRedLight(){ |
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
eamService.sendLoraRedLight();} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 创建质量任务 |
|
|
* 创建质量任务 |
|
|
*/ |
|
|
*/ |
|
|
@Scheduled(cron = "${task.data.createQCInspection}") |
|
|
@Scheduled(cron = "${task.data.createQCInspection}") |
|
|
public void createQCInspection() { |
|
|
public void createQCInspection() { |
|
|
|
|
|
|
|
|
|
|
|
if(!taskEnabled){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
qcService.createQCInspection(); |
|
|
qcService.createQCInspection(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|