|
@@ -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());
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//出铁后,记录炉次、开口时间、鱼雷罐车车号、铁口深度、铁水流速
|