feat(ft546): run standard WCS as the single scheduler
This commit is contained in:
@@ -14,6 +14,7 @@ import com.ruoyi.device.tsj.domain.DeviceTsj;
|
||||
import com.ruoyi.device.tsj.service.IDeviceTsjService;
|
||||
import com.ruoyi.project.ft546.device.Ft546DeviceRuntimeRegistry;
|
||||
import com.ruoyi.project.ft546.device.shuttle.Ft546SrgvRuntimeFactory;
|
||||
import com.ruoyi.project.ft546.config.Ft546WcsProperties;
|
||||
import com.ruoyi.schedule.plcRead.cdz.PlcCdzRead;
|
||||
import com.ruoyi.schedule.plcRead.ddj.PlcDdjRead;
|
||||
import com.ruoyi.schedule.plcRead.srgv.PlcSrgvRead;
|
||||
@@ -27,6 +28,8 @@ import com.ruoyi.schedule.scheduleTask.ssj.SsjThread;
|
||||
import com.ruoyi.schedule.scheduleTask.tsj.TsjThread;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -66,6 +69,8 @@ public class ScheduleThread {
|
||||
private Ft546DeviceRuntimeRegistry deviceRuntimeRegistry;
|
||||
@Autowired
|
||||
private Ft546SrgvRuntimeFactory srgvRuntimeFactory;
|
||||
@Autowired
|
||||
private Ft546WcsProperties ft546WcsProperties;
|
||||
|
||||
private volatile boolean isRun = false;
|
||||
private volatile boolean isRun2 = false;
|
||||
@@ -90,10 +95,20 @@ public class ScheduleThread {
|
||||
|
||||
}
|
||||
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void startStandardFactReadersAfterApplicationReady() {
|
||||
if (isStandardMode()) {
|
||||
startAllThread();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调度初始化
|
||||
*/
|
||||
private void scheduleInit() {
|
||||
if (isStandardMode()) {
|
||||
return;
|
||||
}
|
||||
MonitoringThread monitoringThread = new MonitoringThread();
|
||||
monitoringCustomThread = new CustomThread<MonitoringThread>(new Thread(monitoringThread), monitoringThread);
|
||||
SsjThread ssjThread=new SsjThread();
|
||||
@@ -196,6 +211,10 @@ public class ScheduleThread {
|
||||
* 开启线程2
|
||||
*/
|
||||
public void startAllThread2() {
|
||||
if (isStandardMode()) {
|
||||
throw new IllegalStateException(
|
||||
"legacy business scheduler is disabled in STANDARD mode");
|
||||
}
|
||||
monitoringCustomThread.thread.start();
|
||||
ssjThreadCustomThread.thread.start();
|
||||
tsjThreadCustomThread.thread.start();
|
||||
@@ -322,6 +341,10 @@ public class ScheduleThread {
|
||||
* 停止线程2
|
||||
*/
|
||||
public void stopAllThread2() {
|
||||
if (isStandardMode()) {
|
||||
isRun2 = false;
|
||||
return;
|
||||
}
|
||||
monitoringCustomThread.runnable.isRun = false;
|
||||
// ddj1CustomThread.runnable.isRun = false;
|
||||
/*ddj2CustomThread.runnable.isRun = false;
|
||||
@@ -342,4 +365,10 @@ public class ScheduleThread {
|
||||
map.put("isRun2",isRun2);
|
||||
return map;
|
||||
}
|
||||
|
||||
private boolean isStandardMode() {
|
||||
return ft546WcsProperties != null
|
||||
&& ft546WcsProperties.getRuntimeMode()
|
||||
== Ft546WcsProperties.RuntimeMode.STANDARD;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user