|
@@ -37,7 +37,6 @@ import com.sckj.warn.validate.TExceptionLogCreateValidate;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
-import org.apache.commons.lang3.math.NumberUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.expression.Expression;
|
|
import org.springframework.expression.Expression;
|
|
@@ -238,6 +237,9 @@ public class DeviceEventListener extends EventListener { //
|
|
//redis保存最多数量数据
|
|
//redis保存最多数量数据
|
|
private static final int MAX_REDIS_COUNT = 50;
|
|
private static final int MAX_REDIS_COUNT = 50;
|
|
|
|
|
|
|
|
+ //上次出铁量
|
|
|
|
+ private OPCData mIronOPCData;
|
|
|
|
+
|
|
@PostConstruct
|
|
@PostConstruct
|
|
public void init() {
|
|
public void init() {
|
|
taskExecutor.submit(() -> {
|
|
taskExecutor.submit(() -> {
|
|
@@ -408,15 +410,7 @@ public class DeviceEventListener extends EventListener { //
|
|
*/
|
|
*/
|
|
@Subscribe
|
|
@Subscribe
|
|
public void onMessageEvent(OPCData opcData) {
|
|
public void onMessageEvent(OPCData opcData) {
|
|
- Object obj = opcData.getData();
|
|
|
|
- if (NumberUtils.isCreatable(obj.toString())) {
|
|
|
|
- String s = obj.toString().split("\\.")[0];
|
|
|
|
-// double value = ((Number) obj).doubleValue();
|
|
|
|
- //String formattedValue = String.format("%.2f", value);
|
|
|
|
- opcData.setData(Integer.parseInt(s));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ log.debug("subscribe info:{}",opcData);
|
|
//异步保存OPC数据
|
|
//异步保存OPC数据
|
|
taskExecutor.submit(() -> {
|
|
taskExecutor.submit(() -> {
|
|
opcDataService.save(opcData);
|
|
opcDataService.save(opcData);
|
|
@@ -687,9 +681,8 @@ public class DeviceEventListener extends EventListener { //
|
|
//出铁超时报警
|
|
//出铁超时报警
|
|
if ("1".equals(scheduleTappingTimeoutWarn.getStatus())) {
|
|
if ("1".equals(scheduleTappingTimeoutWarn.getStatus())) {
|
|
scheduledTaskManager.addTask(scheduleTappingTimeoutWarn.getName(), scheduleTappingTimeoutWarn.getDelay(), scheduleTappingTimeoutWarn.getPeriod(), TimeUnit.SECONDS, () -> {
|
|
scheduledTaskManager.addTask(scheduleTappingTimeoutWarn.getName(), scheduleTappingTimeoutWarn.getDelay(), scheduleTappingTimeoutWarn.getPeriod(), TimeUnit.SECONDS, () -> {
|
|
- int seconds = mSecondsElapsed.get();
|
|
|
|
// log.info("已出铁时间(秒):{},标准出铁时间(秒):{}", seconds, STANDARD_IRON_TIME.get());
|
|
// log.info("已出铁时间(秒):{},标准出铁时间(秒):{}", seconds, STANDARD_IRON_TIME.get());
|
|
- if (seconds > STANDARD_IRON_TIME.get()) {
|
|
|
|
|
|
+ if (getIronElapsedMinute() > STANDARD_IRON_TIME.get()) {
|
|
PushData.send2Warn(WarnData.warnTappingTimeout("出铁时间超时", tappingTimeoutAlramUrl));
|
|
PushData.send2Warn(WarnData.warnTappingTimeout("出铁时间超时", tappingTimeoutAlramUrl));
|
|
taskExecutor.submit(() -> {
|
|
taskExecutor.submit(() -> {
|
|
exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("2").exceptionDesc("出铁时间超过设定时间").build());
|
|
exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("2").exceptionDesc("出铁时间超过设定时间").build());
|
|
@@ -922,13 +915,18 @@ public class DeviceEventListener extends EventListener { //
|
|
RealtimeData ironWeight = new RealtimeData();
|
|
RealtimeData ironWeight = new RealtimeData();
|
|
ironWeight.setDesc("铁水流量");
|
|
ironWeight.setDesc("铁水流量");
|
|
ironWeight.setUnit("t");
|
|
ironWeight.setUnit("t");
|
|
- BigDecimal bigDecimalNew = new BigDecimal(opcData.getData().toString());
|
|
|
|
|
|
+ if(ObjectUtils.isEmpty(mIronOPCData) || !opcData.getData().equals(mIronOPCData.getData())){
|
|
|
|
+ mIronOPCData = opcData;
|
|
|
|
+ }
|
|
|
|
+ BigDecimal bigDecimalNew = new BigDecimal(mIronOPCData.getData().toString());
|
|
mTotalWeight = mTotalWeight.add(bigDecimalNew);
|
|
mTotalWeight = mTotalWeight.add(bigDecimalNew);
|
|
ironWeight.setValue(mTotalWeight);
|
|
ironWeight.setValue(mTotalWeight);
|
|
mRealtimeData.put(IRON_WEIGHT, ironWeight);
|
|
mRealtimeData.put(IRON_WEIGHT, ironWeight);
|
|
// log.info(">>>>>>>>>>>>>{}:{},total:{}", opcData.getPointName(), opcData.getData(), totalWeight.toPlainString());
|
|
// log.info(">>>>>>>>>>>>>{}:{},total:{}", opcData.getPointName(), opcData.getData(), totalWeight.toPlainString());
|
|
ironWeight.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
ironWeight.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
mContext.setVariable(ExpressionConstants.rtIronWeight, mTotalWeight.doubleValue());
|
|
mContext.setVariable(ExpressionConstants.rtIronWeight, mTotalWeight.doubleValue());
|
|
|
|
|
|
} else if (opcData.getPointName().contains(SubscribeTagConstants.TAG_FLUSH_STATUS(opcData.getServerType()))) {
|
|
} else if (opcData.getPointName().contains(SubscribeTagConstants.TAG_FLUSH_STATUS(opcData.getServerType()))) {
|
|
@@ -1265,7 +1263,7 @@ public class DeviceEventListener extends EventListener { //
|
|
if (null == validateClientOnline(client)) {
|
|
if (null == validateClientOnline(client)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- getIronTimeNo();
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/***
|
|
/***
|
|
@@ -1280,7 +1278,12 @@ public class DeviceEventListener extends EventListener { //
|
|
}
|
|
}
|
|
setStepResult(mSteps);
|
|
setStepResult(mSteps);
|
|
PushData.send2Operation(mSteps, ironLoading1.get());
|
|
PushData.send2Operation(mSteps, ironLoading1.get());
|
|
-
|
|
|
|
|
|
+ //推送实时数据
|
|
|
|
+ PushData.send2RealtimeData(mRealtimeData);
|
|
|
|
+ //推送实时状态
|
|
|
|
+ PushData.send2RealtimeStatus(mRealtimeStatus);
|
|
|
|
+ //获取出铁日期和次数
|
|
|
|
+ getIronTimeNo();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|