|
@@ -236,8 +236,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
//redis保存最多数量数据
|
|
|
private static final int MAX_REDIS_COUNT = 50;
|
|
|
|
|
|
- //上次出铁量
|
|
|
-// private OPCData mIronOPCData;
|
|
|
|
|
|
//实时出铁数据
|
|
|
private TIronData mTIronData;
|
|
@@ -275,6 +273,9 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
//是否出渣,默认不出渣
|
|
|
private AtomicBoolean isChuz = new AtomicBoolean(Boolean.FALSE);
|
|
|
|
|
|
+ //是否已到堵口时间,默认未到堵口时间
|
|
|
+ private AtomicBoolean isClosureTime = new AtomicBoolean(Boolean.FALSE);
|
|
|
+
|
|
|
|
|
|
//系统启动后
|
|
|
@EventListener(ApplicationReadyEvent.class)
|
|
@@ -348,43 +349,42 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
* 出铁参数
|
|
|
*/
|
|
|
private void getIronParams() {
|
|
|
- List<TIronParam> mIronParams = ironParamService.lambdaQuery().eq(TIronParam::getStatus, "1").in(TIronParam::getParamType, "iron_judge", "iron_judge_extra", "server_info").orderByAsc(TIronParam::getSort).list();
|
|
|
- if (ObjectUtils.isNotEmpty(mIronParams)) {
|
|
|
- for (TIronParam mIronParam : mIronParams) {
|
|
|
- if (Objects.equals(mIronParam.getParamName(), ParamsConstants.iron_speed)) {
|
|
|
- StandardConstans.STANDARD_SPEED = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdSpeedMin, Double.parseDouble(StandardConstans.STANDARD_SPEED.split("-")[0]));
|
|
|
- mContext.setVariable(ExpressionConstants.stdSpeedMax, Double.parseDouble(StandardConstans.STANDARD_SPEED.split("-")[1]));
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.pressure_diff_value)) {
|
|
|
- StandardConstans.STANDARD_PRESSURE_DIFF = Double.parseDouble(mIronParam.getParamValue());
|
|
|
- mContext.setVariable(ExpressionConstants.stdPressureDiff, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.iron_time)) {
|
|
|
- StandardConstans.STANDARD_IRON_TIME = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdIronTimeMin, Integer.parseInt(StandardConstans.STANDARD_IRON_TIME.split("-")[0]));
|
|
|
- mContext.setVariable(ExpressionConstants.stdIronTimeMax, Integer.parseInt(StandardConstans.STANDARD_IRON_TIME.split("-")[1]));
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.server_url)) {
|
|
|
- SERVER_URL = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdServerUrl, SERVER_URL);
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.ironwater_temp)) {
|
|
|
- StandardConstans.STANDARD_TEMP = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdTempMin, Integer.parseInt(StandardConstans.STANDARD_TEMP.split("-")[0]));
|
|
|
- mContext.setVariable(ExpressionConstants.stdTempMax, Integer.parseInt(StandardConstans.STANDARD_TEMP.split("-")[1]));
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.open_hour)) {
|
|
|
- StandardConstans.STANDARD_OPEN_HOUR = Integer.parseInt(mIronParam.getParamValue());
|
|
|
- mContext.setVariable(ExpressionConstants.stdOpenHour, StandardConstans.STANDARD_OPEN_HOUR);
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.iron_weight)) {
|
|
|
- StandardConstans.STANDARD_IRON_WEIGHT = mIronParam.getParamValue();
|
|
|
- mContext.setVariable(ExpressionConstants.stdIronWeightMin, Double.parseDouble(StandardConstans.STANDARD_IRON_WEIGHT.split("-")[0]));
|
|
|
- mContext.setVariable(ExpressionConstants.stdIronWeightMax, Double.parseDouble(StandardConstans.STANDARD_IRON_WEIGHT.split("-")[1]));
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.open_machine_value)) {
|
|
|
- StandardConstans.STANDARD_OPEN_MACHINE_LOCATION = Double.parseDouble(mIronParam.getParamValue());
|
|
|
- } else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.mud_machine_value)) {
|
|
|
- StandardConstans.STANDARD_MUD_MACHINE_PRESSURE = Double.parseDouble(mIronParam.getParamValue());
|
|
|
- }else if (Objects.equals(mIronParam.getParamName(), ParamsConstants.warn_count)) {
|
|
|
- StandardConstans.WARN_COUNT = Integer.parseInt(mIronParam.getParamValue());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ Map<String, String> mIronParams = ironParamService.lambdaQuery().eq(TIronParam::getStatus, "1").in(TIronParam::getParamType, "iron_judge", "iron_judge_extra", "server_info").orderByAsc(TIronParam::getSort).list()
|
|
|
+ .stream().collect(Collectors.toMap(
|
|
|
+ TIronParam::getParamName,
|
|
|
+ TIronParam::getParamValue,
|
|
|
+ (existing, replacement) -> existing // 合并函数
|
|
|
+ ));
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_SPEED = mIronParams.get(ParamsConstants.iron_speed);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdSpeedMin, Double.parseDouble(StandardConstans.STANDARD_SPEED.split("-")[0]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdSpeedMax, Double.parseDouble(StandardConstans.STANDARD_SPEED.split("-")[1]));
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_IRON_TIME = mIronParams.get(ParamsConstants.iron_time);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronTimeMin, Integer.parseInt(StandardConstans.STANDARD_IRON_TIME.split("-")[0]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronTimeMax, Integer.parseInt(StandardConstans.STANDARD_IRON_TIME.split("-")[1]));
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_TEMP = mIronParams.get(ParamsConstants.ironwater_temp);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdTempMin, Integer.parseInt(StandardConstans.STANDARD_TEMP.split("-")[0]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdTempMax, Integer.parseInt(StandardConstans.STANDARD_TEMP.split("-")[1]));
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_IRON_WEIGHT = mIronParams.get(ParamsConstants.iron_weight);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronWeightMin, Double.parseDouble(StandardConstans.STANDARD_IRON_WEIGHT.split("-")[0]));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronWeightMax, Double.parseDouble(StandardConstans.STANDARD_IRON_WEIGHT.split("-")[1]));
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_OPEN_HOUR = Integer.parseInt(ParamsConstants.open_hour);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdOpenHour, StandardConstans.STANDARD_OPEN_HOUR);
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_PRESSURE_DIFF = Double.parseDouble(mIronParams.get(ParamsConstants.pressure_diff_value));
|
|
|
+ mContext.setVariable(ExpressionConstants.stdPressureDiff, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
+
|
|
|
+ SERVER_URL = mIronParams.get(ParamsConstants.server_url);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdServerUrl, SERVER_URL);
|
|
|
+
|
|
|
+ StandardConstans.STANDARD_OPEN_MACHINE_LOCATION = Double.parseDouble(mIronParams.get(ParamsConstants.open_machine_value));
|
|
|
+ StandardConstans.STANDARD_MUD_MACHINE_PRESSURE = Double.parseDouble(mIronParams.get(ParamsConstants.mud_machine_value));
|
|
|
+ StandardConstans.WARN_COUNT = Integer.parseInt(mIronParams.get(ParamsConstants.warn_count));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/***
|
|
@@ -405,7 +405,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
*/
|
|
|
@Subscribe
|
|
|
public void onMessageEvent(OPCData opcData) {
|
|
|
- // log.info("subscribe info:{}", opcData);
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(opcData) && ObjectUtils.isNotEmpty(opcData.getIdentifier())) {
|
|
|
//将每一个opc配置的唯一编号添加到环境变量中,方便在表达式中使用
|
|
@@ -492,7 +491,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
mTIronData.getIronStarttime());
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private AtomicDouble mLastSpeed = new AtomicDouble(0);
|
|
@@ -536,15 +534,15 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
if (latest2DataList.size() >= 2) {
|
|
|
//铁量差 = 理论出铁量 - 实际出铁量
|
|
|
TL2Data tl2Data1Last = latest2DataList.get(0);
|
|
|
- BigDecimal theoryWeightLast = new BigDecimal(tl2Data1Last.getTheoryWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
- BigDecimal ironWeightLast = new BigDecimal(tl2Data1Last.getIronWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal theoryWeightLast = BigDecimal.valueOf(tl2Data1Last.getTheoryWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal ironWeightLast = BigDecimal.valueOf(tl2Data1Last.getIronWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
BigDecimal tlcLast = theoryWeightLast.subtract(ironWeightLast).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
TL2Data tl2Data1Grand = latest2DataList.get(1);
|
|
|
//
|
|
|
- BigDecimal theoryWeightGrand = new BigDecimal(tl2Data1Grand.getTheoryWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal theoryWeightGrand = BigDecimal.valueOf(tl2Data1Grand.getTheoryWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
//
|
|
|
- BigDecimal ironWeightGrand = new BigDecimal(tl2Data1Grand.getIronWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal ironWeightGrand = BigDecimal.valueOf(tl2Data1Grand.getIronWeight()).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
BigDecimal tlcGrand = theoryWeightGrand.subtract(ironWeightGrand).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
@@ -623,19 +621,27 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
* 剩余出铁时间 = (理论铁量(1300)-累计出铁量)/流速
|
|
|
*/
|
|
|
private void getCloseTime() {
|
|
|
- if(ironLoading1.get() <= 0){
|
|
|
+ log.info("开始计算预计剩余出铁时间");
|
|
|
+
|
|
|
+ if (ironLoading1.get() <= 0) {
|
|
|
+ log.info("当前铁口状态: 非出铁状态, 跳过计算");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
realtimeData.setDesc("距离堵口预计还剩");
|
|
|
realtimeData.setUnit("分钟");
|
|
|
int diffCloseTime = 0;
|
|
|
+
|
|
|
//实时出铁时间
|
|
|
int ironElapsedMinute = getIronElapsedMinute();
|
|
|
+ log.info("当前已出铁时间: {}分钟", ironElapsedMinute);
|
|
|
|
|
|
- if(ironElapsedMinute <= 0){
|
|
|
+ if (ironElapsedMinute <= 0) {
|
|
|
+ log.info("出铁时间小于等于0, 无法计算剩余时间, 设置剩余时间为0");
|
|
|
realtimeData.setValue(diffCloseTime);
|
|
|
PushData.send2CloseTime(realtimeData);
|
|
|
+ log.info("推送剩余出铁时间数据完成, 剩余时间: {}分钟", diffCloseTime);
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -647,15 +653,37 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
BigDecimal avgSpeed = totalWeight.divide(BigDecimal.valueOf(ironElapsedMinute), 2, RoundingMode.HALF_UP);
|
|
|
//剩余重量
|
|
|
BigDecimal diffWeight = BigDecimal.valueOf(Math.max(stdIronWeightMax - totalWeight.doubleValue(), 0));
|
|
|
- if(avgSpeed.compareTo(BigDecimal.ZERO) <= 0){
|
|
|
+
|
|
|
+ log.info("剩余时间计算参数: 标准最大铁量={}吨, 当前总铁量={}吨, 平均流速={}吨/分钟, 剩余铁量={}吨",
|
|
|
+ stdIronWeightMax, totalWeight, avgSpeed, diffWeight);
|
|
|
+
|
|
|
+ if (avgSpeed.compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
+ log.warn("平均流速小于等于0 ({}/分钟), 无法计算剩余时间, 设置剩余时间为0", avgSpeed);
|
|
|
realtimeData.setValue(diffCloseTime);
|
|
|
PushData.send2CloseTime(realtimeData);
|
|
|
+ log.info("推送剩余出铁时间数据完成, 剩余时间: {}分钟", diffCloseTime);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
//计算剩余时间
|
|
|
diffCloseTime = diffWeight.divide(avgSpeed, 2, RoundingMode.HALF_UP).intValue();
|
|
|
+ log.info("剩余出铁时间计算完成: {}分钟", diffCloseTime);
|
|
|
+
|
|
|
realtimeData.setValue(diffCloseTime);
|
|
|
PushData.send2CloseTime(realtimeData);
|
|
|
+ log.info("推送剩余出铁时间数据完成");
|
|
|
+
|
|
|
+ //堵口前30分钟左右,计算打泥量
|
|
|
+ if (diffCloseTime <= 30 && !isClosureTime.get()) {
|
|
|
+ //表示已经计算过打泥量了
|
|
|
+ isClosureTime.set(true);
|
|
|
+
|
|
|
+ // 打泥量选择模型
|
|
|
+ TIronSchedule scheduleHitMud = scheduleMap.get(TaskNameConstants.TASKNAME_HIT_MUD);
|
|
|
+ if (scheduleHitMud != null && "1".equals(scheduleHitMud.getStatus())) {
|
|
|
+ scheduledTaskManager.addTask(scheduleHitMud.getName(), scheduleHitMud.getDelay(), scheduleHitMud.getPeriod(), TimeUnit.SECONDS, runnableHitmud());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void getExceptionList() {
|
|
@@ -689,21 +717,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
// 记录查询结果详情
|
|
|
log.info("异常列表获取完成,共{}条记录", list != null ? list.size() : 0);
|
|
|
|
|
|
-// if (list != null && !list.isEmpty()) {
|
|
|
-// log.info("异常记录详情:");
|
|
|
-// for (int i = 0; i < Math.min(list.size(), 5); i++) {
|
|
|
-// TExceptionLogBigScreenVo vo = list.get(i);
|
|
|
-// log.info(" 记录[{}]: 异常类型={}, 异常描述={}, 发生时间={}, 铁次ID={}",
|
|
|
-// i + 1,
|
|
|
-// vo.getExceptionTypeName(),
|
|
|
-// vo.getExceptionDesc(),
|
|
|
-// vo.getCreateTime(),
|
|
|
-// vo.getTapholeName());
|
|
|
-// }
|
|
|
-//
|
|
|
-// } else {
|
|
|
-// log.info("当前查询条件下无异常记录");
|
|
|
-// }
|
|
|
|
|
|
PushData.send2Exception(list);
|
|
|
log.info("异常列表已推送至前端");
|
|
@@ -751,6 +764,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
mIronTempLowCount.set(0);
|
|
|
|
|
|
isChuz.set(Boolean.FALSE);
|
|
|
+ isClosureTime.set(Boolean.FALSE);
|
|
|
|
|
|
getIronTimeNo();
|
|
|
|
|
@@ -778,38 +792,34 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
if (tappingTimeoutWarn != null && "1".equals(tappingTimeoutWarn.getStatus())) {
|
|
|
scheduledTaskManager.addTask(tappingTimeoutWarn.getName(), tappingTimeoutWarn.getDelay(), tappingTimeoutWarn.getPeriod(), TimeUnit.SECONDS, runnableTappingTimeout());
|
|
|
}
|
|
|
- // 出铁重量报警
|
|
|
+
|
|
|
+ // 出铁超重报警
|
|
|
TIronSchedule tappingWeightoutWarn = scheduleMap.get(TaskNameConstants.TAPPING_WEIGHTOUT_WARN);
|
|
|
if (tappingWeightoutWarn != null && "1".equals(tappingWeightoutWarn.getStatus())) {
|
|
|
scheduledTaskManager.addTask(tappingWeightoutWarn.getName(), tappingWeightoutWarn.getDelay(), tappingWeightoutWarn.getPeriod(), TimeUnit.SECONDS, runnableTappingWeightout());
|
|
|
}
|
|
|
|
|
|
- // 打泥量选择模型
|
|
|
- TIronSchedule scheduleHitMud = scheduleMap.get(TaskNameConstants.TASKNAME_HIT_MUD);
|
|
|
- if (scheduleHitMud != null && "1".equals(scheduleHitMud.getStatus())) {
|
|
|
- scheduledTaskManager.addTask(scheduleHitMud.getName(), scheduleHitMud.getDelay(), scheduleHitMud.getPeriod(), TimeUnit.SECONDS, runnableHitmud());
|
|
|
- }
|
|
|
|
|
|
// 堵口预测时间
|
|
|
- TIronSchedule schedulClosurePredict = scheduleMap.get(TaskNameConstants.TASKNAME_CLOSURE_PREDICT);
|
|
|
- TIronModel modelClosurePredict = modelMap.get(ModelConstants.closure_predict);
|
|
|
- if (null != modelClosurePredict && schedulClosurePredict != null && "1".equals(modelClosurePredict.getStatus()) && "1".equals(schedulClosurePredict.getStatus())) {
|
|
|
- String modelExpression = modelClosurePredict.getModelExpression();
|
|
|
- if (null != modelExpression) {
|
|
|
- ClosurePredictInfo mClosurePredictInfo = GsonUtils.fromJson(modelExpression, ClosurePredictInfo.class);
|
|
|
- if (null != mClosurePredictInfo) {
|
|
|
- if ("1".equals(schedulClosurePredict.getStatus())) {
|
|
|
- mTotalCloseTime = new Random().nextInt(mClosurePredictInfo.getPredMax() - mClosurePredictInfo.getPredMin() + 1) + mClosurePredictInfo.getPredMin();
|
|
|
- RedisUtils.addFixedElement(RedisConstants.TOTAL_CLOSE_TIME, mTotalCloseTime);
|
|
|
- mLastSpeed.set(0);
|
|
|
- mMaxSpeed.set(0);
|
|
|
- mDiffCloseTime.set(0);
|
|
|
- log.info("预计总时间:{}", mTotalCloseTime);
|
|
|
- scheduledTaskManager.addTask(schedulClosurePredict.getName(), schedulClosurePredict.getDelay(), schedulClosurePredict.getPeriod(), TimeUnit.SECONDS, runnableClosurePredict(mClosurePredictInfo));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// TIronSchedule schedulClosurePredict = scheduleMap.get(TaskNameConstants.TASKNAME_CLOSURE_PREDICT);
|
|
|
+// TIronModel modelClosurePredict = modelMap.get(ModelConstants.closure_predict);
|
|
|
+// if (null != modelClosurePredict && schedulClosurePredict != null && "1".equals(modelClosurePredict.getStatus()) && "1".equals(schedulClosurePredict.getStatus())) {
|
|
|
+// String modelExpression = modelClosurePredict.getModelExpression();
|
|
|
+// if (null != modelExpression) {
|
|
|
+// ClosurePredictInfo mClosurePredictInfo = GsonUtils.fromJson(modelExpression, ClosurePredictInfo.class);
|
|
|
+// if (null != mClosurePredictInfo) {
|
|
|
+// if ("1".equals(schedulClosurePredict.getStatus())) {
|
|
|
+// mTotalCloseTime = new Random().nextInt(mClosurePredictInfo.getPredMax() - mClosurePredictInfo.getPredMin() + 1) + mClosurePredictInfo.getPredMin();
|
|
|
+// RedisUtils.addFixedElement(RedisConstants.TOTAL_CLOSE_TIME, mTotalCloseTime);
|
|
|
+// mLastSpeed.set(0);
|
|
|
+// mMaxSpeed.set(0);
|
|
|
+// mDiffCloseTime.set(0);
|
|
|
+// log.info("预计总时间:{}", mTotalCloseTime);
|
|
|
+// scheduledTaskManager.addTask(schedulClosurePredict.getName(), schedulClosurePredict.getDelay(), schedulClosurePredict.getPeriod(), TimeUnit.SECONDS, runnableClosurePredict(mClosurePredictInfo));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -841,6 +851,10 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
isChuz.set(Boolean.FALSE);
|
|
|
log.info("✅ 设置是否出渣为False已关闭");
|
|
|
|
|
|
+ log.info("🔒 设置是否已经打泥为False...");
|
|
|
+ isClosureTime.set(Boolean.FALSE);
|
|
|
+ log.info("✅ 设置是否已经打泥为False已关闭");
|
|
|
+
|
|
|
// 记录标准参数
|
|
|
try {
|
|
|
int stdIronTimeMin = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMin).toString());
|
|
@@ -900,6 +914,8 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.warn("⚠️ 出铁时间过短: 实际{}分钟 < 标准{}分钟", actualTime, stdIronTimeMin);
|
|
|
taskExecutor.submit(() -> {
|
|
|
log.info("📝 记录出铁时间过短异常...");
|
|
|
+ PushData.send2Warn(WarnData.warnTapping("出铁时间过短",
|
|
|
+ audioMap.get(ExceptionTypeEnum.IRON_TIME_SHORT.getCode())));
|
|
|
saveException(ExceptionTypeEnum.IRON_TIME_SHORT,
|
|
|
String.format("出铁时间%s分钟", actualTime));
|
|
|
getExceptionList();
|
|
@@ -968,7 +984,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
try {
|
|
|
|
|
|
-
|
|
|
if ("1".equals(modelClosureWarn1.getStatus())
|
|
|
&& "1".equals(modelClosureWarn2.getStatus())
|
|
|
&& "1".equals(modelClosureWarn3.getStatus())
|
|
@@ -1111,16 +1126,20 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.info("提交出铁超时异常处理任务到线程池");
|
|
|
|
|
|
try {
|
|
|
- PushData.send2Warn(WarnData.warnTapping("出铁超时", audioMap.get(ExceptionTypeEnum.IRON_TIME_LONG.getCode())));
|
|
|
- // 记录异常信息
|
|
|
- String exceptionMessage = String.format("出铁时间:%s分钟", currentIronTime);
|
|
|
- saveException(ExceptionTypeEnum.IRON_TIME_LONG, exceptionMessage);
|
|
|
- log.info("已记录出铁超时异常: {}", exceptionMessage);
|
|
|
+ try {
|
|
|
+ PushData.send2Warn(WarnData.warnTapping("出铁超时", audioMap.get(ExceptionTypeEnum.IRON_TIME_LONG.getCode())));
|
|
|
+ // 记录异常信息
|
|
|
+ String exceptionMessage = String.format("出铁时间:%s分钟", currentIronTime);
|
|
|
+ saveException(ExceptionTypeEnum.IRON_TIME_LONG, exceptionMessage);
|
|
|
+ log.info("已记录出铁超时异常: {}", exceptionMessage);
|
|
|
|
|
|
- // 推送预警列表更新
|
|
|
- getExceptionList();
|
|
|
- log.info("已推送出铁超时预警列表更新");
|
|
|
+ // 推送预警列表更新
|
|
|
+ getExceptionList();
|
|
|
+ log.info("已推送出铁超时预警列表更新");
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
+ }
|
|
|
+ scheduledTaskManager.cancelTask(scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TIMEOUT_WARN).getName());
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理出铁超时异常时发生错误", e);
|
|
|
}
|
|
@@ -1135,7 +1154,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.error("执行出铁超时检查时发生异常", e);
|
|
|
} finally {
|
|
|
log.info("出铁超时检查任务完成");
|
|
|
- scheduledTaskManager.cancelTask(scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TIMEOUT_WARN).getName());
|
|
|
+
|
|
|
}
|
|
|
};
|
|
|
}
|
|
@@ -1148,11 +1167,11 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
try {
|
|
|
// 获取标准最大出铁重量配置
|
|
|
double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
|
|
|
- log.info("获取标准最大出铁重量: {} 分钟", stdIronWeightMax);
|
|
|
+ log.info("获取标准最大出铁重量: {} t", stdIronWeightMax);
|
|
|
|
|
|
// 获取当前出铁重量
|
|
|
double currentIronTime = mTotalWeight.get().doubleValue();
|
|
|
- log.info("当前出铁重量: {} 分钟", currentIronTime);
|
|
|
+ log.info("当前出铁重量: {} t", currentIronTime);
|
|
|
|
|
|
// 检查是否重量
|
|
|
if (currentIronTime > stdIronWeightMax) {
|
|
@@ -1160,13 +1179,19 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
|
|
|
taskExecutor.submit(() -> {
|
|
|
- PushData.send2Warn(WarnData.warnTapping("出铁量过多", audioMap.get(ExceptionTypeEnum.IRON_WEIGHT_MANY.getCode())));
|
|
|
- saveException(ExceptionTypeEnum.IRON_WEIGHT_MANY, String.format("出铁量%s吨", mTotalWeight));
|
|
|
- //推送预警列表
|
|
|
- getExceptionList();
|
|
|
+ try {
|
|
|
+ PushData.send2Warn(WarnData.warnTapping("出铁量过多", audioMap.get(ExceptionTypeEnum.IRON_WEIGHT_MANY.getCode())));
|
|
|
+ saveException(ExceptionTypeEnum.IRON_WEIGHT_MANY, String.format("出铁量%s吨", mTotalWeight));
|
|
|
+ //推送预警列表
|
|
|
+ getExceptionList();
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ scheduledTaskManager.cancelTask(scheduleMap.get(TaskNameConstants.TAPPING_WEIGHTOUT_WARN).getName());
|
|
|
});
|
|
|
|
|
|
log.info("出铁重量异常处理任务已提交");
|
|
|
+
|
|
|
} else {
|
|
|
log.info("出铁重量正常 - 当前: {} t, 标准: {} t", currentIronTime, stdIronWeightMax);
|
|
|
}
|
|
@@ -1175,16 +1200,15 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.error("执行出铁超时检查时发生异常", e);
|
|
|
} finally {
|
|
|
log.info("出铁超重量检查任务完成");
|
|
|
- scheduledTaskManager.cancelTask(scheduleMap.get(TaskNameConstants.TAPPING_WEIGHTOUT_WARN).getName());
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
|
|
|
//堵口时间预测
|
|
|
- @NotNull
|
|
|
- private Runnable runnableClosurePredict(ClosurePredictInfo mClosurePredictInfo) {
|
|
|
- return () -> {
|
|
|
- if (mMaxSpeed.get() > 0 && ironLoading1.get() > 0) {
|
|
|
+// @NotNull
|
|
|
+// private Runnable runnableClosurePredict(ClosurePredictInfo mClosurePredictInfo) {
|
|
|
+// return () -> {
|
|
|
+// if (mMaxSpeed.get() > 0 && ironLoading1.get() > 0) {
|
|
|
// if (this.mLastSpeed.get() == 0) {
|
|
|
//
|
|
|
// } else if (mMaxSpeed.get() > this.mLastSpeed.get()) {
|
|
@@ -1196,11 +1220,10 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
// }
|
|
|
// this.mLastSpeed.set(mMaxSpeed.get());
|
|
|
// RedisUtils.addFixedElement(RedisConstants.DIFF_CLOSE_TIME, mDiffCloseTime.get());
|
|
|
- getCloseTime();
|
|
|
- }
|
|
|
-
|
|
|
- };
|
|
|
- }
|
|
|
+// }
|
|
|
+//
|
|
|
+// };
|
|
|
+// }
|
|
|
|
|
|
//打泥量预测
|
|
|
@NotNull
|
|
@@ -1213,7 +1236,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.info("获取打泥量模型配置: {}", modelHitMud != null ? modelHitMud.getModelName() : "null");
|
|
|
|
|
|
// 获取最新的出铁数据
|
|
|
- TL2Data tappingData = tl2DataService.getTapped1LatestData();
|
|
|
+ TL2Data tappingData = tl2DataService.getLatestData("1");
|
|
|
log.info("获取最新出铁数据: {}", tappingData != null ? "数据存在" : "数据为空");
|
|
|
|
|
|
// 数据有效性检查
|
|
@@ -1270,6 +1293,54 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
BigDecimal bigDecimal = new BigDecimal(result.toString());
|
|
|
mCalcHitMud = bigDecimal.toBigInteger().toString();
|
|
|
|
|
|
+
|
|
|
+ // 记录标准参数
|
|
|
+ try {
|
|
|
+ int stdIronTimeMin = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMin).toString());
|
|
|
+ int stdIronTimeMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMax).toString());
|
|
|
+ double stdIronWeightMin = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMin).toString());
|
|
|
+ double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
|
|
|
+
|
|
|
+ log.info("📋 标准参数: 时间范围={}-{}分钟, 重量范围={}-{}吨", stdIronTimeMin, stdIronTimeMax, stdIronWeightMin, stdIronWeightMax);
|
|
|
+
|
|
|
+ // 1.出铁量 1000-1300t 1000以下,出铁时间变短,打泥量+5;1300以上-5
|
|
|
+ if (mTotalWeight.get().doubleValue() < stdIronWeightMin) {
|
|
|
+ bigDecimal = bigDecimal.add(BigDecimal.valueOf(5));
|
|
|
+ } else if (mTotalWeight.get().doubleValue() > stdIronWeightMax) {
|
|
|
+ bigDecimal = bigDecimal.subtract(BigDecimal.valueOf(5));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.出铁时间 150-180min 150以下,打泥量+5;180以上-5
|
|
|
+ if (getIronElapsedMinute() < stdIronTimeMin) {
|
|
|
+ bigDecimal = bigDecimal.add(BigDecimal.valueOf(5));
|
|
|
+ } else if (getIronElapsedMinute() > stdIronTimeMax) {
|
|
|
+ bigDecimal = bigDecimal.subtract(BigDecimal.valueOf(5));
|
|
|
+ }
|
|
|
+
|
|
|
+ mCalcHitMud = bigDecimal.toBigInteger().toString();
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("⚠️ 获取标准参数失败: {}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<TL2Data> latestTwoDatas = tl2DataService.getLatestTwoDatas("1");
|
|
|
+ if (ObjectUtils.isNotEmpty(latestTwoDatas) && latestTwoDatas.size() >= 2) {
|
|
|
+ BigDecimal mudWeight1 = BigDecimal.valueOf(latestTwoDatas.get(0).getMudWeight());
|
|
|
+ BigDecimal mudWeight2 = BigDecimal.valueOf(latestTwoDatas.get(2).getMudWeight());
|
|
|
+
|
|
|
+ if (mudWeight1.intValue() == 55 && mudWeight2.intValue() == 55) {
|
|
|
+ // 前2次1号铁口的打泥量 前两次55L,建议本次也是55L
|
|
|
+ mCalcHitMud = "55";
|
|
|
+ } else {
|
|
|
+ if (bigDecimal.compareTo(mudWeight1) > 0 && bigDecimal.compareTo(mudWeight2) > 0) {
|
|
|
+ mCalcHitMud = mudWeight1.add(mudWeight2).divide(BigDecimal.valueOf(2), 0, RoundingMode.HALF_UP).toPlainString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
log.info("打泥量计算完成: {} L", mCalcHitMud);
|
|
|
|
|
|
// 推送结果
|
|
@@ -1495,6 +1566,13 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
TL2Data latestData = tl2DataService.getLatestData();
|
|
|
TIronTest ironTest = new TIronTest();
|
|
|
ironTest.setTapholeId("1");
|
|
|
+ ironTest.setAvgSpeed(actualIronSpeed + "");
|
|
|
+ ironTest.setAvgTemp(avgTemp + "");
|
|
|
+ ironTest.setIronWeight(actualIronWeight + "");
|
|
|
+ ironTest.setIronCosttime(actualIronTime);
|
|
|
+ if(ObjectUtils.isNotEmpty(mTIronData)){
|
|
|
+ ironTest.setIronDataId(mTIronData.getId());
|
|
|
+ }
|
|
|
|
|
|
String testStatus = (ironNormalCount >= 4) ? "1" : "0";
|
|
|
ironTest.setTestStatus(testStatus);
|
|
@@ -1707,7 +1785,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
log.error(" ❌ 保存出铁记录失败: {}", e.getMessage(), e);
|
|
|
- }finally {
|
|
|
+ } finally {
|
|
|
mTIronData = null;
|
|
|
}
|
|
|
|
|
@@ -2096,7 +2174,6 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
lastChuzTemps.add(temp);
|
|
|
log.info(" ├─ 添加新温度后队列: {}", lastChuzTemps);
|
|
|
|
|
|
- // boolean isRising = false;
|
|
|
log.info("📈 【温度趋势分析】");
|
|
|
log.info(" ├─ 出铁状态 (ironLoading1): {}", ironLoading1.get());
|
|
|
|
|
@@ -2270,7 +2347,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
|
|
|
if (ObjectUtils.isEmpty(fixedLatestElement)) {
|
|
|
- fixedLatestElement = tl2DataService.getTapped1LatestData();
|
|
|
+ fixedLatestElement = tl2DataService.getLatestData("1");
|
|
|
}
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(fixedLatestElement)) {
|
|
@@ -2862,6 +2939,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
break;
|
|
|
case TaskNameConstants.TASKNAME_EXCEPTION_LIST:
|
|
|
+ //告警列表
|
|
|
if (schedule != null && "1".equals(schedule.getStatus())) {
|
|
|
scheduledTaskManager.addTask(schedule.getName(), schedule.getDelay(), schedule.getPeriod(), TimeUnit.SECONDS, () -> {
|
|
|
getExceptionList();
|
|
@@ -2871,6 +2949,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
break;
|
|
|
case TaskNameConstants.TASKNAME_OPCDASUBSCRIBE:
|
|
|
+ //L1订阅
|
|
|
if (schedule != null && "1".equals(schedule.getStatus())) {
|
|
|
scheduledTaskManager.addTask(schedule.getName(), schedule.getDelay(), schedule.getPeriod(), TimeUnit.SECONDS, () -> {
|
|
|
if ("prod".equals(activeProfiles)) {
|
|
@@ -2887,6 +2966,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
break;
|
|
|
case TaskNameConstants.TASKNAME_TAPPING_TEST:
|
|
|
+ //出铁诊断
|
|
|
if (schedule != null && "1".equals(schedule.getStatus())) {
|
|
|
scheduledTaskManager.addTask(schedule.getName(), schedule.getDelay(), schedule.getPeriod(), TimeUnit.SECONDS, runnableTappingTest());
|
|
|
} else {
|
|
@@ -2894,6 +2974,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
break;
|
|
|
case TaskNameConstants.TASKNAME_TAPPING_WARN:
|
|
|
+ //出铁预警
|
|
|
if (schedule != null && "1".equals(schedule.getStatus())) {
|
|
|
scheduledTaskManager.addTask(schedule.getName(), schedule.getDelay(), schedule.getPeriod(), TimeUnit.SECONDS, runnableTappingWarn());
|
|
|
} else {
|
|
@@ -2901,6 +2982,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
break;
|
|
|
case TaskNameConstants.TASKNAME_CLOSURE_WARN:
|
|
|
+ //堵口预警
|
|
|
if (schedule != null && "1".equals(schedule.getStatus())) {
|
|
|
scheduledTaskManager.addTask(schedule.getName(), schedule.getDelay(), schedule.getPeriod(), TimeUnit.SECONDS, runnableClosureWarn());
|
|
|
} else {
|
|
@@ -2908,6 +2990,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
}
|
|
|
break;
|
|
|
case TaskNameConstants.TASKNAME_OPEN_WARN:
|
|
|
+ //开口预警
|
|
|
if (schedule != null && "1".equals(schedule.getStatus())) {
|
|
|
scheduledTaskManager.addTask(schedule.getName(), schedule.getDelay(), schedule.getPeriod(), TimeUnit.SECONDS, runnableHitmud());
|
|
|
} else {
|