|
@@ -24,6 +24,7 @@ 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 com.sckj.warn.validate.TExceptionLogCreateValidate;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -87,7 +88,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
OPCDataServiceImpl opcDataService;
|
|
|
|
|
|
@Resource
|
|
|
- ITExceptionLogService iTExceptionLogService;
|
|
|
+ ITExceptionLogService exceptionLogService;
|
|
|
|
|
|
//1号出铁状态标记
|
|
|
private static final String TAG_TAPHOLE1_STATUS = "AOD25606.PV";
|
|
@@ -268,7 +269,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
//将L2实时数据保存到Redis
|
|
|
taskExecutor.submit(() -> {
|
|
|
RedisUtils.addFixedElement(IRON_ELEMENT, l2Data, MAX_REDIS_COUNT);
|
|
|
- PushData.send2TrendIronElement(RedisUtils.getFixedElement(IRON_ELEMENT));
|
|
|
+ PushData.send2TrendIronElement(RedisUtils.getFixedElement(IRON_ELEMENT, MAX_REDIS_COUNT));
|
|
|
});
|
|
|
|
|
|
taskExecutor.submit(() -> {
|
|
@@ -282,21 +283,21 @@ public class DeviceEventListener extends EventListener {
|
|
|
//处理子项
|
|
|
for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
if (STEP_TLC.equals(child.getIdentifier())) {
|
|
|
- List<TL2Data> latest2Data = tl2DataService.getLatest2Data();
|
|
|
+ List<L2Data> latest2Data = (List<L2Data>) RedisUtils.getFixedElement(IRON_ELEMENT, 2);
|
|
|
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;
|
|
|
+ L2Data tl2Data1Last = latest2Data.get(0);
|
|
|
+ BigDecimal llLast = new BigDecimal(tl2Data1Last.getTotalDry()).multiply(new BigDecimal(1.0)).multiply(new BigDecimal(1.06));
|
|
|
+ BigDecimal ironWeightLast = new BigDecimal(tl2Data1Last.getIronWeight());
|
|
|
+ BigDecimal tlcLast = llLast.subtract(ironWeightLast);
|
|
|
|
|
|
- TL2Data tl2Data1LastLast = latest2Data.get(1);
|
|
|
- double llLastLast = tl2Data1LastLast.getTotalDry() * 1.0 * 1.06;
|
|
|
- double ironWeightLastLast = tl2Data1Last.getIronWeight();
|
|
|
- double tlcLastLast = llLastLast - ironWeightLastLast;
|
|
|
+ L2Data tl2Data1LastLast = latest2Data.get(1);
|
|
|
+ BigDecimal llLastLast = new BigDecimal(tl2Data1LastLast.getTotalDry()).multiply(new BigDecimal(1.0)).multiply(new BigDecimal(1.06));
|
|
|
+ BigDecimal ironWeightLastLast = new BigDecimal(tl2Data1Last.getIronWeight());
|
|
|
+ BigDecimal tlcLastLast = llLastLast.subtract(ironWeightLastLast);
|
|
|
|
|
|
//铁量差在合理范围内
|
|
|
// 上一次铁量差:-30 上上次铁量差:20 t
|
|
@@ -359,7 +360,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
}
|
|
|
|
|
|
//1号铁口正在出铁的操作项目
|
|
|
- private void taphole1Start(L2Data mL2Data) {
|
|
|
+ private void taphole1Start() {
|
|
|
//通过“预判和确认出铁”标记开始出铁
|
|
|
boolean isReady = false;
|
|
|
|
|
@@ -390,10 +391,10 @@ public class DeviceEventListener extends EventListener {
|
|
|
// 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));
|
|
|
- //
|
|
|
+// 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) {
|
|
|
// //理论时间
|
|
@@ -409,23 +410,25 @@ public class DeviceEventListener extends EventListener {
|
|
|
if (speed1.compareTo(STANDARD_SPEED) > 0 || speed2.compareTo(STANDARD_SPEED) > 0) {
|
|
|
//流速过大可能是由于铁口深度不足或发生跑大流问题,则提示将当前铁口堵口
|
|
|
PushData.send2Warn(WarnData.warnClose("流速过快,请将当前铁口堵口"));
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(4).exceptionDesc("流速过快,请将当前铁口堵口").build());
|
|
|
} else if ((speed1.compareTo(STANDARD_SPEED) < 0 || speed2.compareTo(STANDARD_SPEED) < 0) && (ironLoading2.get() || ironLoading3.get() || ironLoading4.get())) {
|
|
|
//若流速过小,但其它铁口正在出铁,则提示将当前铁口堵口
|
|
|
PushData.send2Warn(WarnData.warnClose("流速过小,请将当前铁口堵口"));
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(4).exceptionDesc("流速过小,请将当前铁口堵口").build());
|
|
|
} else if ((speed1.compareTo(STANDARD_SPEED) < 0 || speed2.compareTo(STANDARD_SPEED) < 0) && (!ironLoading2.get() && !ironLoading3.get() && !ironLoading4.get())) {
|
|
|
//若流速过小且其他铁口均未出铁,则提示先将其它铁口打开,再进行堵口
|
|
|
PushData.send2Warn(WarnData.warnClose("请先打开其它铁口,再堵口"));
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(4).exceptionDesc("请先打开其它铁口,再堵口").build());
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //开始计算打泥量,通过打泥量公式
|
|
|
+ //xxx分钟出铁后开始计算打泥量,通过打泥量公式
|
|
|
//打泥量公式关联因素:铁口深度、钻杆直径、
|
|
|
//调用打泥量模型,计算预计使用多少打泥量进行堵口
|
|
|
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);
|
|
|
});
|
|
@@ -514,7 +517,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
mRealtimeData.put(IRON_TEMP, realtimeData);
|
|
|
//redis添加数据
|
|
|
RedisUtils.addFixedElement(IRON_TEMP, realtimeData, MAX_REDIS_COUNT);
|
|
|
- PushData.send2TrendIronTemp(RedisUtils.getFixedElement(IRON_TEMP));
|
|
|
+ PushData.send2TrendIronTemp(RedisUtils.getFixedElement(IRON_TEMP, MAX_REDIS_COUNT));
|
|
|
} else if (opcData.getPointName().contains(TAG_CAR11) || opcData.getPointName().contains(TAG_CAR12)) {
|
|
|
// 1TH-1号车受铁速度
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
@@ -550,7 +553,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
) {
|
|
|
ironSpeed.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
RedisUtils.addFixedElement(IRON_SPEED, ironSpeed, MAX_REDIS_COUNT);
|
|
|
- PushData.send2TrendIronSpeed(RedisUtils.getFixedElement(IRON_SPEED));
|
|
|
+ PushData.send2TrendIronSpeed(RedisUtils.getFixedElement(IRON_SPEED, MAX_REDIS_COUNT));
|
|
|
}
|
|
|
} else if (opcData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
@@ -561,7 +564,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
ironLoading1.set("1".equals(opcData.getData().toString()));
|
|
|
|
|
|
if (ironLoading1.get()) {
|
|
|
- taphole1Start(l2Data);
|
|
|
+ taphole1Start();
|
|
|
} else {
|
|
|
taphole1End();
|
|
|
}
|
|
@@ -594,7 +597,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
ironWeight.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, MAX_REDIS_COUNT);
|
|
|
- PushData.send2TrendIronWeight(RedisUtils.getFixedElement(IRON_WEIGHT));
|
|
|
+ PushData.send2TrendIronWeight(RedisUtils.getFixedElement(IRON_WEIGHT, MAX_REDIS_COUNT));
|
|
|
|
|
|
} else if (opcData.getPointName().contains(FLUSH_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
@@ -611,6 +614,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
//堵口预警
|
|
|
log.info("出铁预警:{}", TASKNAME_TAPPING_WARN);
|
|
|
PushData.send2Warn(WarnData.warnTapping("压差超过阈值,请出铁"));
|
|
|
+ exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(4).exceptionDesc("压差超过阈值,请出铁").build());
|
|
|
});
|
|
|
} else {
|
|
|
scheduledTaskManager.cancelTask(TASKNAME_TAPPING_WARN);
|
|
@@ -796,13 +800,9 @@ public class DeviceEventListener extends EventListener {
|
|
|
log.info("--->userId : {}", userId);
|
|
|
for (IronStepVO stepDTO : mSteps) {
|
|
|
for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
- if (validateManualData(message, userId, child)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- if (validateManualData(message, userId, stepDTO)) {
|
|
|
- return;
|
|
|
+ validateManualData(message, userId, child);
|
|
|
}
|
|
|
+ validateManualData(message, userId, stepDTO);
|
|
|
}
|
|
|
|
|
|
setStepResult(mSteps);
|