|
@@ -22,6 +22,7 @@ import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@Service
|
|
@Service
|
|
@@ -32,7 +33,7 @@ public class DeJuRFIDService implements IService {
|
|
|
|
|
|
|
|
private final Map<String, GClient> clientMap = new ConcurrentHashMap<>();
|
|
private final Map<String, GClient> clientMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
|
|
- private volatile boolean isAlarm=false;
|
|
|
|
|
|
|
+ private final AtomicBoolean isAlarm=new AtomicBoolean();
|
|
|
|
|
|
|
|
private final ScheduledExecutorService scheduledExecutorService= SpringUtils.getBean("scheduledExecutorService");
|
|
private final ScheduledExecutorService scheduledExecutorService= SpringUtils.getBean("scheduledExecutorService");
|
|
|
|
|
|
|
@@ -153,13 +154,13 @@ public class DeJuRFIDService implements IService {
|
|
|
String status = state == 1 ? "start" : "stop";
|
|
String status = state == 1 ? "start" : "stop";
|
|
|
if (0 == msgAppSetGpo.getRtCode()) {
|
|
if (0 == msgAppSetGpo.getRtCode()) {
|
|
|
log.info("Gpo epc {} successful.",status);
|
|
log.info("Gpo epc {} successful.",status);
|
|
|
|
|
+ if (state==1){
|
|
|
|
|
+ stopGpo(client,delayTime);
|
|
|
|
|
+ isAlarm.set(false);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
log.error("Gpo epc {} error.",status);
|
|
log.error("Gpo epc {} error.",status);
|
|
|
}
|
|
}
|
|
|
- if (state==1){
|
|
|
|
|
- stopGpo(client,delayTime);
|
|
|
|
|
- isAlarm=false;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void stopGpo(GClient client,int delayTime){
|
|
public void stopGpo(GClient client,int delayTime){
|
|
@@ -181,9 +182,9 @@ public class DeJuRFIDService implements IService {
|
|
|
if (logBaseEpcInfo.getResult() == 0) {
|
|
if (logBaseEpcInfo.getResult() == 0) {
|
|
|
log.info("===========》{}",logBaseEpcInfo.getbEpc());
|
|
log.info("===========》{}",logBaseEpcInfo.getbEpc());
|
|
|
//灯带设置
|
|
//灯带设置
|
|
|
- if (!isAlarm){
|
|
|
|
|
|
|
+ if (!isAlarm.get()){
|
|
|
scheduledExecutorService.execute(() -> {
|
|
scheduledExecutorService.execute(() -> {
|
|
|
- isAlarm=true;
|
|
|
|
|
|
|
+ isAlarm.set(true);
|
|
|
changeGpo(1, client,10);
|
|
changeGpo(1, client,10);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|