Эх сурвалжийг харах

实时大屏功能完善2

wangxiaofei 1 сар өмнө
parent
commit
5eaacf4705

+ 2 - 7
taphole-common/src/main/java/com/sckj/common/eventbus/EventBusConfig.java

@@ -18,15 +18,10 @@ import java.util.concurrent.Executor;
 @Configuration
 @Slf4j
 public class EventBusConfig {
-    @Bean
-    public EventBus eventBus() {
-        return new EventBus();
-    }
-
-    @Bean("myAsyncEventBus")
+    @Bean("asyncEventBus")
     @Lazy(value = true)
     public AsyncEventBus createAsyncEventBus(Executor taskExecutor) {
-        log.info("myAsyncEventBus=============");
+        log.info("asyncEventBus=============");
         return new AsyncEventBus(taskExecutor);
     }
 }

+ 29 - 21
taphole-iron/src/main/java/com/sckj/iron/dto/RealtimeData.java

@@ -11,28 +11,36 @@ import org.springframework.stereotype.Component;
 @Data
 @Component
 public class RealtimeData {
-    private Object ironSpeed;
+//    private Object ironSpeed;
+//
+//    private Object ironWeight;
+//
+//    private Object ironTemp;
+//
+//    private Object ironElement;
+//
+//
+//    //出铁状态
+//    private Object ironState;
+//
+//    //鱼雷罐车到位状态
+//    private Object ironSpeed1;
+//
+//    //拔炮状态
+//    private Object ironSpeed2;
+//
+//    //摆动溜咀
+//    private Object bdlzState;
+//
+//    //冲渣状态
+//    private Object czState;
+
+    private String key;
+
+    private Object value;
+
+    private String desc;
 
-    private Object ironWeight;
 
-    private Object ironTemp;
-
-    private Object ironElement;
-
-
-    //出铁状态
-    private Object ironState;
-
-    //鱼雷罐车到位状态
-    private Object ironSpeed1;
-
-    //拔炮状态
-    private Object ironSpeed2;
-
-    //摆动溜咀
-    private Object bdlzState;
-
-    //冲渣状态
-    private Object czState;
 
 }

+ 0 - 4
taphole-iron/src/main/java/com/sckj/iron/dto/TrendData.java

@@ -20,8 +20,4 @@ public class TrendData {
     private Object ironSpeed2;
 
 
-
-
-
-
 }

+ 1 - 1
taphole-iron/src/main/java/com/sckj/iron/entity/TIronStep.java

