Răsfoiți Sursa

1.修复大屏折线图显示问题
2.添加异常类型枚举

wangxiaofei 2 luni în urmă
părinte
comite
a331898dd5

+ 59 - 0
taphole-iron/src/main/java/com/sckj/iron/constant/ExceptionTypeEnum.java

@@ -0,0 +1,59 @@
+package com.sckj.iron.constant;
+
+public enum ExceptionTypeEnum {
+    // 枚举项:数据名称("数据值")
+    KAI_KOU_CHAO_SHI("开口超时", "001001"),
+    TIE_SHUI_WEN_DU_GUO_DI("铁水温度过低", "005002"),
+    TIE_SHUI_WEN_DU_GUO_GAO("铁水温度过高", "005001"),
+    JI_XU_KAI_KOU("急需开口", "006"),
+    JI_XU_DU_KOU("急需堵口", "007"),
+    JI_XU_CHU_TIE("急需出铁", "008"),
+    TIE_SHUI_LIU_SU_GUO_MAN("铁水流速过慢", "004002"),
+    TIE_SHUI_LIU_SU_GUO_KUAI("铁水流速过快", "004001"),
+    CHU_TIE_LIANG_TAI_SHAO("出铁量过少", "003002"),
+    CHU_TIE_LIANG_TAI_DUO("出铁量过多", "003001"),
+    CHU_TIE_SHI_JIAN_TAI_DUAN("出铁时间过短", "002002"),
+    CHU_TIE_SHI_JIAN_TAI_CHANG("出铁时间过长", "002001"),
+    KAI_KOU_HAO_SHI_GUO_DUAN("开口耗时过短", "001002"),
+    TIE_SHUI_WEN_DU("铁水温度", "005"),
+    TIE_SHUI_LIU_SU("铁水流速", "004"),
+    CHU_TIE_LIANG("出铁量", "003"),
+    CHU_TIE_SHI_JIAN("出铁时间", "002"),
+    KAI_KOU_FAN_YING("开口反应", "001");
+
+    private final String name;
+    private final String code;
+
+    ExceptionTypeEnum(String name, String code) {
+        this.name = name;
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    // 可选:通过数据名称查找
+    public static ExceptionTypeEnum fromName(String name) {
+        for (ExceptionTypeEnum e : values()) {
+            if (e.name.equals(name)) {
+                return e;
+            }
+        }
+        return null;
+    }
+
+    // 可选:通过数据值查找
+    public static ExceptionTypeEnum fromCode(String code) {
+        for (ExceptionTypeEnum e : values()) {
+            if (e.code.equals(code)) {
+                return e;
+            }
+        }
+        return null;
+    }
+}

+ 89 - 106
taphole-iron/src/main/java/com/sckj/iron/service/impl/TIronVisualScreenServiceImpl.java

@@ -46,19 +46,22 @@ public class TIronVisualScreenServiceImpl {
         CompletableFuture<TL2Data> preL2Future = CompletableFuture.supplyAsync(() ->
                 tl2DataService.lambdaQuery()
                         .le(TL2Data::getIronStarttime, new SimpleDateFormat("yyyyMMddHHmmss").format(new java.util.Date()))
-                        .eq(TL2Data::getTapholeId,"1")
+                        .eq(TL2Data::getTapholeId, "1")
                         .orderByDesc(TL2Data::getIronStarttime)
                         .last("limit 1").one()
         );
 
         // 1. 计算起止时间
-        int hours = 24;
-        //给固定时间,24小时之内
-        java.util.Date endTime = new java.util.Date();
-        java.util.Calendar cal = java.util.Calendar.getInstance();
-        cal.setTime(endTime);
-        cal.add(java.util.Calendar.HOUR_OF_DAY, -hours);
-        java.util.Date startTime = cal.getTime();
+        // 临时调试用,固定时间范围
+        final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        final java.util.Date startTime;
+        final java.util.Date endTime;
+        try {
+            startTime = sdf.parse("2025-07-13 02:15:00");
+            endTime = sdf.parse("2025-07-14 00:20:00");
+        } catch (Exception e) {
+            throw new RuntimeException("时间解析失败", e);
+        }
 
 
         // 1. 生成完整的每一分钟时间点
@@ -118,6 +121,7 @@ public class TIronVisualScreenServiceImpl {
             TL2Data preL2 = preL2Future.get();
 
 
+            //如果开始时间点没有值就从最近的获取
             OPCData preTapping = preTappingFuture.get();
 
             if (preTapping != null && preTapping.getData() != null) {
@@ -238,7 +242,7 @@ public class TIronVisualScreenServiceImpl {
             List<IronTrendL1DTO> car2List = car2ListFuture.get();
 
             int ironWeightScale = 2; // 可调整为0、1、2等
-            List<List<Object>> ironFlowArr = buildIronFlowMinuteArray(xAxis, tappingMap, weight1List, weight2List, ironWeightScale);
+            List<List<Object>> ironFlowArr = buildIronWeightMinuteArray(xAxis, tappingMap, weight1List, weight2List, ironWeightScale);
 
             if (ObjectUtils.isNotEmpty(ironFlowArr)) {
                 List<Map<String, Object>> mapList = new ArrayList<>();
@@ -248,7 +252,7 @@ public class TIronVisualScreenServiceImpl {
                     for (IronTrendL1DTO ironTrendL1DTO : car1List) {
                         if (sdfMinute.format(ironTrendL1DTO.getCreateTime()).equals(string)) {
                             Map<String, Object> map = new HashMap<>();
-                            map.put("value", ironTrendL1DTO.getData()+"#");
+                            map.put("value", ironTrendL1DTO.getData() + "#");
                             map.put("xAxis", sdfMinute.format(ironTrendL1DTO.getCreateTime()));
                             map.put("yAxis", data);
                             mapList.add(map);
@@ -257,7 +261,7 @@ public class TIronVisualScreenServiceImpl {
                     for (IronTrendL1DTO ironTrendL1DTO : car2List) {
                         if (sdfMinute.format(ironTrendL1DTO.getCreateTime()).equals(string)) {
                             Map<String, Object> map = new HashMap<>();
-                            map.put("value", ironTrendL1DTO.getData()+"#");
+                            map.put("value", ironTrendL1DTO.getData() + "#");
                             map.put("xAxis", sdfMinute.format(ironTrendL1DTO.getCreateTime()));
                             map.put("yAxis", data);
                             mapList.add(map);
@@ -280,11 +284,11 @@ public class TIronVisualScreenServiceImpl {
                     List<Map<String, Object>> mapList = new ArrayList<>();
                     Map<String, Object> map = new HashMap<>();
                     map.put("name", String.format("第%s次出铁\n(%s号铁口)%s分钟", item.getIronNo(), item.getTapholeId(), item.getIronCosttime()));
-                    map.put("xAxis", TimeUtils.formatPartialDateStringExcludeYear(item.getIronStarttime()));
+                    map.put("xAxis", TimeUtils.formatPartialDateString(item.getIronStarttime()));
                     mapList.add(map);
 
                     map = new HashMap<>();
-                    map.put("xAxis", TimeUtils.formatPartialDateStringExcludeYear(item.getIronEndtime()));
+                    map.put("xAxis", TimeUtils.formatPartialDateString(item.getIronEndtime()));
                     mapList.add(map);
 
                     return mapList;
@@ -314,14 +318,16 @@ public class TIronVisualScreenServiceImpl {
      * @return
      */
     public Map<String, Object> getIronChart(TrendRequest queryDateType) {
-        // 1. 计算起止时间
-        int hours = Objects.isNull(queryDateType.getQueryHourBefore()) ? 24 : queryDateType.getQueryHourBefore();
-        //给固定时间,24小时之内
-        java.util.Date endTime = new java.util.Date();
-        java.util.Calendar cal = java.util.Calendar.getInstance();
-        cal.setTime(endTime);
-        cal.add(java.util.Calendar.HOUR_OF_DAY, -hours);
-        java.util.Date startTime = cal.getTime();
+        // 临时调试用,固定时间范围
+        final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        final java.util.Date startTime;
+        final java.util.Date endTime;
+        try {
+            startTime = sdf.parse("2025-07-13 02:15:00");
+            endTime = sdf.parse("2025-07-14 00:20:00");
+        } catch (Exception e) {
+            throw new RuntimeException("时间解析失败", e);
+        }
 
         // 2. 异步查询所有数据
         CompletableFuture<List<OPCData>> opcDataFuture = CompletableFuture.supplyAsync(() ->
@@ -346,7 +352,7 @@ public class TIronVisualScreenServiceImpl {
                         .between(TL2Data::getIronStarttime,
                                 new SimpleDateFormat("yyyyMMddHHmmss").format(startTime),
                                 new SimpleDateFormat("yyyyMMddHHmmss").format(endTime))
-                        .eq(TL2Data::getTapholeId,"1")
+                        .eq(TL2Data::getTapholeId, "1")
                         .orderByAsc(TL2Data::getIronStarttime)
                         .list()
         );
@@ -517,7 +523,7 @@ public class TIronVisualScreenServiceImpl {
                     // L2类
                     TL2Data preL2 = tl2DataService.lambdaQuery()
                             .lt(TL2Data::getIronStarttime, new SimpleDateFormat("yyyyMMddHHmmss").format(startTime))
-                            .eq(TL2Data::getTapholeId,"1")
+                            .eq(TL2Data::getTapholeId, "1")
                             .orderByDesc(TL2Data::getIronStarttime)
                             .last("limit 1").one();
 
@@ -574,8 +580,9 @@ public class TIronVisualScreenServiceImpl {
                         if (v != null) last = v;
                     }
 
+
                     int ironWeightScale = 2; // 可调整为0、1、2等
-                    List<List<Object>> ironFlowArr = buildIronFlowMinuteArray(xAxis, tappingMap, weight1List, weight2List, ironWeightScale);
+                    List<List<Object>> ironFlowArr = buildIronWeightMinuteArray(xAxis, tappingMap, weight1List, weight2List, ironWeightScale);
                     result.put("ironWeight", ironFlowArr);
 
                     // 处理铁水流速,出铁中按原逻辑,出铁结束后为0
@@ -589,15 +596,6 @@ public class TIronVisualScreenServiceImpl {
                     }
                     result.put("ironSpeed", ironSpeedArr);
 
-//                    List<List<Object>> ironCosttime =  buildMinuteArray(elemenList, xAxis, "ironCosttime", preL2 != null ? preL2.getIronCosttime() : null);
-//                    for (int i = 0; i < xAxis.size(); i++) {
-//                        String t = xAxis.get(i);
-//                        Integer tapping = tappingMap.getOrDefault(t, 0);
-//                        if (tapping == 0 && ironCosttime.get(i).size() > 1) {
-//                            ironCosttime.get(i).set(1, 0);
-//                        }
-//                    }
-//                    result.put("ironCosttime", ironCosttime);
 
                     // 处理L2类数据,tapping=0时设为0
                     List<List<Object>> elementSArr = buildMinuteArray(elemenList, xAxis, "elementS", preL2 != null ? preL2.getElementS() : null);
@@ -662,7 +660,7 @@ public class TIronVisualScreenServiceImpl {
     }
 
 
-    // 合并铁水流速专用
+    // 铁水流速
     private java.util.List<java.util.List<Object>> buildMinuteArrayForSpeed(java.util.List<String> xAxis, java.util.List<IronTrendL1DTO> speed1List, java.util.List<IronTrendL1DTO> speed2List, Object pre1, Object pre2) {
         java.util.Map<String, Double> speed1Map = new java.util.LinkedHashMap<>();
         java.util.Map<String, Double> speed2Map = new java.util.LinkedHashMap<>();
@@ -769,7 +767,7 @@ public class TIronVisualScreenServiceImpl {
                         v = e.getIronCosttime();
                         break;
                 }
-                timeValueMap.put(min, v);
+                timeValueMap.put(TimeUtils.formatPartialDateString(min), v);
             }
         }
         java.util.List<java.util.List<Object>> arr = new java.util.ArrayList<>();
@@ -783,9 +781,8 @@ public class TIronVisualScreenServiceImpl {
     }
 
 
-    // 新增:铁水流量分钟累计显示方法V3,分别处理weight1Map和weight2Map
-    private List<List<Object>> buildIronFlowMinuteArray(List<String> xAxis, Map<String, Integer> tappingMap, List<IronTrendL1DTO> weight1List, List<IronTrendL1DTO> weight2List, int scale) {
-        // 先转为map,key为分钟字符串
+    //
+    private List<List<Object>> buildIronWeightMinuteArray(List<String> xAxis, Map<String, Integer> tappingMap, List<IronTrendL1DTO> weight1List, List<IronTrendL1DTO> weight2List, int scale) {
         Map<String, Double> weight1Map = new LinkedHashMap<>();
         for (IronTrendL1DTO e : weight1List) {
             if (e.getCreateTime() != null) {
@@ -802,7 +799,9 @@ public class TIronVisualScreenServiceImpl {
                         }
                     }
                 }
-                if (value != null) weight1Map.put(min, value);
+                if (value != null) {
+                    weight1Map.put(min, value);
+                }
             }
         }
         Map<String, Double> weight2Map = new LinkedHashMap<>();
@@ -821,84 +820,68 @@ public class TIronVisualScreenServiceImpl {
                         }
                     }
                 }
-                if (value != null) weight2Map.put(min, value);
+                if (value != null) {
+                    weight2Map.put(min, value);
+                }
             }
         }
+        // 合并weight1Map和weight2Map到weightMap,取最大值
+        Map<String, Double> weightMap = new LinkedHashMap<>();
+        for (Map.Entry<String, Double> entry : weight1Map.entrySet()) {
+            weightMap.put(entry.getKey(), entry.getValue());
+        }
+        for (Map.Entry<String, Double> entry : weight2Map.entrySet()) {
+            weightMap.put(entry.getKey(), Math.max(weightMap.getOrDefault(entry.getKey(), 0d), entry.getValue()));
+        }
+        // 按key正序排序
+        weightMap = weightMap.entrySet().stream()
+                .sorted(Map.Entry.comparingByKey())
+                .collect(java.util.LinkedHashMap::new, (m, e) -> m.put(e.getKey(), e.getValue()), java.util.LinkedHashMap::putAll);
         List<List<Object>> arr = new ArrayList<>();
-        double accWeight = 0;
-        // 1号车状态
-        double max1 = 0, last1 = 0;
-        boolean inCycle1 = false;
-        // 2号车状态
-        double max2 = 0, last2 = 0;
-        boolean inCycle2 = false;
+        boolean inTappingCycle = false;
+        java.math.BigDecimal cycleTotal = java.math.BigDecimal.ZERO;
+        java.math.BigDecimal lastW = java.math.BigDecimal.ZERO;
         for (int i = 0; i < xAxis.size(); i++) {
-            String t = xAxis.get(i);
-            Integer tapping = tappingMap.getOrDefault(t, 0);
-            double w1 = weight1Map.getOrDefault(t, 0d);
-            double w2 = weight2Map.getOrDefault(t, 0d);
-
+            String time = xAxis.get(i);
+            Integer tapping = tappingMap.getOrDefault(time, 0);
+            Double orDefault = weightMap.get(time);
+            java.math.BigDecimal w = new java.math.BigDecimal(weightMap.getOrDefault(time, 0d).toString());
             if (tapping == 1) {
-                // 1号车逻辑
-                if (w1 > 0) {
-                    if (!inCycle1) {
-                        inCycle1 = true;
-                        max1 = w1;
-                    } else {
-                        if (w1 > max1) max1 = w1;
-                    }
+                if (!inTappingCycle) {
+                    inTappingCycle = true;
+                    System.out.println("[出铁周期结束] 开始于: " + time);
                 }
-                // 2号车逻辑
-                if (w2 > 0) {
-                    if (!inCycle2) {
-                        inCycle2 = true;
-                        max2 = w2;
-                    } else {
-                        if (w2 > max2) max2 = w2;
-                    }
+                if (w.compareTo(java.math.BigDecimal.ZERO) == 0) {
+                    w = lastW;
+                    weightMap.put(time,w.doubleValue());
+                } else {
+                    lastW = w;
                 }
-
-                // 检查1号车归零
-                boolean add1 = false;
-                if (inCycle1 && w1 == 0 && last1 > 0) {
-                    add1 = true;
-                    inCycle1 = false;
-                }
-                // 检查2号车归零
-                boolean add2 = false;
-                if (inCycle2 && w2 == 0 && last2 > 0) {
-                    add2 = true;
-                    inCycle2 = false;
-                }
-
-                // 归零时把最大值加到累计值
-                if (add1 && max1 > 0) {
-                    accWeight += max1;
-                    max1 = 0;
-                }
-                if (add2 && max2 > 0) {
-                    accWeight += max2;
-                    max2 = 0;
+                if (i > 0) {
+                    java.math.BigDecimal prevW = new java.math.BigDecimal(weightMap.getOrDefault(xAxis.get(i - 1), 0d).toString());
+                    //上一个减去当前的
+                    if (prevW.subtract(w).compareTo(new java.math.BigDecimal("130")) > 0) {
+                        System.out.println("[出铁周期满载情况] 时间: " + xAxis.get(i - 1) + ", 铁水满载值: " + prevW);
+                        cycleTotal = cycleTotal.add(prevW);
+                    }
                 }
-
-                // tapping=1时,显示accWeight+max(max1,max2)
-                double value = accWeight + Math.max(max1, max2);
-                double factor = Math.pow(10, scale);
-                value = Math.round(value * factor) / factor;
-                arr.add(Arrays.asList(t, value));
+                arr.add(java.util.Arrays.asList(time, w.add(cycleTotal).setScale(scale, java.math.RoundingMode.HALF_UP).doubleValue()));
             } else {
-                // tapping=0时,重置所有累计和周期最大值
-                accWeight = 0;
-                max1 = 0;
-                max2 = 0;
-                inCycle1 = false;
-                inCycle2 = false;
-                double value = 0;
-                arr.add(Arrays.asList(t, value));
+                if (inTappingCycle) {
+                    double value = cycleTotal.setScale(scale, java.math.RoundingMode.HALF_UP).doubleValue();
+                    System.out.println("[出铁周期结束] 结束于: " + time + ", 本周期铁水总净重: " + value);
+                    arr.add(java.util.Arrays.asList(time, value));
+                    inTappingCycle = false;
+                    cycleTotal = java.math.BigDecimal.ZERO;
+                    for (List<Object> objects : arr) {
+                        System.out.println(objects.get(0)+" >>> "+objects.get(1));
+                    }
+                } else {
+                    arr.add(java.util.Arrays.asList(time, 0));
+                }
             }
-            last1 = w1;
-            last2 = w2;
         }
+
         return arr;
     }
 }

+ 135 - 25
taphole-iron/src/main/java/com/sckj/iron/socketio/DeviceEventListener.java

@@ -17,7 +17,6 @@ import com.sckj.iron.dto.*;
 import com.sckj.iron.entity.*;
 import com.sckj.iron.service.impl.*;
 import com.sckj.iron.util.LocalDateUtils;
-import com.sckj.iron.util.RangeUtils;
 import com.sckj.iron.vo.IronStepVO;
 import com.sckj.l2.dto.TrendRequest;
 import com.sckj.l2.entity.TL2Data;
@@ -215,10 +214,10 @@ public class DeviceEventListener extends AbstractEventListener { //
 
 
     //实时温度最大值
-    private AtomicDouble rtTempMax = new AtomicDouble(0);
+    private AtomicInteger rtTempMax = new AtomicInteger(0);
 
     //实时温度最小值
-    private AtomicDouble rtTempMin = new AtomicDouble(0);
+    private AtomicInteger rtTempMin = new AtomicInteger(0);
 
     private String SERVER_URL = "";
 
@@ -248,6 +247,12 @@ public class DeviceEventListener extends AbstractEventListener { //
     //预警出铁模型连续计数
     private Map<String, Integer> tappingWarnCountMap = new ConcurrentHashMap<>();
 
+    //流速连续计数
+    private Map<String, Integer> speedWarnCountMap = new ConcurrentHashMap<>();
+
+    //温度连续计数
+    private Map<String, Integer> tempWarnCountMap = new ConcurrentHashMap<>();
+
     // 定时任务统一管理
     private Map<String, TIronSchedule> scheduleMap = new ConcurrentHashMap<>();
 
@@ -291,7 +296,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                     if ("prod".equals(activeProfiles)) {
                         log.info("HDC subscribe available");
                         hdService.subscribeAvailable();
-                    } else {
+                    } else  if ("test".equals(activeProfiles)) {
                         log.info("DA subscribe available");
                         opcuaService.subscribeAvailable();
                     }
@@ -354,15 +359,15 @@ public class DeviceEventListener extends AbstractEventListener { //
                     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, Double.parseDouble(StandardConstans.STANDARD_IRON_TIME.split("-")[0]));
-                    mContext.setVariable(ExpressionConstants.stdIronTimeMax, Double.parseDouble(StandardConstans.STANDARD_IRON_TIME.split("-")[1]));
+                    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, Double.parseDouble(StandardConstans.STANDARD_TEMP.split("-")[0]));
-                    mContext.setVariable(ExpressionConstants.stdTempMax, Double.parseDouble(StandardConstans.STANDARD_TEMP.split("-")[1]));
+                    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);
@@ -376,8 +381,8 @@ public class DeviceEventListener extends AbstractEventListener { //
                     StandardConstans.STANDARD_MUD_MACHINE_PRESSURE = Double.parseDouble(mIronParam.getParamValue());
                 }
             }
-            log.info("STANDARD_SPEED: {},PRESSURE_DIFF_VALUE:{}", StandardConstans.STANDARD_SPEED, StandardConstans.STANDARD_PRESSURE_DIFF);
-            log.info("IRON_TIME: {},SERVER_URL:{}", StandardConstans.STANDARD_IRON_TIME, SERVER_URL);
+            // log.info("STANDARD_SPEED: {},PRESSURE_DIFF_VALUE:{}", StandardConstans.STANDARD_SPEED, StandardConstans.STANDARD_PRESSURE_DIFF);
+            // log.info("IRON_TIME: {},SERVER_URL:{}", StandardConstans.STANDARD_IRON_TIME, SERVER_URL);
         }
     }
 
@@ -632,9 +637,9 @@ public class DeviceEventListener extends AbstractEventListener { //
                         int count = closureWarnCountMap.getOrDefault(modelKey1, 0) + 1;
                         closureWarnCountMap.put(modelKey1, count);
                         if (count >= triggerCount1) {
-                            PushData.send2Warn(WarnData.warnClose("铁水流速过快告警", closureAlarmUrl));
+                            PushData.send2Warn(WarnData.warnClose("堵口告警", closureAlarmUrl));
                             taskExecutor.submit(() -> {
-                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("7000").exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_DU_KOU.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
                                 //推送预警列表
                                 getExceptionList();
                             });
@@ -654,9 +659,9 @@ public class DeviceEventListener extends AbstractEventListener { //
                         int count = closureWarnCountMap.getOrDefault(modelKey2, 0) + 1;
                         closureWarnCountMap.put(modelKey2, count);
                         if (count >= triggerCount2) {
-                            PushData.send2Warn(WarnData.warnClose("铁水流速过慢告警", closureAlarmUrl));
+                            PushData.send2Warn(WarnData.warnClose("堵口告警", closureAlarmUrl));
                             taskExecutor.submit(() -> {
-                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("8000").exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_DU_KOU.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
                                 //推送预警列表
                                 getExceptionList();
                             });
@@ -676,9 +681,9 @@ public class DeviceEventListener extends AbstractEventListener { //
                         int count = closureWarnCountMap.getOrDefault(modelKey3, 0) + 1;
                         closureWarnCountMap.put(modelKey3, count);
                         if (count >= triggerCount3) {
-                            PushData.send2Warn(WarnData.warnClose("铁水流速过慢告警", closureAlarmUrl));
+                            PushData.send2Warn(WarnData.warnClose("堵口告警", closureAlarmUrl));
                             taskExecutor.submit(() -> {
-                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("8000").exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_DU_KOU.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
                                 //推送预警列表
                                 getExceptionList();
                             });
@@ -728,15 +733,17 @@ public class DeviceEventListener extends AbstractEventListener { //
             TIronSchedule tappingTimeoutWarn = scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TIMEOUT_WARN);
             if (tappingTimeoutWarn != null && "1".equals(tappingTimeoutWarn.getStatus())) {
                 scheduledTaskManager.addTask(tappingTimeoutWarn.getName(), tappingTimeoutWarn.getDelay(), tappingTimeoutWarn.getPeriod(), TimeUnit.SECONDS, () -> {
-                    // log.info("已出铁时间(秒):{},标准出铁时间(秒):{}", seconds, STANDARD_IRON_TIME.get());
-                    if (!RangeUtils.isInRange(StandardConstans.STANDARD_IRON_TIME, getIronElapsedMinute())) {
-                        PushData.send2Warn(WarnData.warnTappingTimeout("出铁时间过长告警", tappingTimeoutAlramUrl));
+                    //出铁时间长短告警
+                    int stdIronTimeMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMax).toString());
+
+                    if (getIronElapsedMinute() > stdIronTimeMax) {
                         taskExecutor.submit(() -> {
-                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("3000").exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
+                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_SHI_JIAN_TAI_CHANG.getCode()).exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
                             //推送预警列表
                             getExceptionList();
                         });
                     }
+
                 });
             }
 
@@ -804,6 +811,43 @@ public class DeviceEventListener extends AbstractEventListener { //
             mCalcHitMud = "";
             PushData.send2IronHitMud(mCalcHitMud);
 
+            //出铁时间长短告警
+            int stdIronTimeMin = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMin).toString());
+            int stdIronTimeMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdIronTimeMax).toString());
+
+            if (getIronElapsedMinute() < stdIronTimeMin) {
+                taskExecutor.submit(() -> {
+                    exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_SHI_JIAN_TAI_DUAN.getCode()).exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
+                    //推送预警列表
+                    getExceptionList();
+                });
+            } else if (getIronElapsedMinute() > stdIronTimeMax) {
+                taskExecutor.submit(() -> {
+                    exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_SHI_JIAN_TAI_CHANG.getCode()).exceptionDesc(String.format("出铁时间:%s分钟", getIronElapsedMinute())).build());
+                    //推送预警列表
+                    getExceptionList();
+                });
+            }
+
+            //出铁量多少告警
+            double stdIronWeightMin = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMin).toString());
+            double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
+
+            if (mTotalWeight.doubleValue() < stdIronWeightMin) {
+                taskExecutor.submit(() -> {
+                    exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_LIANG_TAI_SHAO.getCode()).exceptionDesc(String.format("出铁量%s吨", mTotalWeight)).build());
+                    //推送预警列表
+                    getExceptionList();
+                });
+            } else if (mTotalWeight.doubleValue() > stdIronWeightMax) {
+                taskExecutor.submit(() -> {
+                    exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.CHU_TIE_LIANG_TAI_DUO.getCode()).exceptionDesc(String.format("出铁量%s吨", mTotalWeight)).build());
+                    //推送预警列表
+                    getExceptionList();
+                });
+            }
+
+
             // 出铁诊断模型
             TIronSchedule tappingTest = scheduleMap.get(TaskNameConstants.TASKNAME_TAPPING_TEST);
             TIronModel modelTappingTest = modelMap.get(ModelConstants.tapping_test);
@@ -848,9 +892,9 @@ public class DeviceEventListener extends AbstractEventListener { //
 
                             boolean ironTempChangeBool = mParser.parseExpression(split[3]).getValue(mContext, Boolean.class);
                             if (ironTempChangeBool) {
-                                testResultStr += "铁水温度变化符合预期。";
+                                testResultStr += "铁水温度符合预期。";
                             } else {
-                                testResultStr += "铁水温度变化不符合预期。";
+                                testResultStr += "铁水温度不符合预期。";
                             }
                             TIronTest ironTest = new TIronTest();
                             String testStatus = (ironTimeBool && ironWeightBool && ironSpeedBool && ironTempChangeBool) ? "1" : "0";
@@ -883,7 +927,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                             tappingWarnCountMap.put(modelKey, count);
                             if (count >= triggerCount) {
                                 PushData.send2Warn(WarnData.warnTapping("急需出铁告警", tappingAlramUrl));
-                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("10000").exceptionDesc(String.format("压差压差超过:%s,请降低送风流量,并操作出铁",String.valueOf(mContext.lookupVariable(ExpressionConstants.stdPressureDiff)))).build());
+                                exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.JI_XU_CHU_TIE.getCode()).exceptionDesc(String.format("压差压差超过:%s,请降低送风流量,并操作出铁", String.valueOf(mContext.lookupVariable(ExpressionConstants.stdPressureDiff)))).build());
                                 tappingWarnCountMap.put(modelKey, 0);
                                 //推送预警列表
                                 getExceptionList();
@@ -928,7 +972,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                 mRealtimeData.put(IRON_TEMP, realtimeData);
                 mRealtimeLegend.put(IRON_TEMP, realtimeData);
 
-                double tempNow = Double.parseDouble(opcData.getData().toString());
+                int tempNow = Integer.parseInt(opcData.getData().toString());
 
                 if (rtTempMax.get() <= 0 || tempNow > rtTempMax.get()) {
                     rtTempMax.set(tempNow);
@@ -941,6 +985,38 @@ public class DeviceEventListener extends AbstractEventListener { //
                 mContext.setVariable(ExpressionConstants.rtIronTemp, opcData.getData());
                 mContext.setVariable(ExpressionConstants.rtIronTempDiff, rtTempMax.get() - rtTempMin.get());
 
+                int stdTempMin = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdTempMin).toString());
+                int stdTempMax = Integer.parseInt(mContext.lookupVariable(ExpressionConstants.stdTempMax).toString());
+
+                if (tempNow < stdTempMin) {
+                    int count = tempWarnCountMap.getOrDefault("tempMinWarn", 0) + 1;
+                    tempWarnCountMap.put("tempMinWarn", count);
+                    if (count >= 3) {
+                        taskExecutor.submit(() -> {
+                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_WEN_DU_GUO_DI.getCode()).exceptionDesc(String.format("温度%s℃", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                            //推送预警列表
+                            getExceptionList();
+                        });
+                        tempWarnCountMap.put("tempMinWarn", 0);
+                        return;
+                    }
+                } else if (tempNow > stdTempMax) {
+                    int count = tempWarnCountMap.getOrDefault("tempMaxWarn", 0) + 1;
+                    tempWarnCountMap.put("tempMaxWarn", count);
+                    if (count >= 3) {
+                        taskExecutor.submit(() -> {
+                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_WEN_DU_GUO_GAO.getCode()).exceptionDesc(String.format("温度%s℃", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                            //推送预警列表
+                            getExceptionList();
+                        });
+                        tempWarnCountMap.put("tempMaxWarn", 0);
+                        return;
+                    }
+                } else {
+                    closureWarnCountMap.put("tempMinWarn", 0);
+                    closureWarnCountMap.put("tempMaxWarn", 0);
+                }
+
             } else if (opcData.getPointName().contains(SubscribeTagConstants.TAG_CAR11(opcData.getServerType())) || opcData.getPointName().contains(SubscribeTagConstants.TAG_CAR12(opcData.getServerType()))) {
                 //1TH-1号车受铁速度、1TH-2号车受铁速度、
                 RealtimeData realtimeData = new RealtimeData();
@@ -958,6 +1034,40 @@ public class DeviceEventListener extends AbstractEventListener { //
 
                 mRealtimeData.put(IRON_SPEED, realtimeData);
                 mRealtimeLegend.put(IRON_SPEED, realtimeData);
+
+
+                double stdSpeedMin = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdSpeedMin).toString());
+                double stdSpeedMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdSpeedMax).toString());
+
+                if (mMaxSpeed < stdSpeedMin) {
+                    int count = speedWarnCountMap.getOrDefault("speedMinWarn", 0) + 1;
+                    speedWarnCountMap.put("speedMinWarn", count);
+                    if (count >= 3) {
+                        taskExecutor.submit(() -> {
+                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_MAN.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                            //推送预警列表
+                            getExceptionList();
+                        });
+                        speedWarnCountMap.put("speedMinWarn", 0);
+                        return;
+                    }
+                } else if (mMaxSpeed > stdSpeedMax) {
+                    int count = speedWarnCountMap.getOrDefault("speedMaxWarn", 0) + 1;
+                    speedWarnCountMap.put("speedMaxWarn", count);
+                    if (count >= 3) {
+                        taskExecutor.submit(() -> {
+                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.TIE_SHUI_LIU_SU_GUO_KUAI.getCode()).exceptionDesc(String.format("流速%s吨/分钟", mContext.lookupVariable(ExpressionConstants.rtIronSpeed))).build());
+                            //推送预警列表
+                            getExceptionList();
+                        });
+                        speedWarnCountMap.put("speedMaxWarn", 0);
+                        return;
+                    }
+                } else {
+                    speedWarnCountMap.put("speedMinWarn", 0);
+                    speedWarnCountMap.put("speedMaxWarn", 0);
+                }
+
             } else if (opcData.getPointName().contains(SubscribeTagConstants.TAG_TAPHOLE1_STATUS(opcData.getServerType()))) {
                 RealtimeData realtimeData = new RealtimeData();
                 realtimeData.setValue(opcData.getData());
@@ -1377,7 +1487,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         // 出铁预警,打开系统告警并记录
                         PushData.send2Warn(WarnData.warnOpen("急需开口告警", openAlarmUrl));
                         taskExecutor.submit(() -> {
-                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType("12000").exceptionDesc(String.format("开口耗时:%s分钟", minutesBetween)).build());
+                            exceptionLogService.add(TExceptionLogCreateValidate.builder().exceptionType(ExceptionTypeEnum.KAI_KOU_CHAO_SHI.getCode()).exceptionDesc(String.format("开口耗时:%s分钟", minutesBetween)).build());
                             //推送预警列表
                             getExceptionList();
                         });