|
@@ -1,25 +1,29 @@
|
|
|
package com.sckj.iron.socketio;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.corundumstudio.socketio.SocketIOClient;
|
|
|
import com.corundumstudio.socketio.annotation.OnEvent;
|
|
|
import com.google.common.eventbus.Subscribe;
|
|
|
-import com.sckj.common.core.AjaxResult;
|
|
|
+import com.sckj.camera.util.LocalDateUtils;
|
|
|
import com.sckj.common.eventbus.EventListener;
|
|
|
+import com.sckj.common.manager.ScheduledTaskManager;
|
|
|
import com.sckj.common.socketio.SocketUtil;
|
|
|
import com.sckj.common.util.RedisUtils;
|
|
|
import com.sckj.iron.dto.IronStepDTO;
|
|
|
import com.sckj.iron.dto.RealtimeData;
|
|
|
-import com.sckj.iron.dto.TrendData;
|
|
|
+import com.sckj.iron.dto.WarnData;
|
|
|
import com.sckj.iron.entity.TIronData;
|
|
|
+import com.sckj.iron.entity.TIronParam;
|
|
|
import com.sckj.iron.entity.TL2Data;
|
|
|
+import com.sckj.iron.entity.TL2Material;
|
|
|
import com.sckj.iron.service.impl.*;
|
|
|
import com.sckj.iron.vo.IronStepVO;
|
|
|
import com.sckj.opc.dto.L2Data;
|
|
|
+import com.sckj.opc.dto.L2Material;
|
|
|
import com.sckj.opc.entity.OPCData;
|
|
|
import com.sckj.opc.opcua.L2DataServiceImpl;
|
|
|
import com.sckj.opc.service.OPCDataServiceImpl;
|
|
|
+import com.sckj.opc.utils.CustomUtil;
|
|
|
+import com.sckj.warn.service.ITExceptionLogService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -33,6 +37,11 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Author feng
|
|
@@ -67,48 +76,18 @@ public class DeviceEventListener extends EventListener {
|
|
|
@Resource
|
|
|
TL2DataServiceImpl tl2DataService;
|
|
|
|
|
|
+ //参数
|
|
|
@Resource
|
|
|
- private L2DataServiceImpl l2DataServiceImpl;
|
|
|
+ TL2MaterialServiceImpl tl2MaterialService;
|
|
|
|
|
|
@Resource
|
|
|
- OPCDataServiceImpl opcDataService;
|
|
|
-
|
|
|
- //实时数据
|
|
|
- Map<String, Object> mRealtimeData = new HashMap<>();
|
|
|
-
|
|
|
- //实时状态
|
|
|
- Map<String, Object> mRealtimeStatus = new HashMap<>();
|
|
|
-
|
|
|
+ L2DataServiceImpl l2DataServiceImpl;
|
|
|
|
|
|
@Resource
|
|
|
- TrendData trendData;
|
|
|
-
|
|
|
- //L1
|
|
|
- private OPCData mOPCData;
|
|
|
-
|
|
|
- //L2
|
|
|
- private L2Data mL2Data;
|
|
|
-
|
|
|
- // 1.创建表达式解析器
|
|
|
- private SpelExpressionParser parser = new SpelExpressionParser();
|
|
|
-
|
|
|
- // 2.创建变量上下文,设置变量
|
|
|
- private StandardEvaluationContext mContext = new StandardEvaluationContext();
|
|
|
-
|
|
|
- //出铁步骤
|
|
|
- private List<IronStepVO> mSteps;
|
|
|
-
|
|
|
- private static final String NODE = "node";
|
|
|
-
|
|
|
- //定时器,用于铁口开口超时记录
|
|
|
- private Timer timer = new Timer();
|
|
|
+ OPCDataServiceImpl opcDataService;
|
|
|
|
|
|
- //是否出铁中
|
|
|
- //1 出铁中 0 出铁结束
|
|
|
- private boolean ironLoading1 = false;
|
|
|
- private boolean ironLoading2 = false;
|
|
|
- private boolean ironLoading3 = false;
|
|
|
- private boolean ironLoading4 = false;
|
|
|
+ @Resource
|
|
|
+ ITExceptionLogService iTExceptionLogService;
|
|
|
|
|
|
//1号出铁状态标记
|
|
|
private static final String TAG_TAPHOLE1_STATUS = "AOD25606.PV";
|
|
@@ -130,16 +109,10 @@ public class DeviceEventListener extends EventListener {
|
|
|
private static final String TAG_IRON_WEIGHT12 = "WI5402.PV";
|
|
|
|
|
|
//预判和确认出铁
|
|
|
- private static final String ypqrct = "lnct";
|
|
|
+ private static final String STEP_YPQRCT = "lnct";
|
|
|
|
|
|
//铁量差计算
|
|
|
- private static final String tlc = "tlc";
|
|
|
-
|
|
|
- //最近任一铁口出铁结束时间
|
|
|
- private Date lastIronEndTimeRecently;
|
|
|
-
|
|
|
- @Resource(name = "taskExecutor")
|
|
|
- ThreadPoolTaskExecutor taskExecutor;
|
|
|
+ private static final String STEP_TLC = "tlc";
|
|
|
|
|
|
//铁水成分
|
|
|
public static final String IRON_ELEMENT = "ironElement";
|
|
@@ -151,6 +124,8 @@ public class DeviceEventListener extends EventListener {
|
|
|
public static final String IRON_WEIGHT = "ironWeight";
|
|
|
//出铁状态
|
|
|
private static final String IRON_STATUS = "ironStatus";
|
|
|
+ //总干量
|
|
|
+ private static final String IRON_TOTAL_DRY = "ironTotalDry";
|
|
|
|
|
|
//鱼雷罐车
|
|
|
private static final String CAR_STATUS = "ylgc";
|
|
@@ -159,14 +134,102 @@ public class DeviceEventListener extends EventListener {
|
|
|
//摆动溜咀
|
|
|
private static final String MOUTH_STATUS = "bdlz";
|
|
|
//冲渣状态
|
|
|
- private static final String FLUSH_STATUS = "flushStatus";
|
|
|
- //预计出铁结束时间
|
|
|
- private static final String PLAN_END_TIME = "planEndTime";
|
|
|
+ private static final String FLUSH_STATUS = "AOD25607.PV";
|
|
|
+
|
|
|
+ // 1.创建表达式解析器
|
|
|
+ private SpelExpressionParser parser = new SpelExpressionParser();
|
|
|
+
|
|
|
+ // 2.创建变量上下文,设置变量
|
|
|
+ private StandardEvaluationContext mContext = new StandardEvaluationContext();
|
|
|
+
|
|
|
+ //定时器
|
|
|
+ @Resource
|
|
|
+ private ScheduledTaskManager scheduledTaskManager;
|
|
|
+
|
|
|
+ //多任务
|
|
|
+ @Resource(name = "taskExecutor")
|
|
|
+ ThreadPoolTaskExecutor taskExecutor;
|
|
|
+
|
|
|
+ //开口预警
|
|
|
+ public static final String TASKNAME_OPEN_WARN = "open_warn";
|
|
|
+ //堵口预警,出铁xxx分钟开始
|
|
|
+ public static final String TASKNAME_CLOSE_WARN = "close_warn";
|
|
|
+ //出铁预警
|
|
|
+ public static final String TASKNAME_TAPPING_WARN = "tapping_warn";
|
|
|
+ //出铁诊断,出铁结束后xxx分钟开始
|
|
|
+ private static final String TASKNAME_TAPPING_TEST = "tapping_test";
|
|
|
+ //打泥量预计
|
|
|
+ private static final String TASKNAME_HIT_MUD = "hit_mud";
|
|
|
+ //出铁计时
|
|
|
+ private static final String TASKNAME_TAPPING_CONSTTIME = "tapping_consttime";
|
|
|
+
|
|
|
+ //铁口出铁状态
|
|
|
+ //1 出铁中 0 出铁结束
|
|
|
+ private AtomicBoolean ironLoading1 = new AtomicBoolean(false);
|
|
|
+ //
|
|
|
+ private AtomicBoolean ironLoading2 = new AtomicBoolean(false);
|
|
|
+ //
|
|
|
+ private AtomicBoolean ironLoading3 = new AtomicBoolean(false);
|
|
|
+ //
|
|
|
+ private AtomicBoolean ironLoading4 = new AtomicBoolean(false);
|
|
|
+
|
|
|
+ //出铁步骤
|
|
|
+ private List<IronStepVO> mSteps;
|
|
|
+
|
|
|
+ //出铁参数
|
|
|
+ private Map<String, TIronParam> mIronParamMap;
|
|
|
+
|
|
|
+ //节点标记
|
|
|
+ private static final String NODE = "node";
|
|
|
+
|
|
|
+ //实时数据
|
|
|
+ Map<String, Object> mRealtimeData = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ //实时状态
|
|
|
+ Map<String, Object> mRealtimeStatus = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ //最近任一铁口出铁结束时间
|
|
|
+ private Date mIronEndTimeRecently;
|
|
|
+
|
|
|
+ private BigDecimal speed1 = BigDecimal.ZERO;
|
|
|
+
|
|
|
+ private BigDecimal speed2 = BigDecimal.ZERO;
|
|
|
+
|
|
|
+ //标准流速
|
|
|
+ private BigDecimal STANDARD_SPEED;
|
|
|
|
|
|
+ //压差阈值
|
|
|
+ private BigDecimal PRESSURE_DIFF_VALUE;
|
|
|
+
|
|
|
+ //实时出铁总重量/总流量
|
|
|
+ private BigDecimal mTotalWeight = BigDecimal.ZERO;
|
|
|
+ //总干量
|
|
|
+ private BigDecimal mTotalDry = BigDecimal.ZERO;
|
|
|
+ //耗时(单位:s)
|
|
|
+ private AtomicInteger mSecondsElapsed = new AtomicInteger(0);
|
|
|
+
|
|
|
+ //redis保存最多数量数据
|
|
|
+ private static final int MAX_REDIS_COUNT = 50;
|
|
|
|
|
|
@PostConstruct
|
|
|
public void init() {
|
|
|
+ //程序启动后隔断时间启动订阅
|
|
|
+ scheduledTaskManager.addTask("opcsubscribe", 0, 15, TimeUnit.SECONDS, () -> {
|
|
|
+ log.info("opcdaService subscribe available");
|
|
|
+// opcdaService.subscribeAvailable();
|
|
|
+ scheduledTaskManager.cancelTask("opcsubscribe");
|
|
|
+ });
|
|
|
+
|
|
|
mSteps = ironStepService.getTreeSteps();
|
|
|
+ List<TIronParam> mIronParams = ironParamService.lambdaQuery().eq(TIronParam::getStatus, "1").eq(TIronParam::getParamType, "iron_judge").orderByAsc(TIronParam::getSort).list();
|
|
|
+ if (ObjectUtils.isNotEmpty(mIronParams)) {
|
|
|
+ mIronParamMap = mIronParams.stream()
|
|
|
+ .collect(Collectors.toMap(TIronParam::getParamName, ironParam -> ironParam, (existing, replacement) -> existing));
|
|
|
+ STANDARD_SPEED = new BigDecimal(mIronParamMap.get("iron_speed").getParamValue());
|
|
|
+ PRESSURE_DIFF_VALUE = new BigDecimal(mIronParamMap.get("pressure_diff_value").getParamValue());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/***
|
|
@@ -175,20 +238,17 @@ public class DeviceEventListener extends EventListener {
|
|
|
*/
|
|
|
@Subscribe
|
|
|
public void onMessageEvent(OPCData opcData) {
|
|
|
- if (SocketUtil.clientUserIds.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.mOPCData = opcData;
|
|
|
//异步保存OPC数据
|
|
|
- taskExecutor.submit(() -> opcDataService.save(mOPCData));
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ opcDataService.save(opcData);
|
|
|
+ });
|
|
|
//出铁操作
|
|
|
- operate();
|
|
|
-
|
|
|
- //趋势数据
|
|
|
- trenddata();
|
|
|
+ taskExecutor.submit(() -> operate(opcData));
|
|
|
|
|
|
//实时数据
|
|
|
- realtime();
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ setRealtimeDataAndStatus(opcData, null);
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
|
|
@@ -197,111 +257,268 @@ public class DeviceEventListener extends EventListener {
|
|
|
* @param l2Data
|
|
|
*/
|
|
|
@Subscribe
|
|
|
- public void onL2MessageEvent(L2Data l2Data) {
|
|
|
- if (SocketUtil.clientUserIds.isEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.mL2Data = l2Data;
|
|
|
- realtime();
|
|
|
-
|
|
|
+ public void onL2DataMessageEvent(L2Data l2Data) {
|
|
|
TL2Data tl2Data = new TL2Data();
|
|
|
//出铁操作
|
|
|
BeanUtils.copyProperties(l2Data, tl2Data);
|
|
|
-
|
|
|
//将L2实时数据保存到数据库
|
|
|
- tl2DataService.saveOrUpdate(tl2Data);
|
|
|
-
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ tl2DataService.saveOrUpdate(tl2Data);
|
|
|
+ });
|
|
|
//将L2实时数据保存到Redis
|
|
|
- RedisUtils.addFixedElement(IRON_ELEMENT, l2Data, 6);
|
|
|
-
|
|
|
- for (IronStepVO stepDTO : mSteps) {
|
|
|
- if (NODE.equalsIgnoreCase(stepDTO.getNodeType())) {
|
|
|
- //处理子项
|
|
|
- for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
- if (tlc.equals(child.getIdentifier())) {
|
|
|
- List<TL2Data> latest2Data = tl2DataService.getLatest2Data();
|
|
|
- if (latest2Data.size() >= 2) {
|
|
|
- HashMap[] hashMaps = new HashMap[6];
|
|
|
- child.setExtraInfo(hashMaps);
|
|
|
- //理论出铁量 = 矿批 × 综合品位 × 1.06
|
|
|
- //铁量差 = 理论出铁量 - 实际出铁量
|
|
|
- TL2Data tl2Data1Last = latest2Data.get(0);
|
|
|
- double llLast = tl2Data1Last.getTotalDry() * 1.0 * 1.06;
|
|
|
- double ironWeightLast = tl2Data1Last.getIronWeight();
|
|
|
- double tlcLast = llLast - ironWeightLast;
|
|
|
-
|
|
|
- TL2Data tl2Data1LastLast = latest2Data.get(1);
|
|
|
- double llLastLast = tl2Data1LastLast.getTotalDry() * 1.0 * 1.06;
|
|
|
- double ironWeightLastLast = tl2Data1Last.getIronWeight();
|
|
|
- double tlcLastLast = llLastLast - ironWeightLastLast;
|
|
|
-
|
|
|
- //铁量差在合理范围内
|
|
|
- // 上一次铁量差:-30 上上次铁量差:20 t
|
|
|
- // 理论出铁量:1500 t 理论出铁量:1400 t
|
|
|
- // 实际出铁量:1530 t 实际出铁量: 1380 t
|
|
|
- final String sctlc = "sctlc";
|
|
|
- final String ssctlc = "ssctlc";
|
|
|
- final String scll = "scll";
|
|
|
- final String sscll = "sscll";
|
|
|
- final String scsj = "scsj";
|
|
|
- final String sscsj = "sscsj";
|
|
|
-
|
|
|
- //child.setPassResult(1);
|
|
|
- for (IronStepVO childChild : child.getChilds()) {
|
|
|
- if (sctlc.equals(childChild.getIdentifier())) {
|
|
|
- childChild.setData(tlcLast);
|
|
|
- } else if (ssctlc.equals(childChild.getIdentifier())) {
|
|
|
- childChild.setData(tlcLastLast);
|
|
|
- } else if (scll.equals(childChild.getIdentifier())) {
|
|
|
- childChild.setData(llLast);
|
|
|
- } else if (sscll.equals(childChild.getIdentifier())) {
|
|
|
- childChild.setData(llLastLast);
|
|
|
- } else if (scsj.equals(childChild.getIdentifier())) {
|
|
|
- childChild.setData(ironWeightLast);
|
|
|
- } else if (sscsj.equals(childChild.getIdentifier())) {
|
|
|
- childChild.setData(ironWeightLastLast);
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ RedisUtils.addFixedElement(IRON_ELEMENT, l2Data, MAX_REDIS_COUNT);
|
|
|
+ PushData.send2TrendIronElement(RedisUtils.getFixedElement(IRON_ELEMENT));
|
|
|
+ });
|
|
|
+
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ setRealtimeDataAndStatus(null, l2Data);
|
|
|
+ });
|
|
|
+
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+
|
|
|
+ for (IronStepVO stepDTO : mSteps) {
|
|
|
+ if (NODE.equalsIgnoreCase(stepDTO.getNodeType())) {
|
|
|
+ //处理子项
|
|
|
+ for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
+ if (STEP_TLC.equals(child.getIdentifier())) {
|
|
|
+ List<TL2Data> latest2Data = tl2DataService.getLatest2Data();
|
|
|
+ if (latest2Data.size() >= 2) {
|
|
|
+ HashMap[] hashMaps = new HashMap[6];
|
|
|
+ child.setExtraInfo(hashMaps);
|
|
|
+ //理论出铁量 = 矿批 × 综合品位 × 1.06
|
|
|
+ //铁量差 = 理论出铁量 - 实际出铁量
|
|
|
+ TL2Data tl2Data1Last = latest2Data.get(0);
|
|
|
+ double llLast = tl2Data1Last.getTotalDry() * 1.0 * 1.06;
|
|
|
+ double ironWeightLast = tl2Data1Last.getIronWeight();
|
|
|
+ double tlcLast = llLast - ironWeightLast;
|
|
|
+
|
|
|
+ TL2Data tl2Data1LastLast = latest2Data.get(1);
|
|
|
+ double llLastLast = tl2Data1LastLast.getTotalDry() * 1.0 * 1.06;
|
|
|
+ double ironWeightLastLast = tl2Data1Last.getIronWeight();
|
|
|
+ double tlcLastLast = llLastLast - ironWeightLastLast;
|
|
|
+
|
|
|
+ //铁量差在合理范围内
|
|
|
+ // 上一次铁量差:-30 上上次铁量差:20 t
|
|
|
+ // 理论出铁量:1500 t 理论出铁量:1400 t
|
|
|
+ // 实际出铁量:1530 t 实际出铁量: 1380 t
|
|
|
+ final String sctlc = "sctlc";
|
|
|
+ final String ssctlc = "ssctlc";
|
|
|
+ final String scll = "scll";
|
|
|
+ final String sscll = "sscll";
|
|
|
+ final String scsj = "scsj";
|
|
|
+ final String sscsj = "sscsj";
|
|
|
+
|
|
|
+ //child.setPassResult(1);
|
|
|
+ for (IronStepVO childChild : child.getChilds()) {
|
|
|
+ if (sctlc.equals(childChild.getIdentifier())) {
|
|
|
+ childChild.setData(tlcLast);
|
|
|
+ } else if (ssctlc.equals(childChild.getIdentifier())) {
|
|
|
+ childChild.setData(tlcLastLast);
|
|
|
+ } else if (scll.equals(childChild.getIdentifier())) {
|
|
|
+ childChild.setData(llLast);
|
|
|
+ } else if (sscll.equals(childChild.getIdentifier())) {
|
|
|
+ childChild.setData(llLastLast);
|
|
|
+ } else if (scsj.equals(childChild.getIdentifier())) {
|
|
|
+ childChild.setData(ironWeightLast);
|
|
|
+ } else if (sscsj.equals(childChild.getIdentifier())) {
|
|
|
+ childChild.setData(ironWeightLastLast);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ setStepResult(mSteps);
|
|
|
+ PushData.send2Operation(mSteps, ironLoading1.get());
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Subscribe
|
|
|
+ public void onL2MaterialMessageEvent(L2Material l2Material) {
|
|
|
+ TL2Material tl2Material = new TL2Material();
|
|
|
+ //出铁操作
|
|
|
+ BeanUtils.copyProperties(l2Material, tl2Material);
|
|
|
+ //将L2上料实时数据保存到数据库
|
|
|
+ taskExecutor.submit(() -> {
|
|
|
+ tl2MaterialService.saveOrUpdate(tl2Material);
|
|
|
+ });
|
|
|
+
|
|
|
+ if (ironLoading1.get()) {
|
|
|
+ BigDecimal bigDecimalNew = new BigDecimal(l2Material.getDryWeight());
|
|
|
+ mTotalDry = mTotalDry.add(bigDecimalNew);
|
|
|
+ } else {
|
|
|
+ mTotalDry = BigDecimal.ZERO;
|
|
|
}
|
|
|
- setStepResult(mSteps);
|
|
|
+
|
|
|
+ RedisUtils.addFixedElement(IRON_TOTAL_DRY, mTotalDry, MAX_REDIS_COUNT);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ //1号铁口正在出铁的操作项目
|
|
|
+ private void taphole1Start(L2Data mL2Data) {
|
|
|
+ //通过“预判和确认出铁”标记开始出铁
|
|
|
+ boolean isReady = false;
|
|
|
+
|
|
|
+ for (IronStepVO stepDTO : mSteps) {
|
|
|
+ if (STEP_YPQRCT.equalsIgnoreCase(stepDTO.getIdentifier()) && 1 == stepDTO.getPassResult()) {
|
|
|
+ isReady = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //趋势数据
|
|
|
- private void trenddata() {
|
|
|
+ //炉前在接受到炉内出铁要求后,10分钟内打开铁口,未打开系统告警并记录
|
|
|
+// if (isReady) {
|
|
|
+// scheduledTaskManager.addTask(TASKNAME_OPEN_WARN, 0, OPEND_HOUR, TimeUnit.MINUTES, () -> {
|
|
|
+// log.info("堵口预警:{}", TASKNAME_OPEN_WARN);
|
|
|
+//
|
|
|
+// System.out.println("倒计时结束!10分钟已到。");
|
|
|
+// // 出铁预警,打开系统告警并记录
|
|
|
+// PushData.send2Warn("请立即打开铁口");
|
|
|
+// log.info("准备出铁但是未及时出铁口,此处数据库记录");
|
|
|
+// scheduledTaskManager.cancelTask(TASKNAME_OPEN_WARN); // 终止定时器
|
|
|
+// });
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ //由 0 -> 1 表明1号铁口开始出铁
|
|
|
+ //
|
|
|
+ //根据理论铁量、实时铁水流速,推测距离出铁结束的剩余时间
|
|
|
+// Date ironTime = mOPCData.getServerTime();
|
|
|
+// lastIronEndTimeRecently
|
|
|
+ //获取总干量
|
|
|
+ BigDecimal totalDry = new BigDecimal(ObjectUtils.defaultIfNull(mL2Data.getTotalDry(), "0"));
|
|
|
+ //计算出理论铁量
|
|
|
+ BigDecimal multiply = totalDry.multiply(new BigDecimal(1.0)).multiply(new BigDecimal(1.0));
|
|
|
//
|
|
|
+// float totalSpeed = speed1.add(speed2);
|
|
|
+// if (totalSpeed > 0) {
|
|
|
+// //理论时间
|
|
|
+// BigDecimal divide = multiply.divide(new BigDecimal(totalSpeed), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
+// String plainString = divide.toPlainString();
|
|
|
+// log.info("理论出铁时间:{}min", plainString);
|
|
|
+// }
|
|
|
+
|
|
|
+ //堵口预警
|
|
|
+ scheduledTaskManager.addTask(TASKNAME_CLOSE_WARN, 0, 1, TimeUnit.MINUTES, () -> {
|
|
|
+ //堵口预警
|
|
|
+ log.info("堵口预警:{},speed1:{},speed2:{},STANDARD_SPEED:{}", speed1, speed2, TASKNAME_CLOSE_WARN);
|
|
|
+ if (speed1.compareTo(STANDARD_SPEED) > 0 || speed2.compareTo(STANDARD_SPEED) > 0) {
|
|
|
+ //流速过大可能是由于铁口深度不足或发生跑大流问题,则提示将当前铁口堵口
|
|
|
+ PushData.send2Warn(WarnData.warnClose("流速过快,请将当前铁口堵口"));
|
|
|
+ } else if ((speed1.compareTo(STANDARD_SPEED) < 0 || speed2.compareTo(STANDARD_SPEED) < 0) && (ironLoading2.get() || ironLoading3.get() || ironLoading4.get())) {
|
|
|
+ //若流速过小,但其它铁口正在出铁,则提示将当前铁口堵口
|
|
|
+ PushData.send2Warn(WarnData.warnClose("流速过小,请将当前铁口堵口"));
|
|
|
+ } else if ((speed1.compareTo(STANDARD_SPEED) < 0 || speed2.compareTo(STANDARD_SPEED) < 0) && (!ironLoading2.get() && !ironLoading3.get() && !ironLoading4.get())) {
|
|
|
+ //若流速过小且其他铁口均未出铁,则提示先将其它铁口打开,再进行堵口
|
|
|
+ PushData.send2Warn(WarnData.warnClose("请先打开其它铁口,再堵口"));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //开始计算打泥量,通过打泥量公式
|
|
|
+ //打泥量公式关联因素:铁口深度、钻杆直径、
|
|
|
+ //调用打泥量模型,计算预计使用多少打泥量进行堵口
|
|
|
+ scheduledTaskManager.addTask(TASKNAME_HIT_MUD, 0, 30, TimeUnit.SECONDS, () -> {
|
|
|
+ log.info("堵口预警:{},speed1:{},speed2:{},STANDARD_SPEED:{}", speed1, speed2, TASKNAME_HIT_MUD);
|
|
|
+ String dryString = totalDry.toPlainString();
|
|
|
+ //
|
|
|
+ //堵口预警
|
|
|
+ //计算理论铁量= 矿批 × 综合品位 × 1.06,其中矿批是指L2中的干量
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_HIT_MUD);
|
|
|
+ });
|
|
|
+
|
|
|
+ //出铁计时
|
|
|
+ scheduledTaskManager.addTask(TASKNAME_TAPPING_CONSTTIME, 0, 1, TimeUnit.SECONDS, () -> {
|
|
|
+ int totalSeconds = mSecondsElapsed.get();
|
|
|
+ int hours = totalSeconds / 3600;
|
|
|
+ int minutes = (totalSeconds % 3600) / 60;
|
|
|
+ int seconds = totalSeconds % 60;
|
|
|
+ String elapsedTime = String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
|
|
+ log.info("elapsedTime:{}", elapsedTime);
|
|
|
+ RedisUtils.addFixedElement(TASKNAME_TAPPING_CONSTTIME, elapsedTime, MAX_REDIS_COUNT);
|
|
|
+ PushData.send2CostTime(elapsedTime);
|
|
|
+ mSecondsElapsed.incrementAndGet();
|
|
|
+ });
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //1号铁口结束出铁的操作项目
|
|
|
+ private void taphole1End() {
|
|
|
+ //由 1-> 0 表明1号铁口结束出铁
|
|
|
+ mTotalWeight = BigDecimal.ZERO;
|
|
|
+ mTotalDry = BigDecimal.ZERO;
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_OPEN_WARN);
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_CLOSE_WARN);
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_TAPPING_WARN);
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_HIT_MUD);
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_TAPPING_CONSTTIME);
|
|
|
+ mSecondsElapsed.set(0);
|
|
|
+
|
|
|
+ recordAfter();
|
|
|
+ recordBlock();
|
|
|
+
|
|
|
+ //开始出铁诊断
|
|
|
+ //获取开口耗时、出铁时间、实际出铁量、平均铁水流速、平均铁水温度等数据,进行阈值判定,诊断出铁是否正常
|
|
|
+ //xxx分钟延迟
|
|
|
+ scheduledTaskManager.addTask(TASKNAME_TAPPING_TEST, 0, 3, TimeUnit.SECONDS, () -> {
|
|
|
+ //堵口预警
|
|
|
+ log.info("定时任务:{},出铁诊断", TASKNAME_TAPPING_TEST);
|
|
|
+ L2Data fixedLatestElement = (L2Data) RedisUtils.getFixedLatestElement(IRON_ELEMENT);
|
|
|
+ //平均温度
|
|
|
+ String mudWeight = fixedLatestElement.getAvgTemp();
|
|
|
+ //出铁时间
|
|
|
+ String ironCosttime = fixedLatestElement.getIronCosttime();
|
|
|
+ //实际出铁量
|
|
|
+ String ironWeight = fixedLatestElement.getIronWeight();
|
|
|
+
|
|
|
+ TIronData ironData = new TIronData();
|
|
|
+ BeanUtils.copyProperties(ironData, fixedLatestElement);
|
|
|
+
|
|
|
+ ironDataService.save(ironData);
|
|
|
+
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_TAPPING_TEST);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
- //实时数据显示
|
|
|
- private void realtime() {
|
|
|
+ //出铁后,记录炉次、开口时间、鱼雷罐车车号、铁口深度、铁水流速
|
|
|
+ private void recordAfter() {
|
|
|
+ ironAfterService.add(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ //堵口后,记录堵口时间、出铁量,打泥量、是否喷溅、是否跑泥
|
|
|
+ private void recordBlock() {
|
|
|
+ ironBlockService.add(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /***
|
|
|
+ * 设置实时数据值和状态
|
|
|
+ */
|
|
|
+ private synchronized void setRealtimeDataAndStatus(OPCData opcData, L2Data l2Data) {
|
|
|
//铁水温度
|
|
|
//铁水流速
|
|
|
//铁水成分
|
|
|
//铁水流量
|
|
|
//WI5401.PV 1TH-1号车总重
|
|
|
//WI5402.PV 1TH-2号车TPC总重
|
|
|
- if (ObjectUtils.isNotEmpty(mOPCData)) {
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_TEMP)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(opcData)) {
|
|
|
+ if (opcData.getPointName().contains(TAG_IRON_TEMP)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData());
|
|
|
+ realtimeData.setValue(opcData.getData());
|
|
|
realtimeData.setUnit("℃");
|
|
|
realtimeData.setDesc("铁水温度");
|
|
|
- realtimeData.setTime(mOPCData.getServerTime().toString());
|
|
|
+ realtimeData.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
mRealtimeData.put(IRON_TEMP, realtimeData);
|
|
|
//redis添加数据
|
|
|
- RedisUtils.addFixedElement(IRON_TEMP, realtimeData, 6);
|
|
|
- }
|
|
|
-
|
|
|
- if (mOPCData.getPointName().contains(TAG_CAR11) || mOPCData.getPointName().contains(TAG_CAR12)) {
|
|
|
+ RedisUtils.addFixedElement(IRON_TEMP, realtimeData, MAX_REDIS_COUNT);
|
|
|
+ PushData.send2TrendIronTemp(RedisUtils.getFixedElement(IRON_TEMP));
|
|
|
+ } else if (opcData.getPointName().contains(TAG_CAR11) || opcData.getPointName().contains(TAG_CAR12)) {
|
|
|
// 1TH-1号车受铁速度
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData());
|
|
|
+ realtimeData.setValue(opcData.getData());
|
|
|
realtimeData.setUnit("t/s");
|
|
|
|
|
|
RealtimeData ironSpeed = (RealtimeData) mRealtimeData.get(IRON_SPEED);
|
|
@@ -316,12 +533,14 @@ public class DeviceEventListener extends EventListener {
|
|
|
speeds = (RealtimeData[]) ironSpeed.getValue();
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(TAG_CAR11)) {
|
|
|
+ if (opcData.getPointName().contains(TAG_CAR11)) {
|
|
|
realtimeData.setDesc("1号车");
|
|
|
speeds[0] = realtimeData;
|
|
|
+ speed1 = new BigDecimal(opcData.getData().toString());
|
|
|
} else {
|
|
|
realtimeData.setDesc("2号车");
|
|
|
speeds[1] = realtimeData;
|
|
|
+ speed2 = new BigDecimal(opcData.getData().toString());
|
|
|
}
|
|
|
|
|
|
//只在两个都有数据的时候才添加
|
|
@@ -329,93 +548,82 @@ public class DeviceEventListener extends EventListener {
|
|
|
&& ObjectUtils.isNotEmpty(speeds[0]) && ObjectUtils.isNotEmpty(speeds[0].getValue())
|
|
|
&& ObjectUtils.isNotEmpty(speeds[1]) && ObjectUtils.isNotEmpty(speeds[1].getValue())
|
|
|
) {
|
|
|
- ironSpeed.setTime(mOPCData.getServerTime().toString());
|
|
|
- RedisUtils.addFixedElement(IRON_SPEED, ironSpeed, 6);
|
|
|
+ ironSpeed.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
+ RedisUtils.addFixedElement(IRON_SPEED, ironSpeed, MAX_REDIS_COUNT);
|
|
|
+ PushData.send2TrendIronSpeed(RedisUtils.getFixedElement(IRON_SPEED));
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_WEIGHT11) || mOPCData.getPointName().contains(TAG_IRON_WEIGHT12)) {
|
|
|
-// 铁水流量
|
|
|
- RealtimeData ironWeight = (RealtimeData) mRealtimeData.get(IRON_WEIGHT);
|
|
|
- if (ObjectUtils.isEmpty(ironWeight)) {
|
|
|
- ironWeight = new RealtimeData();
|
|
|
- ironWeight.setDesc("铁水流量");
|
|
|
- ironWeight.setUnit("t");
|
|
|
- ironWeight.setValue(new BigDecimal(String.valueOf(mOPCData.getData())));
|
|
|
- mRealtimeData.put(IRON_WEIGHT, ironWeight);
|
|
|
-
|
|
|
- ironWeight.setTime(mOPCData.getServerTime().toString());
|
|
|
- RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, 6);
|
|
|
- } else {
|
|
|
- BigDecimal bigDecimalOld = ((BigDecimal) ironWeight.getValue());
|
|
|
- BigDecimal bigDecimalNew = new BigDecimal(mOPCData.getData().toString());
|
|
|
- BigDecimal add = bigDecimalOld.add(bigDecimalNew);
|
|
|
- ironWeight.setValue(add);
|
|
|
-
|
|
|
- ironWeight.setTime(mOPCData.getServerTime().toString());
|
|
|
- RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, 6);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
|
|
|
+ } else if (opcData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData());
|
|
|
+ realtimeData.setValue(opcData.getData());
|
|
|
realtimeData.setDesc("出铁状态");
|
|
|
mRealtimeStatus.put(IRON_STATUS, realtimeData);
|
|
|
- }
|
|
|
|
|
|
-// if (mOPCData.getPointName().contains(CAR_STATUS)) {
|
|
|
-// RealtimeData realtimeData = new RealtimeData();
|
|
|
-// realtimeData.setValue(mOPCData.getData());
|
|
|
-// realtimeData.setDesc("鱼雷罐车到位状态");
|
|
|
-// mRealtimeDataMap.put(CAR_STATUS, realtimeData);
|
|
|
-// }
|
|
|
+ ironLoading1.set("1".equals(opcData.getData().toString()));
|
|
|
|
|
|
+ if (ironLoading1.get()) {
|
|
|
+ taphole1Start(l2Data);
|
|
|
+ } else {
|
|
|
+ taphole1End();
|
|
|
+ }
|
|
|
|
|
|
-// if (mOPCData.getPointName().contains(TAG_IRON_STATUS1)) {
|
|
|
-// RealtimeData realtimeData = new RealtimeData();
|
|
|
-// realtimeData.setValue(mOPCData.getData());
|
|
|
-// realtimeData.setDesc("拔炮状态");
|
|
|
-// mRealtimeDataMap.put(GUN_STATUS, realtimeData);
|
|
|
-// }
|
|
|
-//
|
|
|
-//
|
|
|
-// if (mOPCData.getPointName().contains(TAG_IRON_STATUS1)) {
|
|
|
-// RealtimeData realtimeData = new RealtimeData();
|
|
|
-// realtimeData.setValue(mOPCData.getData());
|
|
|
-// realtimeData.setDesc("摆动溜咀");
|
|
|
-// mRealtimeDataMap.put(MOUTH_STATUS, realtimeData);
|
|
|
-// }
|
|
|
-
|
|
|
- if (mOPCData.getPointName().contains(FLUSH_STATUS)) {
|
|
|
+ } else if (opcData.getPointName().contains(TAG_TAPHOLE2_STATUS)) {
|
|
|
+ ironLoading2.set("1".equals(opcData.getData().toString()));
|
|
|
+ if (ironLoading2.get()) {
|
|
|
+ mIronEndTimeRecently = opcData.getServerTime();
|
|
|
+ }
|
|
|
+ } else if (opcData.getPointName().contains(TAG_TAPHOLE3_STATUS)) {
|
|
|
+ ironLoading3.set("1".equals(opcData.getData().toString()));
|
|
|
+ if (ironLoading3.get()) {
|
|
|
+ mIronEndTimeRecently = opcData.getServerTime();
|
|
|
+ }
|
|
|
+ } else if (opcData.getPointName().contains(TAG_TAPHOLE4_STATUS)) {
|
|
|
+ ironLoading4.set("1".equals(opcData.getData().toString()));
|
|
|
+ if (!ironLoading4.get()) {
|
|
|
+ mIronEndTimeRecently = opcData.getServerTime();
|
|
|
+ }
|
|
|
+ } else if (opcData.getPointName().contains(TAG_IRON_WEIGHT11) || opcData.getPointName().contains(TAG_IRON_WEIGHT12)) {
|
|
|
+ //铁水流量
|
|
|
+ RealtimeData ironWeight = new RealtimeData();
|
|
|
+ ironWeight.setDesc("铁水流量");
|
|
|
+ ironWeight.setUnit("t");
|
|
|
+ BigDecimal bigDecimalNew = new BigDecimal(opcData.getData().toString());
|
|
|
+ mTotalWeight = mTotalWeight.add(bigDecimalNew);
|
|
|
+ ironWeight.setValue(mTotalWeight);
|
|
|
+ mRealtimeData.put(IRON_WEIGHT, ironWeight);
|
|
|
+// log.info(">>>>>>>>>>>>>{}:{},total:{}", opcData.getPointName(), opcData.getData(), totalWeight.toPlainString());
|
|
|
+
|
|
|
+ ironWeight.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
+ RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, MAX_REDIS_COUNT);
|
|
|
+ PushData.send2TrendIronWeight(RedisUtils.getFixedElement(IRON_WEIGHT));
|
|
|
+
|
|
|
+ } else if (opcData.getPointName().contains(FLUSH_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData());
|
|
|
+ realtimeData.setValue(opcData.getData());
|
|
|
realtimeData.setDesc("冲渣状态");
|
|
|
mRealtimeStatus.put(FLUSH_STATUS, realtimeData);
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(PLAN_END_TIME)) {
|
|
|
- RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData());
|
|
|
- realtimeData.setDesc("预计出铁结束时间");
|
|
|
- mRealtimeData.put(PLAN_END_TIME, realtimeData);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- float yc = Float.valueOf(ObjectUtils.defaultIfNull(mContext.lookupVariable("yc"), "0").toString());
|
|
|
- if (yc > 190) {
|
|
|
- log.info("预警出铁");
|
|
|
- PushData.send2Warn(AjaxResult.success("预警出铁"));
|
|
|
+ BigDecimal yc = new BigDecimal(ObjectUtils.defaultIfNull(mContext.lookupVariable("yc"), "0").toString());
|
|
|
+ if (PRESSURE_DIFF_VALUE.compareTo(yc) < 0) {
|
|
|
+ //xxx分钟延迟
|
|
|
+ scheduledTaskManager.addTask(TASKNAME_TAPPING_WARN, 0, 3, TimeUnit.SECONDS, () -> {
|
|
|
+ //堵口预警
|
|
|
+ log.info("出铁预警:{}", TASKNAME_TAPPING_WARN);
|
|
|
+ PushData.send2Warn(WarnData.warnTapping("压差超过阈值,请出铁"));
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_TAPPING_WARN);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(mL2Data)) {
|
|
|
+ if (ObjectUtils.isNotEmpty(l2Data)) {
|
|
|
//铁水成分
|
|
|
//预计出铁结束时间
|
|
|
- String elementSi = mL2Data.getElementSi();
|
|
|
- String elementS = mL2Data.getElementS();
|
|
|
+ String elementSi = l2Data.getElementSi();
|
|
|
+ String elementS = l2Data.getElementS();
|
|
|
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
realtimeData.setValue(elementSi);
|
|
@@ -433,7 +641,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
RealtimeData realtimeData3 = new RealtimeData();
|
|
|
realtimeData3.setValue(realtimeDataList);
|
|
|
- realtimeData3.setDesc("铁水成分");
|
|
|
+ realtimeData3.setDesc("铁水成分(最近批次)");
|
|
|
|
|
|
mRealtimeData.put(IRON_ELEMENT, realtimeData3);
|
|
|
}
|
|
@@ -445,11 +653,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private void operate() {
|
|
|
- if (ObjectUtils.isEmpty(mOPCData)) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ private synchronized void operate(OPCData mOPCData) {
|
|
|
String pointName = mOPCData.getPointName();
|
|
|
Object data = mOPCData.getData();
|
|
|
for (IronStepVO stepDTO : mSteps) {
|
|
@@ -465,13 +669,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
if (ObjectUtils.isEmpty(newPointName)) {
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- if (newPointName.contains(".")) {
|
|
|
- newPointName = "channel." + newPointName;
|
|
|
- } else {
|
|
|
- newPointName = "channel.device." + newPointName;
|
|
|
- }
|
|
|
-
|
|
|
+ newPointName = CustomUtil.createNewPointName(newPointName);
|
|
|
if (Objects.equals(newPointName, pointName)) {
|
|
|
//3.创建变量上下文,设置变量
|
|
|
childchild.setData(data);
|
|
@@ -481,11 +679,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
if (ObjectUtils.isEmpty(newPointName)) {
|
|
|
continue;
|
|
|
}
|
|
|
- if (newPointName.contains(".")) {
|
|
|
- newPointName = "channel." + newPointName;
|
|
|
- } else {
|
|
|
- newPointName = "channel.device." + newPointName;
|
|
|
- }
|
|
|
+ newPointName = CustomUtil.createNewPointName(newPointName);
|
|
|
if (Objects.equals(newPointName, pointName)) {
|
|
|
child.setData(data);
|
|
|
}
|
|
@@ -497,10 +691,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
setStepResult(mSteps);
|
|
|
|
|
|
|
|
|
- ironReady();
|
|
|
-
|
|
|
-
|
|
|
- PushData.send2Operation(mSteps, ironLoading1);
|
|
|
+ PushData.send2Operation(mSteps, ironLoading1.get());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -543,87 +734,6 @@ public class DeviceEventListener extends EventListener {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void ironReady() {
|
|
|
- if (ObjectUtils.isEmpty(mOPCData)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- //通过“预判和确认出铁”标记开始出铁
|
|
|
- boolean isReady = false;
|
|
|
-
|
|
|
- for (IronStepVO stepDTO : mSteps) {
|
|
|
- if (ypqrct.equalsIgnoreCase(stepDTO.getIdentifier()) && 1 == stepDTO.getPassResult()) {
|
|
|
- isReady = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //炉前在接受到炉内出铁要求后,10分钟内打开铁口,未打开系统告警并记录
|
|
|
- if (isReady) {
|
|
|
- TimerTask task = new TimerTask() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- System.out.println("倒计时结束!10分钟已到。");
|
|
|
- timer.cancel(); // 终止定时器
|
|
|
- // 打开系统告警并记录
|
|
|
- PushData.send2Warn("warn");
|
|
|
- log.info("准备出铁但是未及时出铁口,此处数据库记录");
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- // 倒计时10分钟(600秒)
|
|
|
- long delay = 10 * 60 * 1000; // 10分钟转换为毫秒
|
|
|
- // 在指定延迟后执行任务
|
|
|
- timer.schedule(task, delay);
|
|
|
- }
|
|
|
-
|
|
|
- //根据PLC订阅的数据,AOD25606.PV=1为出铁中,AOD25606.PV=0出铁结束的信号,进行判断
|
|
|
- //为1表示开始出铁,此时如果未超过10分钟,就取消定时器
|
|
|
- //出铁结束
|
|
|
- if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
|
|
|
- //1:出铁中
|
|
|
- //0:出铁结束
|
|
|
- ironLoading1 = "1".equals(mOPCData.getData());
|
|
|
-
|
|
|
- if ("1".equals(mOPCData.getData())) {
|
|
|
- //由 0 -> 1
|
|
|
- //表明1号铁口正在出铁
|
|
|
- //根据理论铁量、实时铁水流速,推测距离出铁结束的剩余时间
|
|
|
- //剩余时间=总时间-已经流去的时间
|
|
|
-// mContext.lookupVariable("");
|
|
|
- //计算理论铁量= 矿批 × 综合品位 × 1.06,其中矿批是指L2中的干量
|
|
|
-
|
|
|
-// Date ironTime = mOPCData.getServerTime();
|
|
|
-// lastIronEndTimeRecently
|
|
|
-
|
|
|
-
|
|
|
- } else if ("0".equals(mOPCData.getData())) {
|
|
|
- //由 1-> 0
|
|
|
- try {
|
|
|
- timer.cancel(); // 终止定时器
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- recordAfter();
|
|
|
- recordBlock();
|
|
|
-
|
|
|
- //出铁结束后,查询最近两次的数据
|
|
|
- LambdaQueryWrapper<TIronData> queryWrapper = new QueryWrapper<TIronData>().lambda().orderByDesc(TIronData::getCtcsbh);
|
|
|
- List<TIronData> oldIronDataList = ironDataService.list(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)
|
|
|
- || mOPCData.getPointName().contains(TAG_TAPHOLE2_STATUS)
|
|
|
- || mOPCData.getPointName().contains(TAG_TAPHOLE3_STATUS)
|
|
|
- || mOPCData.getPointName().contains(TAG_TAPHOLE4_STATUS)
|
|
|
- ) {
|
|
|
- lastIronEndTimeRecently = mOPCData.getServerTime();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/***
|
|
|
* 判断是否通过
|
|
|
* @param stepVO
|
|
@@ -640,7 +750,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
}
|
|
|
stepVO.setStepName(flowName);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("stepId:{},identifier:{},stepName:{}", stepVO.getStepId(), stepVO.getIdentifier(), flowName);
|
|
|
+ //log.info("stepId:{},identifier:{},stepName:{}", stepVO.getStepId(), stepVO.getIdentifier(), flowName);
|
|
|
}
|
|
|
|
|
|
//非流程必须项,直接放行
|
|
@@ -661,15 +771,6 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //出铁后,记录炉次、开口时间、鱼雷罐车车号、铁口深度、铁水流速
|
|
|
- private void recordAfter() {
|
|
|
- ironAfterService.add(null);
|
|
|
- }
|
|
|
-
|
|
|
- //堵口后,记录堵口时间、出铁量,打泥量、是否喷溅、是否跑泥
|
|
|
- private void recordBlock() {
|
|
|
- ironBlockService.add(null);
|
|
|
- }
|
|
|
|
|
|
/***
|
|
|
* 用户端点击触发
|
|
@@ -703,44 +804,72 @@ public class DeviceEventListener extends EventListener {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ setStepResult(mSteps);
|
|
|
+ PushData.send2Operation(mSteps, ironLoading1.get());
|
|
|
+
|
|
|
+ for (IronStepVO stepDTO : mSteps) {
|
|
|
+ for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
+ if (Objects.equals(child.getIdentifier(), CAR_STATUS)) {
|
|
|
+ RealtimeData realtimeData = new RealtimeData();
|
|
|
+ realtimeData.setValue(child.getPassResult());
|
|
|
+ realtimeData.setDesc("鱼雷罐车到位状态");
|
|
|
+ mRealtimeStatus.put(CAR_STATUS, realtimeData);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.equals(child.getIdentifier(), GUN_STATUS)) {
|
|
|
+ RealtimeData realtimeData = new RealtimeData();
|
|
|
+ realtimeData.setValue(child.getPassResult());
|
|
|
+ realtimeData.setDesc("拔炮状态");
|
|
|
+ mRealtimeStatus.put(GUN_STATUS, realtimeData);
|
|
|
+ }
|
|
|
+ if (Objects.equals(child.getIdentifier(), MOUTH_STATUS)) {
|
|
|
+ RealtimeData realtimeData = new RealtimeData();
|
|
|
+ realtimeData.setValue(child.getPassResult());
|
|
|
+ realtimeData.setDesc("摆动溜嘴状态");
|
|
|
+ mRealtimeStatus.put(MOUTH_STATUS, realtimeData);
|
|
|
+ }
|
|
|
+ PushData.send2RealtimeStatus(mRealtimeStatus);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private boolean validateManualData(IronStepDTO message, String userId, IronStepVO stepDTO) {
|
|
|
if (Objects.equals(stepDTO.getStepId(), message.getStepId()) && Objects.equals(stepDTO.getIdentifier(), message.getIdentifier()) && Objects.equals("2", stepDTO.getConfirmMode())) {
|
|
|
stepDTO.setData(message.getData());
|
|
|
- setStepResult(mSteps);
|
|
|
- PushData.send2Operation(mSteps, ironLoading1);
|
|
|
+
|
|
|
//这里手动记录时间
|
|
|
log.info("userId:{},stepId:{},identifier:{},data:{},pass:{}", userId, message.getStepId(), message.getIdentifier(), message.getData(), message.isPass());
|
|
|
|
|
|
-
|
|
|
- if (Objects.equals(message.getIdentifier(), CAR_STATUS)) {
|
|
|
- RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(message.getData());
|
|
|
- realtimeData.setDesc("鱼雷罐车到位状态");
|
|
|
- mRealtimeStatus.put(CAR_STATUS, realtimeData);
|
|
|
- }
|
|
|
-
|
|
|
- if (Objects.equals(message.getIdentifier(), GUN_STATUS)) {
|
|
|
- RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(message.getData());
|
|
|
- realtimeData.setDesc("拔炮状态");
|
|
|
- mRealtimeStatus.put(GUN_STATUS, realtimeData);
|
|
|
- }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- if (Objects.equals(message.getIdentifier(), MOUTH_STATUS)) {
|
|
|
- RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(message.getData());
|
|
|
- realtimeData.setDesc("摆动溜嘴状态");
|
|
|
- mRealtimeStatus.put(MOUTH_STATUS, realtimeData);
|
|
|
+ /***
|
|
|
+ * 用户端点击触发,取消预警
|
|
|
+ * @param client
|
|
|
+ * @param message
|
|
|
+ */
|
|
|
+ @OnEvent(value = PushData.IRON_CANCEL_WARN)
|
|
|
+ public void cancelWarn(SocketIOClient client, WarnData message) {
|
|
|
+ if (ObjectUtils.isNotEmpty(message)) {
|
|
|
+ switch (message.getType()) {
|
|
|
+ case TASKNAME_OPEN_WARN:
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_OPEN_WARN);
|
|
|
+ break;
|
|
|
+ case TASKNAME_TAPPING_WARN:
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_TAPPING_WARN);
|
|
|
+ break;
|
|
|
+ case TASKNAME_CLOSE_WARN:
|
|
|
+ scheduledTaskManager.cancelTask(TASKNAME_CLOSE_WARN);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
- PushData.send2RealtimeStatus(mRealtimeStatus);
|
|
|
-
|
|
|
- return true;
|
|
|
}
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
|