@@ -39,7 +39,7 @@ public class TIronStep implements Serializable {
     private String stepName;
 
     @ApiModelProperty(value = "通过条件")
-    private String stepTj;
+    private String stepCondition;
 
     @ApiModelProperty(value = "下一步")
     private String nextStep;

+ 2 - 2
taphole-iron/src/main/java/com/sckj/iron/entity/TL2Data.java

@@ -58,10 +58,10 @@ public class TL2Data implements Serializable {
     private double totalDry;
 
     @ApiModelProperty(value = "开始时间")
-    private Date ironStarttime;
+    private String ironStarttime;
 
     @ApiModelProperty(value = "结束时间")
-    private Date ironEndtime;
+    private String ironEndtime;
 
 
     @ApiModelProperty(value = "碳")

+ 230 - 138
taphole-iron/src/main/java/com/sckj/iron/socketio/DeviceEventListener.java

@@ -2,7 +2,6 @@ package com.sckj.iron.socketio;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.corundumstudio.socketio.SocketIOClient;
 import com.corundumstudio.socketio.annotation.OnEvent;
 import com.google.common.eventbus.Subscribe;
@@ -12,7 +11,6 @@ import com.sckj.iron.dto.IronStepDTO;
 import com.sckj.iron.dto.RealtimeData;
 import com.sckj.iron.dto.TrendData;
 import com.sckj.iron.entity.TIronData;
-import com.sckj.iron.entity.TIronParam;
 import com.sckj.iron.entity.TL2Data;
 import com.sckj.iron.service.impl.*;
 import com.sckj.iron.vo.IronStepVO;
@@ -22,9 +20,6 @@ import com.sckj.opc.opcua.L2DataServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.expression.EvaluationException;
-import org.springframework.expression.ParseException;
 import org.springframework.expression.spel.standard.SpelExpressionParser;
 import org.springframework.expression.spel.support.StandardEvaluationContext;
 import org.springframework.stereotype.Component;
@@ -68,9 +63,11 @@ public class DeviceEventListener extends EventListener {
     @Resource
     TL2DataServiceImpl tl2DataService;
 
-    //实时数据
     @Resource
-    RealtimeData realtimeData;
+    private L2DataServiceImpl l2DataServiceImpl;
+
+    //实时数据
+    Map<String, Object> realtimeDataMap = new HashMap<>();
 
 
     @Resource
@@ -92,26 +89,34 @@ public class DeviceEventListener extends EventListener {
     //定时器,用于铁口开口超时记录
     private Timer timer = new Timer();
 
-    //前2次出铁数据
-    private List<TIronData> oldIronDataList;
-
     //是否出铁中
     //1 出铁中    0 出铁结束
     private boolean ironLoading = false;
 
+    private OPCData mOPCData;
+
     //1号出铁标记
-    private static final String IRON_OPERATE_TAG = "AOD25606.PV";
+    private static final String TAG_IRON_OPERATE1 = "AOD25606.PV";
+
+    //铁水温度
+    private static final String TAG_IRON_TEMP = "CL510104.CPV";
 
-    //锅炉运行情况
-    private static final String glyxqk = "glyxqk";
-    //预判和确认出铁
-    private static final String ypqrct = "lqct";
 
+    //预判和确认出铁
+    private static final String ypqrct = "lnct";
 
     //铁量差计算
     private static final String tlc = "tlc";
-    @Autowired
-    private L2DataServiceImpl l2DataServiceImpl;
+
+    //1TH-1号车受铁速度
+    private static final String TAG_CAR1 = "WZ540101.PV";
+    //1TH-2号车受铁速度
+    private static final String TAG_CAR2 = "WZ540201.PV";
+
+    //1TH-1号车总重
+    private static final String TAG_IRON_WEIGHT1 = "WI5401.PV";
+    //1TH-2号车TPC总重
+    private static final String TAG_IRON_WEIGHT2 = "WI5402.PV";
 
     @PostConstruct
     public void init() {
@@ -127,46 +132,17 @@ public class DeviceEventListener extends EventListener {
         if (SocketUtil.clientUserIds.isEmpty()) {
             return;
         }
+        this.mOPCData = opcData;
         //出铁操作
-        operate(opcData);
+        operate();
+
         //趋势数据
-        trenddata(opcData);
+        trenddata();
 
         //实时数据
-        realtime(opcData);
-    }
-
-    //趋势数据
-    private void trenddata(OPCData opcData) {
-        //
-
+        realtime();
     }
 
-    //实时数据显示
-    //
-    private void realtime(OPCData opcData) {
-        //铁水温度
-        //铁水流速
-        //铁水成分
-        //铁水流量
-        if (opcData.getPointName().contains("CL510104.CPV")) {
-            // trendData.put("ironTemp",opcData.getData());
-
-        } else if (opcData.getPointName().contains("WZ540101.PV")) {
-//             trendData.put("ironSpeed1",opcData.getData());
-            realtimeData.setIronSpeed1(opcData.getData());
-        } else if (opcData.getPointName().contains("WZ540201.PV")) {
-//             trendData.put("ironTemp2",opcData.getData());
-            realtimeData.setIronSpeed2(opcData.getData());
-        }
-
-        if (ObjectUtils.isNotEmpty(mL2Data)) {
-
-        }
-
-    }
-
-
     /***
      * L2数据项
      * @param l2Data
@@ -177,6 +153,8 @@ public class DeviceEventListener extends EventListener {
             return;
         }
         this.mL2Data = l2Data;
+        realtime();
+
         TL2Data tl2Data = new TL2Data();
         //出铁操作
         BeanUtils.copyProperties(l2Data, tl2Data);
@@ -209,122 +187,219 @@ public class DeviceEventListener extends EventListener {
                             // 上一次铁量差:-30       上上次铁量差:20 t
                             // 理论出铁量:1500 t      理论出铁量:1400 t
                             // 实际出铁量:1530 t      实际出铁量: 1380 t
+                            final String sctlc = "sctlc";
+                            final String ssctlc = "ssctlc";
+                            final String scll = "scll";
+                            final String sscll = "sscll";
+                            final String scsj = "scsj";
+                            final String sscsj = "sscsj";
+
+                            //child.setPassResult(1);
+                            for (IronStepVO childChild : child.getChilds()) {
+                                if (sctlc.equals(childChild.getIdentifier())) {
+                                    childChild.setData(tlcLast);
+                                } else if (ssctlc.equals(childChild.getIdentifier())) {
+                                    childChild.setData(tlcLastLast);
+                                } else if (scll.equals(childChild.getIdentifier())) {
+                                    childChild.setData(llLast);
+                                } else if (sscll.equals(childChild.getIdentifier())) {
+                                    childChild.setData(llLastLast);
+                                } else if (scsj.equals(childChild.getIdentifier())) {
+                                    childChild.setData(ironWeightLast);
+                                } else if (sscsj.equals(childChild.getIdentifier())) {
+                                    childChild.setData(ironWeightLastLast);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        setStepResult(mSteps);
+    }
 
-                            hashMaps[0] = new HashMap();
-                            hashMaps[0].put("value", tlcLast);
-                            hashMaps[0].put("desc", String.format("上一次铁量差:%st", tlcLast));
 
-                            hashMaps[1] = new HashMap();
-                            hashMaps[1].put("value", tlcLastLast);
-                            hashMaps[1].put("desc", String.format("上上次铁量差:%st", tlcLastLast));
+    //趋势数据
+    private void trenddata() {
+        //
 
-                            hashMaps[2] = new HashMap();
-                            hashMaps[2].put("value", llLast);
-                            hashMaps[2].put("desc", String.format("理论出铁量:%st", llLast));
+    }
 
-                            hashMaps[3] = new HashMap();
-                            hashMaps[3].put("value", llLastLast);
-                            hashMaps[3].put("desc", String.format("理论出铁量:%st", llLastLast));
+    //实时数据显示
+    private void realtime() {
+        //铁水温度
+        //铁水流速
+        //铁水成分
+        //铁水流量
+        //WI5401.PV  1TH-1号车总重
+        //WI5402.PV  1TH-2号车TPC总重
+        if (ObjectUtils.isNotEmpty(mOPCData)) {
+            if (mOPCData.getPointName().contains(TAG_IRON_TEMP)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData() + "℃");
+                realtimeData.setDesc("铁水温度");
+                realtimeDataMap.put("ironTemp", realtimeData);
+            }
 
-                            hashMaps[4] = new HashMap();
-                            hashMaps[4].put("value", ironWeightLast);
-                            hashMaps[4].put("desc", String.format("t实际出铁量:%st", ironWeightLast));
+            if (mOPCData.getPointName().contains(TAG_CAR1) || mOPCData.getPointName().contains(TAG_CAR2)) {
+//            1TH-1号车受铁速度
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData() + "t/s");
+
+                RealtimeData ironSpeed = (RealtimeData) realtimeDataMap.get("ironSpeed");
+                RealtimeData[] speeds = null;
+                if (ObjectUtils.isEmpty(ironSpeed)) {
+                    ironSpeed = new RealtimeData();
+                    ironSpeed.setDesc("铁水流速");
+                    speeds = new RealtimeData[2];
+                    ironSpeed.setValue(speeds);
+                    realtimeDataMap.put("ironSpeed", ironSpeed);
+                } else {
+                    speeds = (RealtimeData[]) ironSpeed.getValue();
+                }
 
-                            hashMaps[5] = new HashMap();
-                            hashMaps[5].put("value", ironWeightLastLast);
-                            hashMaps[5].put("desc", String.format("t实际出铁量:%st", ironWeightLastLast));
+                if (mOPCData.getPointName().contains(TAG_CAR1)) {
+                    realtimeData.setDesc("1号车");
+                    speeds[0] = realtimeData;
+                } else {
+                    realtimeData.setDesc("2号车");
+                    speeds[1] = realtimeData;
+                }
+//                ironSpeed.setValue(speeds);
+//                realtimeDataMap.put("ironSpeed", ironSpeed);
+            }
 
-                            child.setPassResult(1);
-                        }
-                    }
+            if (mOPCData.getPointName().contains(TAG_IRON_WEIGHT1) || mOPCData.getPointName().contains(TAG_IRON_WEIGHT2)) {
+//              铁水流量
+                RealtimeData ironWeight = (RealtimeData) realtimeDataMap.get("ironWeight");
+                if (ObjectUtils.isEmpty(ironWeight)) {
+                    ironWeight = new RealtimeData();
+                    ironWeight.setDesc("铁水流量");
+                    ironWeight.setValue(new BigDecimal(String.valueOf(mOPCData.getData())));
+                    realtimeDataMap.put("ironWeight", ironWeight);
+                } else {
+                    BigDecimal bigDecimalOld = ((BigDecimal) ironWeight.getValue());
+                    BigDecimal bigDecimalNew = new BigDecimal(mOPCData.getData().toString());
+                    BigDecimal add = bigDecimalOld.add(bigDecimalNew);
+                    ironWeight.setValue(add);
                 }
             }
+
+            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setDesc("出铁状态");
+                realtimeDataMap.put("ctzt", realtimeData);
+            }
+
+            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setDesc("鱼雷罐车到位状态");
+                realtimeDataMap.put("ylgc", realtimeData);
+            }
+
+
+            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setDesc("拔炮状态");
+                realtimeDataMap.put("bpzt", realtimeData);
+            }
+
+
+            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setDesc("摆动溜咀");
+                realtimeDataMap.put("bdlz", realtimeData);
+            }
+
+            if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
+                RealtimeData realtimeData = new RealtimeData();
+                realtimeData.setValue(mOPCData.getData());
+                realtimeData.setDesc("冲渣状态");
+                realtimeDataMap.put("czzt", realtimeData);
+            }
+
         }
 
-        setStepResult(mSteps);
+        if (ObjectUtils.isNotEmpty(mL2Data)) {
+            //铁水成分
+            //预计出铁结束时间
+            String elementSi = mL2Data.getElementSi();
+            String elementS = mL2Data.getElementS();
+
+            RealtimeData realtimeData = new RealtimeData();
+            realtimeData.setValue(elementSi + "%");
+            realtimeData.setDesc("硅");
+
+            RealtimeData realtimeData2 = new RealtimeData();
+            realtimeData.setValue(elementS + "%");
+            realtimeData.setDesc("硫");
+
+            List<RealtimeData> realtimeDataList = new ArrayList<>();
+            realtimeDataList.add(realtimeData);
+            realtimeDataList.add(realtimeData2);
+
+            RealtimeData realtimeData3 = new RealtimeData();
+            realtimeData3.setValue(realtimeDataList);
+            realtimeData2.setDesc("铁水成分");
+
+            realtimeDataMap.put("ironElement", realtimeData3);
+        }
+
+
+        log.info("实时数据:{}", realtimeDataMap);
+
+        PushData.send2Realtime(realtimeDataMap);
 
     }
 
 
-    private void operate(OPCData opcData) {
-        if (ObjectUtils.isEmpty(opcData)) {
+    private void operate() {
+        if (ObjectUtils.isEmpty(mOPCData)) {
             return;
         }
-        String pointName = opcData.getPointName();
-        Object data = opcData.getData();
+        String pointName = mOPCData.getPointName();
+        Object data = mOPCData.getData();
         for (IronStepVO stepDTO : mSteps) {
             //log.info("nodetype:{},pointname:{},opc pointname:{}",stepDTO.getNodeType(),stepDTO.getPointName(),pointName);
             if (NODE.equalsIgnoreCase(stepDTO.getNodeType())) {
                 //处理子项
                 for (IronStepVO child : stepDTO.getChilds()) {
                     for (IronStepVO childchild : child.getChilds()) {
+
                         //plc的point和step的point一致
                         String newPointName = childchild.getPointName();
 
-                        if(ObjectUtils.isEmpty(newPointName)){
+                        if (ObjectUtils.isEmpty(newPointName)) {
                             continue;
                         }
 
-                        if(newPointName.contains(".")){
+                        if (newPointName.contains(".")) {
                             newPointName = "channel." + newPointName;
-                        }else{
+                        } else {
                             newPointName = "channel.device." + newPointName;
                         }
 
                         if (Objects.equals(newPointName, pointName)) {
                             //3.创建变量上下文,设置变量
                             childchild.setData(data);
-//                            if ("glyc".equals(child.getIdentifier())) {
-//                                //高炉压差正常
-//
-//                                if (ObjectUtils.isEmpty(child.getExtraInfo())) {
-//                                    child.setExtraInfo(new HashMap[4]);
-//                                }
-//
-//                                if (opcData.getPointName().contains("FI1001.PV")) {
-//                                    //送风流量
-//                                    child.getExtraInfo()[0] = new HashMap<>();
-//                                    child.getExtraInfo()[0].put("value", data.toString());
-//                                    child.getExtraInfo()[0].put("desc", String.format("送风流量:%sm3/min", data.toString()));
-//                                } else if (opcData.getPointName().contains("PI1003.PV")) {
-//                                    //送风压力
-//                                    child.getExtraInfo()[1] = new HashMap<>();
-//                                    child.getExtraInfo()[1].put("value", data.toString());
-//                                    child.getExtraInfo()[1].put("desc", String.format("送风压力:%skPa", data.toString()));
-//                                } else if (opcData.getPointName().contains("PC7801.PV")) {
-//                                    //选择后炉顶压力
-//                                    child.getExtraInfo()[2] = new HashMap<>();
-//                                    child.getExtraInfo()[2].put("value", data.toString());
-//                                    child.getExtraInfo()[2].put("desc", String.format("炉顶压力:%skPa", data.toString()));
-//                                }
-//                                //压差
-//                                BigDecimal bdSfyl = new BigDecimal(child.getExtraInfo()[1].getOrDefault("value", "0").toString());
-//                                BigDecimal bdLdyl = new BigDecimal(child.getExtraInfo()[2].getOrDefault("value", "0").toString());
-//                                child.getExtraInfo()[3] = new HashMap<>();
-//                                BigDecimal subtract = bdSfyl.subtract(bdLdyl);
-//                                child.getExtraInfo()[3].put("value", bdSfyl.subtract(bdLdyl));
-//                                child.getExtraInfo()[3].put("desc", String.format("压差:%skPa", bdSfyl.subtract(bdLdyl)));
-//                                child.setPassResult(1);
-//                            }
                         }
                     }
                     String newPointName = child.getPointName();
-                    if(ObjectUtils.isEmpty(newPointName)){
+                    if (ObjectUtils.isEmpty(newPointName)) {
                         continue;
                     }
-                    if(newPointName.contains(".")){
+                    if (newPointName.contains(".")) {
                         newPointName = "channel." + newPointName;
-                    }else{
+                    } else {
                         newPointName = "channel.device." + newPointName;
                     }
                     if (Objects.equals(newPointName, pointName)) {
                         child.setData(data);
                     }
-//                    else {
-//                        if (ObjectUtils.isNotEmpty(child.getData())) {
-//                            ctx.setVariable(child.getIdentifier(), child.getData());
-//                        }
-//                    }
 
                 }
             }
@@ -333,7 +408,7 @@ public class DeviceEventListener extends EventListener {
         setStepResult(mSteps);
 
 
-        ironReady(opcData);
+        ironReady();
 
 
         PushData.send2Operation(mSteps, ironLoading);
@@ -348,7 +423,7 @@ public class DeviceEventListener extends EventListener {
             for (IronStepVO child : stepDTO.getChilds()) {
                 for (IronStepVO childChild : child.getChilds()) {
                     //子项的子项 验证是否通过
-                    validateStepTjPass(childChild);
+                    validateStepPass(childChild);
 
                     if (!foundFalsePass && 0 == childChild.getPassResult()) {
                         foundFalsePass = true;
@@ -360,7 +435,7 @@ public class DeviceEventListener extends EventListener {
                 }
 
                 //子项验证是否通过
-                validateStepTjPass(child);
+                validateStepPass(child);
                 if (!foundFalsePass && 0 == child.getPassResult()) {
                     foundFalsePass = true;
                 }
@@ -370,7 +445,7 @@ public class DeviceEventListener extends EventListener {
                 }
             }
             //父项
-            validateStepTjPass(stepDTO);
+            validateStepPass(stepDTO);
             //父项
             if (foundFalsePass) {
                 stepDTO.setPassResult(0);
@@ -379,7 +454,10 @@ public class DeviceEventListener extends EventListener {
     }
 
 
-    private void ironReady(OPCData opcData) {
+    private void ironReady() {
+        if (ObjectUtils.isEmpty(mOPCData)) {
+            return;
+        }
         //通过“预判和确认出铁”标记开始出铁
         boolean isReady = false;
 
@@ -412,13 +490,13 @@ public class DeviceEventListener extends EventListener {
         //根据PLC订阅的数据,AOD25606.PV=1为出铁中,AOD25606.PV=0出铁结束的信号,进行判断
         //为1表示开始出铁,此时如果未超过10分钟,就取消定时器
         //出铁结束
-        if (opcData.getPointName().contains(IRON_OPERATE_TAG)) {
+        if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
 
             //1:出铁中
             //0:出铁结束
-            ironLoading = "1".equals(opcData.getData());
+            ironLoading = "1".equals(mOPCData.getData());
 
-            if ("0".equals(opcData.getData())) {
+            if ("0".equals(mOPCData.getData())) {
                 try {
                     timer.cancel(); // 终止定时器
                 } catch (Exception e) {
@@ -429,7 +507,7 @@ public class DeviceEventListener extends EventListener {
 
                 //出铁结束后,查询最近两次的数据
                 LambdaQueryWrapper<TIronData> queryWrapper = new QueryWrapper<TIronData>().lambda().orderByDesc(TIronData::getCtcsbh);
-                oldIronDataList = ironDataService.list(queryWrapper);
+                List<TIronData> oldIronDataList = ironDataService.list(queryWrapper);
             }
         }
     }
@@ -438,23 +516,37 @@ public class DeviceEventListener extends EventListener {
      * 判断是否通过
      * @param stepVO
      */
-    private void validateStepTjPass(IronStepVO stepVO) {
+    private void validateStepPass(IronStepVO stepVO) {
+        //根据唯一名称设置环境变量
         ctx.setVariable(stepVO.getIdentifier(), stepVO.getData());
-        if (ObjectUtils.isNotEmpty(stepVO.getStepTj())) {
+        String flowName = stepVO.getStepName();
+        try {
+            if ("calc".equalsIgnoreCase(stepVO.getNodeType())) {
+                flowName = parser.parseExpression(flowName).getValue(ctx, String.class);
+            } else {
+                flowName = parser.parseExpression("'" + flowName + "'").getValue(ctx, String.class);
+            }
+            stepVO.setFlowName(flowName);
+        } catch (Exception e) {
+            log.error("stepName:{},flowName:{}", stepVO.getStepName(),flowName);
+        }
+
+        //非流程必须项,直接放行
+        if ("0".equals(stepVO.getIdentifier())) {
+            stepVO.setPassResult(1);
+            return;
+        }
+
+        if (ObjectUtils.isNotEmpty(stepVO.getStepCondition())) {
             boolean result = false;
             try {
-                result = parser.parseExpression(stepVO.getStepTj()).getValue(ctx, Boolean.class);
+                result = parser.parseExpression(stepVO.getStepCondition()).getValue(ctx, Boolean.class);
             } catch (Exception e) {
                 result = false;
             }
             stepVO.setPassResult(result ? 1 : 0);
         }
-        try {
-            String stepNameNew = parser.parseExpression(stepVO.getStepName().contains("#")?stepVO.getStepName():"'"+stepVO.getStepName()+"'").getValue(ctx, String.class);
-            stepVO.setStepName(stepNameNew);
-        } catch (Exception e) {
-            log.error("stepName:{}",stepVO.getStepName());
-        }
+
     }
 
     //出铁后,记录炉次、开口时间、鱼雷罐车车号、铁口深度、铁水流速

+ 7 - 2
taphole-iron/src/main/java/com/sckj/iron/vo/IronStepVO.java

@@ -21,7 +21,7 @@ public class IronStepVO {
     @ApiModelProperty(value = "stepId")
     private String stepId;
 
-    @ApiModelProperty(value = "步骤名称")
+    @ApiModelProperty(value = "步骤名称(包含公式)")
     private String stepName;
 
     @ApiModelProperty(value = "步骤的唯一标识")
@@ -34,7 +34,7 @@ public class IronStepVO {
     private String pointName;
 
     @ApiModelProperty(value = "通过条件")
-    private String stepTj;
+    private String stepCondition;
 
     //
     @ApiModelProperty(value = "通过结果(1通过、0未通过)")
@@ -46,6 +46,11 @@ public class IronStepVO {
     @ApiModelProperty(value = "数据")
     private Object data;
 
+    @ApiModelProperty(value = "流程是否必须项(0否 1是)")
+    private String required;
+
+    @ApiModelProperty(value = "步骤名称")
+    private String flowName;
 
     public IronStepVO() {
         this.childs = new ArrayList<>();

+ 1 - 1
taphole-iron/src/main/java/com/sckj/iron/vo/IronTrendVO.java

@@ -32,7 +32,7 @@ public class IronTrendVO {
     private String pointName;
 
     @ApiModelProperty(value = "通过条件")
-    private String stepTj;
+    private String stepCondition;
 
     //
     @ApiModelProperty(value = "通过结果(1通过、0未通过)")

+ 25 - 3
taphole-opc/src/main/java/com/sckj/opc/dto/L2Data.java

@@ -7,6 +7,7 @@ import lombok.Data;
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -15,7 +16,7 @@ import java.util.Date;
  * @Description TODO
  */
 @Data
-public class L2Data {
+public class L2Data implements Serializable {
 
     @ApiModelProperty(value = "铁口区域编号")
     private String tapholeId;
@@ -53,12 +54,22 @@ public class L2Data {
     @ApiModelProperty(value = "结束时间")
     private String ironEndtime;
 
-    //铁水成分
+    //铁水成分
     private String elementC;
+
+    //铁水成分 硅
     private String elementSi;
+
+    //铁水成分 锰
     private String elementMn;
+
+    //铁水成分 磷
     private String elementP;
+
+    //铁水成分 硫
     private String elementS;
+
+    //铁水成分 钛
     private String elementTi;
 
 
@@ -90,7 +101,12 @@ public class L2Data {
         data.openDepth = dis.readUTF();
         data.totalDry = dis.readUTF();
         data.ironStarttime = dis.readUTF();
-        data.ironEndtime = dis.readUTF();
+        data.elementC = dis.readUTF();
+        data.elementSi = dis.readUTF();
+        data.elementMn = dis.readUTF();
+        data.elementP = dis.readUTF();
+        data.elementP = dis.readUTF();
+        data.elementTi = dis.readUTF();
         return data;
     }
 
@@ -109,6 +125,12 @@ public class L2Data {
                 ", totalDry='" + totalDry + '\'' +
                 ", ironStarttime='" + ironStarttime + '\'' +
                 ", ironEndtime='" + ironEndtime + '\'' +
+                ", elementC='" + elementC + '\'' +
+                ", elementSi='" + elementSi + '\'' +
+                ", elementMn='" + elementMn + '\'' +
+                ", elementP='" + elementP + '\'' +
+                ", elementS='" + elementS + '\'' +
+                ", elementTi='" + elementTi + '\'' +
                 '}';
     }
 }

+ 16 - 2
taphole-opc/src/main/java/com/sckj/opc/opcua/L2DataServiceImpl.java

@@ -4,8 +4,11 @@ import com.google.common.eventbus.AsyncEventBus;
 import com.sckj.opc.dto.L2Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
@@ -24,10 +27,21 @@ public class L2DataServiceImpl {
     @Autowired
     private AsyncEventBus asyncEventBus;
 
+    @Resource(name = "taskExecutor")
+    ThreadPoolTaskExecutor taskExecutor;
+
+    @PostConstruct
+    private void init() {
+        taskExecutor.submit(this::initTCP);
+    }
+
     /***
      * L2数据源
      */
-    private void initTCP(){
+
+    private void initTCP() {
+        System.out.println("TCP start");
+
         final String serverIP = "127.0.0.1"; // 服务端IP地址
         final int serverPort = 8888; // 服务端端口号
         final int maxRetries = 10; // 最大重试次数
@@ -64,7 +78,7 @@ public class L2DataServiceImpl {
             System.err.println("Failed to connect to server after " + maxRetries + " attempts.");
             return;
         }
-        try{
+        try {
             dos = new DataOutputStream(socket.getOutputStream());
             dis = new DataInputStream(socket.getInputStream());
             while (true) {

+ 2 - 5
taphole-opc/src/main/java/com/sckj/opc/opcua/OPCDAServiceImpl.java

@@ -16,6 +16,7 @@ import org.openscada.opc.lib.common.ConnectionInformation;
 import org.openscada.opc.lib.common.NotConnectedException;
 import org.openscada.opc.lib.da.*;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 
@@ -77,7 +78,6 @@ public class OPCDAServiceImpl {
 
 
     public Object createSubscription(OPCServer opcServer, OPCPoint opcPoint) {
-        final int PERIOD = 100 * 10;
         StringBuilder sb = new StringBuilder();
         if (ObjectUtils.isNotEmpty(opcPoint) && !mOPCDaPointsMap.containsKey(opcPoint.getId())) {
             Map<String, Object> pointChangedMap = new LinkedHashMap<>();
@@ -86,13 +86,10 @@ public class OPCDAServiceImpl {
                 public String call() {
                     try {
                         Server server = createServer(opcServer);
-                        AccessBase access = new SyncAccess(server, PERIOD);
-
-
+                        AccessBase access = new SyncAccess(server, opcPoint.getPeriod() * 1000);
 
                         String newPointName = opcPoint.getPointName();
 
-
                         if(ObjectUtils.isEmpty(newPointName)){
                             return null;
                         }