|
@@ -21,6 +21,7 @@ import com.sckj.iron.dto.*;
|
|
|
import com.sckj.iron.entity.*;
|
|
|
import com.sckj.iron.service.impl.*;
|
|
|
import com.sckj.iron.vo.IronStepVO;
|
|
|
+import com.sckj.l2.dto.TL2DataTlcDTO;
|
|
|
import com.sckj.l2.dto.TrendRequest;
|
|
|
import com.sckj.l2.entity.TL2Data;
|
|
|
import com.sckj.l2.service.impl.TL2DataServiceImpl;
|
|
@@ -61,7 +62,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
-import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -223,7 +223,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
private String SERVER_URL = "";
|
|
|
|
|
|
// 实时出铁总重量/总流量
|
|
|
- private final AtomicReference<BigDecimal> mTotalWeight = new AtomicReference<>(BigDecimal.ZERO);
|
|
|
+ private BigDecimal mTotalWeight = BigDecimal.ZERO;
|
|
|
|
|
|
// 分别记录两个鱼雷罐车的最大值和当前递增值
|
|
|
private BigDecimal ironWeight1Pre = BigDecimal.ZERO;//上一个数据
|
|
@@ -348,42 +348,199 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
* 出铁参数
|
|
|
*/
|
|
|
private void getIronParams() {
|
|
|
- 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 // 合并函数
|
|
|
- ));
|
|
|
+ log.info("开始获取出铁相关参数");
|
|
|
+ try {
|
|
|
+ // 查询所有有效的出铁参数
|
|
|
+ List<TIronParam> paramList = ironParamService.lambdaQuery()
|
|
|
+ .eq(TIronParam::getStatus, "1")
|
|
|
+ .in(TIronParam::getParamType, "iron_judge", "iron_judge_extra", "server_info")
|
|
|
+ .orderByAsc(TIronParam::getSort)
|
|
|
+ .list();
|
|
|
+
|
|
|
+ if (ObjectUtils.isEmpty(paramList)) {
|
|
|
+ log.warn("未获取到有效的出铁参数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("成功获取到 {} 个出铁参数", paramList.size());
|
|
|
+
|
|
|
+ // 将参数列表转换为Map,方便后续查询
|
|
|
+ Map<String, String> paramMap = paramList.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ TIronParam::getParamName,
|
|
|
+ TIronParam::getParamValue,
|
|
|
+ (existing, replacement) -> existing // 合并函数,保留已有值
|
|
|
+ ));
|
|
|
+
|
|
|
+ // 处理流速参数
|
|
|
+ String speedValue = paramMap.get(ParamsConstants.iron_speed);
|
|
|
+ if (ObjectUtils.isNotEmpty(speedValue)) {
|
|
|
+ StandardConstans.STANDARD_SPEED = speedValue;
|
|
|
+ try {
|
|
|
+ String[] speedRange = speedValue.split("-");
|
|
|
+ if (speedRange.length == 2) {
|
|
|
+ double minSpeed = Double.parseDouble(speedRange[0]);
|
|
|
+ double maxSpeed = Double.parseDouble(speedRange[1]);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdSpeedMin, minSpeed);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdSpeedMax, maxSpeed);
|
|
|
+ log.info("设置流速参数: 标准流速范围={}-{}吨/分钟", minSpeed, maxSpeed);
|
|
|
+ } else {
|
|
|
+ log.warn("流速参数格式不正确,应为'最小值-最大值'格式: {}", speedValue);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析流速参数失败: {}", speedValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到流速参数({})", ParamsConstants.iron_speed);
|
|
|
+ }
|
|
|
|
|
|
- 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]));
|
|
|
+ // 处理出铁时间参数
|
|
|
+ String timeValue = paramMap.get(ParamsConstants.iron_time);
|
|
|
+ if (ObjectUtils.isNotEmpty(timeValue)) {
|
|
|
+ StandardConstans.STANDARD_IRON_TIME = timeValue;
|
|
|
+ try {
|
|
|
+ String[] timeRange = timeValue.split("-");
|
|
|
+ if (timeRange.length == 2) {
|
|
|
+ int minTime = Integer.parseInt(timeRange[0]);
|
|
|
+ int maxTime = Integer.parseInt(timeRange[1]);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronTimeMin, minTime);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronTimeMax, maxTime);
|
|
|
+ log.info("设置出铁时间参数: 标准出铁时间范围={}-{}分钟", minTime, maxTime);
|
|
|
+ } else {
|
|
|
+ log.warn("出铁时间参数格式不正确,应为'最小值-最大值'格式: {}", timeValue);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析出铁时间参数失败: {}", timeValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到出铁时间参数({})", ParamsConstants.iron_time);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理铁水温度参数
|
|
|
+ String tempValue = paramMap.get(ParamsConstants.ironwater_temp);
|
|
|
+ if (ObjectUtils.isNotEmpty(tempValue)) {
|
|
|
+ StandardConstans.STANDARD_TEMP = tempValue;
|
|
|
+ try {
|
|
|
+ String[] tempRange = tempValue.split("-");
|
|
|
+ if (tempRange.length == 2) {
|
|
|
+ int minTemp = Integer.parseInt(tempRange[0]);
|
|
|
+ int maxTemp = Integer.parseInt(tempRange[1]);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdTempMin, minTemp);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdTempMax, maxTemp);
|
|
|
+ log.info("设置铁水温度参数: 标准温度范围={}-{}°C", minTemp, maxTemp);
|
|
|
+ } else {
|
|
|
+ log.warn("铁水温度参数格式不正确,应为'最小值-最大值'格式: {}", tempValue);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析铁水温度参数失败: {}", tempValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到铁水温度参数({})", ParamsConstants.ironwater_temp);
|
|
|
+ }
|
|
|
|
|
|
- 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]));
|
|
|
+ // 处理出铁重量参数
|
|
|
+ String weightValue = paramMap.get(ParamsConstants.iron_weight);
|
|
|
+ if (ObjectUtils.isNotEmpty(weightValue)) {
|
|
|
+ StandardConstans.STANDARD_IRON_WEIGHT = weightValue;
|
|
|
+ try {
|
|
|
+ String[] weightRange = weightValue.split("-");
|
|
|
+ if (weightRange.length == 2) {
|
|
|
+ double minWeight = Double.parseDouble(weightRange[0]);
|
|
|
+ double maxWeight = Double.parseDouble(weightRange[1]);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronWeightMin, minWeight);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdIronWeightMax, maxWeight);
|
|
|
+ log.info("设置出铁重量参数: 标准重量范围={}-{}吨", minWeight, maxWeight);
|
|
|
+ } else {
|
|
|
+ log.warn("出铁重量参数格式不正确,应为'最小值-最大值'格式: {}", weightValue);
|
|
|
+ }
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析出铁重量参数失败: {}", weightValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到出铁重量参数({})", ParamsConstants.iron_weight);
|
|
|
+ }
|
|
|
|
|
|
- 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]));
|
|
|
+ // 处理开口时间参数
|
|
|
+ String openHourValue = paramMap.get(ParamsConstants.open_hour);
|
|
|
+ if (ObjectUtils.isNotEmpty(openHourValue)) {
|
|
|
+ try {
|
|
|
+ StandardConstans.STANDARD_OPEN_HOUR = Integer.parseInt(openHourValue);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdOpenHour, StandardConstans.STANDARD_OPEN_HOUR);
|
|
|
+ log.info("设置开口时间参数: 标准开口时间={}小时", StandardConstans.STANDARD_OPEN_HOUR);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析开口时间参数失败: {}", openHourValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到开口时间参数({})", ParamsConstants.open_hour);
|
|
|
+ }
|
|
|
|
|
|
- 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]));
|
|
|
+ // 处理压力差参数
|
|
|
+ String pressureDiffValue = paramMap.get(ParamsConstants.pressure_diff_value);
|
|
|
+ if (ObjectUtils.isNotEmpty(pressureDiffValue)) {
|
|
|
+ try {
|
|
|
+ StandardConstans.STANDARD_PRESSURE_DIFF = Double.parseDouble(pressureDiffValue);
|
|
|
+ mContext.setVariable(ExpressionConstants.stdPressureDiff, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
+ log.info("设置压力差参数: 标准压力差={}", StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析压力差参数失败: {}", pressureDiffValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到压力差参数({})", ParamsConstants.pressure_diff_value);
|
|
|
+ }
|
|
|
|
|
|
- StandardConstans.STANDARD_OPEN_HOUR = Integer.parseInt(ParamsConstants.open_hour);
|
|
|
- mContext.setVariable(ExpressionConstants.stdOpenHour, StandardConstans.STANDARD_OPEN_HOUR);
|
|
|
+ // 处理服务器URL参数
|
|
|
+ String serverUrl = paramMap.get(ParamsConstants.server_url);
|
|
|
+ if (ObjectUtils.isNotEmpty(serverUrl)) {
|
|
|
+ SERVER_URL = serverUrl;
|
|
|
+ mContext.setVariable(ExpressionConstants.stdServerUrl, SERVER_URL);
|
|
|
+ log.info("设置服务器URL参数: {}", SERVER_URL);
|
|
|
+ } else {
|
|
|
+ log.warn("未找到服务器URL参数({})", ParamsConstants.server_url);
|
|
|
+ }
|
|
|
|
|
|
- StandardConstans.STANDARD_PRESSURE_DIFF = Double.parseDouble(mIronParams.get(ParamsConstants.pressure_diff_value));
|
|
|
- mContext.setVariable(ExpressionConstants.stdPressureDiff, StandardConstans.STANDARD_PRESSURE_DIFF);
|
|
|
+ // 处理开口机位置参数
|
|
|
+ String openMachineValue = paramMap.get(ParamsConstants.open_machine_value);
|
|
|
+ if (ObjectUtils.isNotEmpty(openMachineValue)) {
|
|
|
+ try {
|
|
|
+ StandardConstans.STANDARD_OPEN_MACHINE_LOCATION = Double.parseDouble(openMachineValue);
|
|
|
+ log.info("设置开口机位置参数: {}", StandardConstans.STANDARD_OPEN_MACHINE_LOCATION);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析开口机位置参数失败: {}", openMachineValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到开口机位置参数({})", ParamsConstants.open_machine_value);
|
|
|
+ }
|
|
|
|
|
|
- SERVER_URL = mIronParams.get(ParamsConstants.server_url);
|
|
|
- mContext.setVariable(ExpressionConstants.stdServerUrl, SERVER_URL);
|
|
|
+ // 处理泥炮压力参数
|
|
|
+ String mudMachineValue = paramMap.get(ParamsConstants.mud_machine_value);
|
|
|
+ if (ObjectUtils.isNotEmpty(mudMachineValue)) {
|
|
|
+ try {
|
|
|
+ StandardConstans.STANDARD_MUD_MACHINE_PRESSURE = Double.parseDouble(mudMachineValue);
|
|
|
+ log.info("设置泥炮压力参数: {}", StandardConstans.STANDARD_MUD_MACHINE_PRESSURE);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析泥炮压力参数失败: {}", mudMachineValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到泥炮压力参数({})", ParamsConstants.mud_machine_value);
|
|
|
+ }
|
|
|
|
|
|
- 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));
|
|
|
+ // 处理警告次数参数
|
|
|
+ String warnCountValue = paramMap.get(ParamsConstants.warn_count);
|
|
|
+ if (ObjectUtils.isNotEmpty(warnCountValue)) {
|
|
|
+ try {
|
|
|
+ StandardConstans.WARN_COUNT = Integer.parseInt(warnCountValue);
|
|
|
+ log.info("设置警告次数参数: {}", StandardConstans.WARN_COUNT);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.error("解析警告次数参数失败: {}", warnCountValue, e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ log.warn("未找到警告次数参数({})", ParamsConstants.warn_count);
|
|
|
+ }
|
|
|
|
|
|
+ log.info("出铁参数获取和设置完成");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取出铁参数时发生异常", e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/***
|
|
@@ -478,7 +635,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.info("出铁数据保存{} - 影响记录数: {}", saveResult ? "成功" : "失败", saveResult ? 1 : 0);
|
|
|
|
|
|
opcData.setIronDataId(mTIronData.getId());
|
|
|
- boolean opcSaveResult = opcDataService.save(opcData);
|
|
|
+ boolean opcSaveResult = opcDataService.saveOrUpdate(opcData);
|
|
|
log.info("OPC数据关联保存{} - OPC数据ID: {}, 关联铁次ID: {}",
|
|
|
opcSaveResult ? "成功" : "失败",
|
|
|
opcData.getId(),
|
|
@@ -533,21 +690,40 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
if (latest2DataList.size() >= 2) {
|
|
|
//铁量差 = 理论出铁量 - 实际出铁量
|
|
|
TL2Data tl2Data1Last = latest2DataList.get(0);
|
|
|
+
|
|
|
+
|
|
|
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);
|
|
|
|
|
|
+ TL2DataTlcDTO dtoLast = new TL2DataTlcDTO();
|
|
|
+ BeanUtils.copyProperties(tl2Data1Last, dtoLast);
|
|
|
+ dtoLast.setTheoryWeight(theoryWeightLast.doubleValue());
|
|
|
+ dtoLast.setIronWeight(ironWeightLast.doubleValue());
|
|
|
+ dtoLast.setDiffWeight(tlcLast.doubleValue());
|
|
|
+
|
|
|
+
|
|
|
TL2Data tl2Data1Grand = latest2DataList.get(1);
|
|
|
- //
|
|
|
BigDecimal theoryWeightGrand = BigDecimal.valueOf(tl2Data1Grand.getTheoryWeight()).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);
|
|
|
|
|
|
+ TL2DataTlcDTO dtoGrand = new TL2DataTlcDTO();
|
|
|
+ BeanUtils.copyProperties(tl2Data1Grand, dtoGrand);
|
|
|
+ dtoGrand.setTheoryWeight(theoryWeightGrand.doubleValue());
|
|
|
+ dtoGrand.setIronWeight(ironWeightGrand.doubleValue());
|
|
|
+ dtoGrand.setDiffWeight(tlcGrand.doubleValue());
|
|
|
+
|
|
|
//近两次铁量差=近两次
|
|
|
BigDecimal tlcjlc = tlcLast.add(tlcGrand);
|
|
|
|
|
|
+ Map<String, Object> extraInfo = child.getExtraInfo();
|
|
|
+ if(null == extraInfo){
|
|
|
+ extraInfo = new HashMap<>();
|
|
|
+ }
|
|
|
+ extraInfo.put("tlcDetails", Arrays.asList(dtoLast, dtoGrand));
|
|
|
+ child.setExtraInfo(extraInfo);
|
|
|
+
|
|
|
for (IronStepVO grandChild : child.getChilds()) {
|
|
|
if (StepConstans.sctlc.equals(grandChild.getIdentifier())) {
|
|
|
grandChild.setData(tlcLast);
|
|
@@ -647,7 +823,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
//最大出铁标准量
|
|
|
double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
|
|
|
//实时总铁量
|
|
|
- BigDecimal totalWeight = mTotalWeight.get();
|
|
|
+ BigDecimal totalWeight = mTotalWeight;
|
|
|
//平均流速
|
|
|
BigDecimal avgSpeed = totalWeight.divide(BigDecimal.valueOf(ironElapsedMinute), 2, RoundingMode.HALF_UP);
|
|
|
//剩余重量
|
|
@@ -750,77 +926,100 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
* 2. 开启定时任务 -> 出铁超时报警、堵口预警、打泥量选择计算、出铁计时(按秒计时)
|
|
|
* 3. 清空出铁总量
|
|
|
*/
|
|
|
+ /**
|
|
|
+ * 1号铁口正在出铁的操作项目(由 0-> 1 表明1号铁口开始出铁)
|
|
|
+ * 处理出铁开始事件
|
|
|
+ * 1. 关闭定时任务 -> 出铁诊断(执行一次)、出铁预警、开口预警
|
|
|
+ * 2. 开启定时任务 -> 出铁超时报警、堵口预警、打泥量选择计算、出铁计时(按秒计时)
|
|
|
+ * 3. 清空出铁总量
|
|
|
+ */
|
|
|
private void taphole1Start() {
|
|
|
+ log.info("🚀 ====== 开始执行 taphole1Start - 出铁开始处理 ======");
|
|
|
synchronized (scheduledTaskManager) {
|
|
|
+ log.info("🔄 【数据重置】");
|
|
|
// 清空出铁总量
|
|
|
- mTotalWeight.set(BigDecimal.ZERO);
|
|
|
+ log.info(" ├─ 重置出铁总量: 原总量={}吨 → 重置为0吨", mTotalWeight.doubleValue());
|
|
|
+ mTotalWeight = BigDecimal.ZERO;
|
|
|
+
|
|
|
+ log.info(" ├─ 重置铁水重量记录: ironWeight1Pre={}吨, ironWeight2Pre={}吨 → 重置为0吨",
|
|
|
+ ironWeight1Pre.doubleValue(), ironWeight2Pre.doubleValue());
|
|
|
ironWeight1Pre = BigDecimal.ZERO;
|
|
|
ironWeight2Pre = BigDecimal.ZERO;
|
|
|
- // 重置出铁计时
|
|
|
+
|
|
|
+ log.info(" ├─ 重置出铁计时: 原计时={}秒 → 重置为0秒", mSecondsElapsed.get());
|
|
|
mSecondsElapsed.set(0);
|
|
|
|
|
|
+ log.info(" ├─ 重置温度异常计数器: 高温={}次, 低温={}次 → 重置为0次",
|
|
|
+ mIronTempHighCount.get(), mIronTempLowCount.get());
|
|
|
mIronTempHighCount.set(0);
|
|
|
mIronTempLowCount.set(0);
|
|
|
|
|
|
+ log.info(" ├─ 重置出渣状态: 原状态={} → 重置为False", isChuz.get());
|
|
|
isChuz.set(Boolean.FALSE);
|
|
|
+
|
|
|
+ log.info(" └─ 重置堵口时间状态: 原状态={} → 重置为False", isClosureTime.get());
|
|
|
isClosureTime.set(Boolean.FALSE);
|
|
|
|
|
|
+ log.info("🔢 【获取出铁次数】");
|
|
|
getIronTimeNo();
|
|
|
|
|
|
- // 关闭所有出铁相关定时任务
|
|
|
+ log.info("🔌 【任务管理】");
|
|
|
+ log.info(" ├─ 关闭所有出铁相关定时任务...");
|
|
|
cancelTappingTasks();
|
|
|
+ log.info(" └─ 已关闭所有出铁相关定时任务");
|
|
|
|
|
|
// 出铁计时
|
|
|
TIronSchedule tappingConsttime = scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_CONSTTIME);
|
|
|
if (tappingConsttime != null && "1".equals(tappingConsttime.getStatus())) {
|
|
|
+ log.info(" ⏱️ 【启动出铁计时任务】");
|
|
|
+ log.info(" ├─ 任务名称: {}", tappingConsttime.getName());
|
|
|
+ log.info(" ├─ 延迟时间: {}秒", tappingConsttime.getDelay());
|
|
|
+ log.info(" └─ 执行周期: {}秒", tappingConsttime.getPeriod());
|
|
|
scheduledTaskManager.addTask(tappingConsttime.getName(), tappingConsttime.getDelay(), tappingConsttime.getPeriod(), TimeUnit.SECONDS, () -> {
|
|
|
getIronTime();
|
|
|
mSecondsElapsed.incrementAndGet();
|
|
|
});
|
|
|
+ } else {
|
|
|
+ log.info(" ⏱️ 【出铁计时任务】未启动 (配置为null或status!=1)");
|
|
|
}
|
|
|
|
|
|
// 堵口模型
|
|
|
TIronSchedule closureWarn = scheduleMap.get(TaskNameConstants.TASKNAME_CLOSURE_WARN);
|
|
|
if (closureWarn != null && "1".equals(closureWarn.getStatus())) {
|
|
|
+ log.info(" 🔒 【启动堵口预警任务】");
|
|
|
+ log.info(" ├─ 任务名称: {}", closureWarn.getName());
|
|
|
+ log.info(" ├─ 延迟时间: {}秒", closureWarn.getDelay());
|
|
|
+ log.info(" └─ 执行周期: {}秒", closureWarn.getPeriod());
|
|
|
scheduledTaskManager.addTask(closureWarn.getName(), closureWarn.getDelay(), closureWarn.getPeriod(), TimeUnit.SECONDS, runnableClosureWarn());
|
|
|
+ } else {
|
|
|
+ log.info(" 🔒 【堵口预警任务】未启动 (配置为null或status!=1)");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 出铁超时报警
|
|
|
TIronSchedule tappingTimeoutWarn = scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TIMEOUT_WARN);
|
|
|
if (tappingTimeoutWarn != null && "1".equals(tappingTimeoutWarn.getStatus())) {
|
|
|
+ log.info(" ⚠️ 【启动出铁超时报警任务】");
|
|
|
+ log.info(" ├─ 任务名称: {}", tappingTimeoutWarn.getName());
|
|
|
+ log.info(" ├─ 延迟时间: {}秒", tappingTimeoutWarn.getDelay());
|
|
|
+ log.info(" └─ 执行周期: {}秒", tappingTimeoutWarn.getPeriod());
|
|
|
scheduledTaskManager.addTask(tappingTimeoutWarn.getName(), tappingTimeoutWarn.getDelay(), tappingTimeoutWarn.getPeriod(), TimeUnit.SECONDS, runnableTappingTimeout());
|
|
|
+ } else {
|
|
|
+ log.info(" ⚠️ 【出铁超时报警任务】未启动 (配置为null或status!=1)");
|
|
|
}
|
|
|
|
|
|
// 出铁超重报警
|
|
|
TIronSchedule tappingWeightoutWarn = scheduleMap.get(TaskNameConstants.TAPPING_WEIGHTOUT_WARN);
|
|
|
if (tappingWeightoutWarn != null && "1".equals(tappingWeightoutWarn.getStatus())) {
|
|
|
+ log.info(" ⚖️ 【启动出铁超重报警任务】");
|
|
|
+ log.info(" ├─ 任务名称: {}", tappingWeightoutWarn.getName());
|
|
|
+ log.info(" ├─ 延迟时间: {}秒", tappingWeightoutWarn.getDelay());
|
|
|
+ log.info(" └─ 执行周期: {}秒", tappingWeightoutWarn.getPeriod());
|
|
|
scheduledTaskManager.addTask(tappingWeightoutWarn.getName(), tappingWeightoutWarn.getDelay(), tappingWeightoutWarn.getPeriod(), TimeUnit.SECONDS, runnableTappingWeightout());
|
|
|
+ } else {
|
|
|
+ log.info(" ⚖️ 【出铁超重报警任务】未启动 (配置为null或status!=1)");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- // 堵口预测时间
|
|
|
-// 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));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
}
|
|
|
+ log.info("✅ ====== taphole1Start - 出铁开始处理完成 ======");
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -844,7 +1043,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
// 记录当前出铁统计信息
|
|
|
log.info("📊 出铁结束统计: 总时长={}分钟, 总重量={}吨",
|
|
|
getIronElapsedMinute(),
|
|
|
- mTotalWeight.get().doubleValue());
|
|
|
+ mTotalWeight.doubleValue());
|
|
|
|
|
|
log.info("🔒 设置是否出渣为False...");
|
|
|
isChuz.set(Boolean.FALSE);
|
|
@@ -904,7 +1103,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
|
|
|
|
|
|
int actualTime = getIronElapsedMinute();
|
|
|
- double actualWeight = mTotalWeight.get().doubleValue();
|
|
|
+ double actualWeight = mTotalWeight.doubleValue();
|
|
|
|
|
|
log.info("📈 实际数据: 时间={}分钟, 重量={}吨", actualTime, actualWeight);
|
|
|
|
|
@@ -1010,7 +1209,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
taskExecutor.submit(() -> {
|
|
|
PushData.send2Warn(WarnData.warnClose("堵口告警1", audioMap.get(ExceptionTypeEnum.CLOSURE1.getCode())));
|
|
|
- saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("建议将当前铁口堵口"));
|
|
|
+ saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过大,建议将当前铁口堵口"));
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
@@ -1039,7 +1238,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
taskExecutor.submit(() -> {
|
|
|
PushData.send2Warn(WarnData.warnClose("堵口告警2", audioMap.get(ExceptionTypeEnum.CLOSURE2.getCode())));
|
|
|
- saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("建议打开其他铁口,并将当前铁口堵口"));
|
|
|
+ saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过小,但其它铁口正在出铁,请将当前铁口堵口"));
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
@@ -1068,7 +1267,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.warn("模型3触发堵口告警3");
|
|
|
taskExecutor.submit(() -> {
|
|
|
PushData.send2Warn(WarnData.warnClose("堵口告警3", audioMap.get(ExceptionTypeEnum.CLOSURE3.getCode())));
|
|
|
- saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("建议将当前铁口堵口"));
|
|
|
+ saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过小且其他铁口均未出铁,请先将其它铁口打开,再进行堵口"));
|
|
|
//推送预警列表
|
|
|
getExceptionList();
|
|
|
});
|
|
@@ -1168,8 +1367,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
|
|
|
log.info("获取标准最大出铁重量: {} t", stdIronWeightMax);
|
|
|
|
|
|
- // 获取当前出铁重量
|
|
|
- double currentIronTime = mTotalWeight.get().doubleValue();
|
|
|
+ double currentIronTime = mTotalWeight.doubleValue();
|
|
|
log.info("当前出铁重量: {} t", currentIronTime);
|
|
|
|
|
|
// 检查是否重量
|
|
@@ -1256,7 +1454,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
// 记录计算参数详情
|
|
|
log.info("=== 打泥量计算参数 ===");
|
|
|
log.info("开口深度openDepth: {} mm", tappingData.getOpenDepth());
|
|
|
- log.info("实时铁水重量rtIronWeight: {} t", mTotalWeight.get().doubleValue());
|
|
|
+ log.info("实时铁水重量rtIronWeight: {} t", mTotalWeight.doubleValue());
|
|
|
log.info("出铁时间rtIronCosttime: {} min", getIronElapsedMinute());
|
|
|
log.info("平均流速rtIronSpeed: {} t/s",
|
|
|
speed1.get() > speed2.get() ? speed1.get() : speed2.get());
|
|
@@ -1277,12 +1475,12 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
// 设置上下文变量
|
|
|
mContext.setVariable(ExpressionConstants.openDepth, tappingData.getOpenDepth());
|
|
|
- mContext.setVariable(ExpressionConstants.rtIronWeight, mTotalWeight.get().doubleValue());
|
|
|
+ mContext.setVariable(ExpressionConstants.rtIronWeight, mTotalWeight.doubleValue());
|
|
|
mContext.setVariable(ExpressionConstants.rtIronCosttime, getIronElapsedMinute());
|
|
|
|
|
|
log.info("表达式变量设置完成 - openDepth: {}, rtIronWeight: {}, rtIronCosttime: {}",
|
|
|
tappingData.getOpenDepth(),
|
|
|
- mTotalWeight.get().doubleValue(),
|
|
|
+ mTotalWeight.doubleValue(),
|
|
|
getIronElapsedMinute());
|
|
|
|
|
|
// 计算打泥量
|
|
@@ -1303,9 +1501,9 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.info("📋 标准参数: 时间范围={}-{}分钟, 重量范围={}-{}吨", stdIronTimeMin, stdIronTimeMax, stdIronWeightMin, stdIronWeightMax);
|
|
|
|
|
|
// 1.出铁量 1000-1300t 1000以下,出铁时间变短,打泥量+5;1300以上-5
|
|
|
- if (mTotalWeight.get().doubleValue() < stdIronWeightMin) {
|
|
|
+ if (mTotalWeight.doubleValue() < stdIronWeightMin) {
|
|
|
bigDecimal = bigDecimal.add(BigDecimal.valueOf(5));
|
|
|
- } else if (mTotalWeight.get().doubleValue() > stdIronWeightMax) {
|
|
|
+ } else if (mTotalWeight.doubleValue() > stdIronWeightMax) {
|
|
|
bigDecimal = bigDecimal.subtract(BigDecimal.valueOf(5));
|
|
|
}
|
|
|
|
|
@@ -1459,7 +1657,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
// 计算实际数据
|
|
|
int actualIronTime = getIronElapsedMinute();
|
|
|
- double actualIronWeight = mTotalWeight.get().setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
|
+ double actualIronWeight = mTotalWeight.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
|
double actualIronSpeed = actualIronTime == 0 ? 0 : BigDecimal.valueOf(actualIronWeight).divide(BigDecimal.valueOf(actualIronTime), 2, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
|
|
OptionalDouble averageTemp = tempList.stream()
|
|
@@ -1569,7 +1767,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
ironTest.setAvgTemp(avgTemp + "");
|
|
|
ironTest.setIronWeight(actualIronWeight + "");
|
|
|
ironTest.setIronCosttime(actualIronTime);
|
|
|
- if(ObjectUtils.isNotEmpty(mTIronData)){
|
|
|
+ if (ObjectUtils.isNotEmpty(mTIronData)) {
|
|
|
ironTest.setIronDataId(mTIronData.getId());
|
|
|
}
|
|
|
|
|
@@ -1649,7 +1847,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
if (mTIronData != null) {
|
|
|
log.info(" │ ├─ 铁次ID: {}", mTIronData.getId());
|
|
|
log.info(" │ ├─ 开始时间: {}", mTIronData.getIronStarttime());
|
|
|
- log.info(" │ ├─ 当前重量: {}吨", mTotalWeight.get().doubleValue());
|
|
|
+ log.info(" │ ├─ 当前重量: {}吨", mTotalWeight.doubleValue());
|
|
|
log.info(" │ └─ 已用时长: {}分钟", getIronElapsedMinute());
|
|
|
}
|
|
|
log.info(" ├─ firstGetTappingStatus: {}", firstGetTappingStatus.get());
|
|
@@ -1753,14 +1951,14 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
if (mTIronData != null) {
|
|
|
log.info(" 📊 【出铁数据统计】");
|
|
|
log.info(" ├─ 铁次ID: {}", mTIronData.getId());
|
|
|
- log.info(" ├─ 总重量: {}吨", mTotalWeight.get().doubleValue());
|
|
|
+ log.info(" ├─ 总重量: {}吨", mTotalWeight.doubleValue());
|
|
|
log.info(" ├─ 总时长: {}分钟", getIronElapsedMinute());
|
|
|
log.info(" ├─ 开始时间: {}", mTIronData.getIronStarttime());
|
|
|
log.info(" └─ 结束时间: {}", LocalDateUtils.formatDate(opcData.getSourceTime()));
|
|
|
|
|
|
// 保存出铁数据
|
|
|
mTIronData.setIronCosttime(getIronElapsedMinute());
|
|
|
- mTIronData.setIronWeight(mTotalWeight.get().doubleValue());
|
|
|
+ mTIronData.setIronWeight(mTotalWeight.doubleValue());
|
|
|
mTIronData.setIronEndtime(LocalDateUtils.formatDate(opcData.getSourceTime()));
|
|
|
|
|
|
log.info(" 💾 【数据保存】");
|
|
@@ -1988,12 +2186,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
realtimeData.setUnit("t/min");
|
|
|
realtimeData.setDesc("铁水流速");
|
|
|
|
|
|
-// if (opcData.getPointName().contains(SubscribeTagConstants.TAG_CAR11(opcData.getServerType()))) {
|
|
|
-// speed1 = new AtomicDouble(Double.parseDouble(opcData.getData().toString()));
|
|
|
-// } else {
|
|
|
-// speed2 = new AtomicDouble(Double.parseDouble(opcData.getData().toString()));
|
|
|
-// }
|
|
|
-// mMaxSpeed = Math.max(speed1.get(), speed2.get());
|
|
|
+//
|
|
|
mContext.setVariable(ExpressionConstants.rtIronSpeed, speed);
|
|
|
|
|
|
mRealtimeData.put(IRON_SPEED, realtimeData);
|
|
@@ -2098,16 +2291,16 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
|
|
|
if (diff.compareTo(new BigDecimal("130")) > 0) {
|
|
|
log.info(" ├─ 🔄 检测到满载流量变化 (差值 > 130t)");
|
|
|
- log.info(" ├─ 累加前总流量: {} t", mTotalWeight.get());
|
|
|
+ log.info(" ├─ 累加前总流量: {} t", mTotalWeight);
|
|
|
|
|
|
- mTotalWeight.updateAndGet(prev -> prev.add(ironWeight1Pre));
|
|
|
+ mTotalWeight = mTotalWeight.add(ironWeight1Pre);
|
|
|
|
|
|
- log.info(" ├─ ✅ 累加后总流量: {} t", mTotalWeight.get());
|
|
|
+ log.info(" ├─ ✅ 累加后总流量: {} t", mTotalWeight);
|
|
|
log.info(" ├─ 📊 本次累加流量: {} t", ironWeight1Pre);
|
|
|
- log.info(" ├─ 📊 累计总流量: {} t", mTotalWeight.get());
|
|
|
+ log.info(" ├─ 📊 累计总流量: {} t", mTotalWeight);
|
|
|
|
|
|
log.info("铁水总流量:{},1号线铁水满载流量:{},下一个流量:{}",
|
|
|
- mTotalWeight.get(), ironWeight1Pre, bigDecimalNew);
|
|
|
+ mTotalWeight, ironWeight1Pre, bigDecimalNew);
|
|
|
} else {
|
|
|
log.info(" ├─ ⏭️ 未达到满载阈值 (差值 ≤ 130t),跳过累加");
|
|
|
log.info(" ├─ 当前差值: {} t ≤ 130 t", diff);
|
|
@@ -2381,7 +2574,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
ironWeight.setValue(mTotalWeight);
|
|
|
ironWeight.setTime(LocalDateUtils.formatDate(opcData.getServerTime()));
|
|
|
mRealtimeData.put(IRON_WEIGHT, ironWeight);
|
|
|
- mContext.setVariable(ExpressionConstants.rtIronWeight, mTotalWeight.get().doubleValue());
|
|
|
+ mContext.setVariable(ExpressionConstants.rtIronWeight, mTotalWeight.doubleValue());
|
|
|
|
|
|
//推送实时数据
|
|
|
PushData.send2RealtimeData(mRealtimeData);
|
|
@@ -2428,7 +2621,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.info(" ├─ 执行操作: setAllStepPassResult(mSteps, 0)");
|
|
|
|
|
|
setAllStepPassResult(mSteps, 0);
|
|
|
- lastIronLoading1.set(ironLoading1.get());
|
|
|
+ lastIronLoading1.set(0);
|
|
|
|
|
|
log.info(" ├─ 状态更新完成: lastIronLoading1 = {}", lastIronLoading1.get());
|
|
|
log.info(" └─ 状态同步完成 ✅");
|
|
@@ -2448,7 +2641,7 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.info(" ├─ 执行操作: setAllStepPassResult(mSteps, 1)");
|
|
|
|
|
|
setAllStepPassResult(mSteps, 1);
|
|
|
- lastIronLoading1.set(ironLoading1.get());
|
|
|
+ lastIronLoading1.set(1);
|
|
|
|
|
|
log.info(" ├─ 状态更新完成: lastIronLoading1 = {}", lastIronLoading1.get());
|
|
|
log.info(" └─ 状态同步完成 ✅");
|
|
@@ -2653,7 +2846,10 @@ public class DeviceEventListener extends AbstractEventListener { //
|
|
|
log.debug("步骤 {} 无通过条件,保持默认状态", stepVO.getStepId());
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> extraInfo = new HashMap<>();
|
|
|
+ Map<String, Object> extraInfo = stepVO.getExtraInfo();
|
|
|
+ if (extraInfo == null) {
|
|
|
+ extraInfo = new HashMap<>();
|
|
|
+ }
|
|
|
extraInfo.put("pointData", stepVO.getData());
|
|
|
|
|
|
if ("yc".equals(stepVO.getIdentifier()) //压差
|