|
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.corundumstudio.socketio.SocketIOClient;
|
|
|
import com.corundumstudio.socketio.annotation.OnEvent;
|
|
|
import com.google.common.eventbus.Subscribe;
|
|
|
+import com.sckj.common.core.AjaxResult;
|
|
|
import com.sckj.common.eventbus.EventListener;
|
|
|
import com.sckj.common.socketio.SocketUtil;
|
|
|
+import com.sckj.common.util.RedisUtils;
|
|
|
import com.sckj.iron.dto.IronStepDTO;
|
|
|
import com.sckj.iron.dto.RealtimeData;
|
|
|
import com.sckj.iron.dto.TrendData;
|
|
@@ -17,11 +19,13 @@ import com.sckj.iron.vo.IronStepVO;
|
|
|
import com.sckj.opc.dto.L2Data;
|
|
|
import com.sckj.opc.entity.OPCData;
|
|
|
import com.sckj.opc.opcua.L2DataServiceImpl;
|
|
|
+import com.sckj.opc.service.OPCDataServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
|
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
@@ -66,20 +70,30 @@ public class DeviceEventListener extends EventListener {
|
|
|
@Resource
|
|
|
private L2DataServiceImpl l2DataServiceImpl;
|
|
|
|
|
|
+ @Resource
|
|
|
+ OPCDataServiceImpl opcDataService;
|
|
|
+
|
|
|
//实时数据
|
|
|
- Map<String, Object> realtimeDataMap = new HashMap<>();
|
|
|
+ Map<String, Object> mRealtimeData = new HashMap<>();
|
|
|
+
|
|
|
+ //实时状态
|
|
|
+ Map<String, Object> mRealtimeStatus = new HashMap<>();
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
TrendData trendData;
|
|
|
|
|
|
+ //L1
|
|
|
+ private OPCData mOPCData;
|
|
|
+
|
|
|
+ //L2
|
|
|
private L2Data mL2Data;
|
|
|
|
|
|
// 1.创建表达式解析器
|
|
|
private SpelExpressionParser parser = new SpelExpressionParser();
|
|
|
|
|
|
// 2.创建变量上下文,设置变量
|
|
|
- private StandardEvaluationContext ctx = new StandardEvaluationContext();
|
|
|
+ private StandardEvaluationContext mContext = new StandardEvaluationContext();
|
|
|
|
|
|
//出铁步骤
|
|
|
private List<IronStepVO> mSteps;
|
|
@@ -91,16 +105,29 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
//是否出铁中
|
|
|
//1 出铁中 0 出铁结束
|
|
|
- private boolean ironLoading = false;
|
|
|
-
|
|
|
- private OPCData mOPCData;
|
|
|
-
|
|
|
- //1号出铁标记
|
|
|
- private static final String TAG_IRON_OPERATE1 = "AOD25606.PV";
|
|
|
-
|
|
|
+ private boolean ironLoading1 = false;
|
|
|
+ private boolean ironLoading2 = false;
|
|
|
+ private boolean ironLoading3 = false;
|
|
|
+ private boolean ironLoading4 = false;
|
|
|
+
|
|
|
+ //1号出铁状态标记
|
|
|
+ private static final String TAG_TAPHOLE1_STATUS = "AOD25606.PV";
|
|
|
+ //2号出铁状态标记
|
|
|
+ private static final String TAG_TAPHOLE2_STATUS = "AOD25622.PV";
|
|
|
+ //3号出铁状态标记
|
|
|
+ private static final String TAG_TAPHOLE3_STATUS = "AOD25706.PV";
|
|
|
+ //4号出铁状态标记
|
|
|
+ private static final String TAG_TAPHOLE4_STATUS = "AOD25722.PV";
|
|
|
//铁水温度
|
|
|
private static final String TAG_IRON_TEMP = "CL510104.CPV";
|
|
|
-
|
|
|
+ //1TH-1号车受铁速度
|
|
|
+ private static final String TAG_CAR11 = "WZ540101.PV";
|
|
|
+ //1TH-2号车受铁速度
|
|
|
+ private static final String TAG_CAR12 = "WZ540201.PV";
|
|
|
+ //1TH-1号车总重
|
|
|
+ private static final String TAG_IRON_WEIGHT11 = "WI5401.PV";
|
|
|
+ //1TH-2号车TPC总重
|
|
|
+ private static final String TAG_IRON_WEIGHT12 = "WI5402.PV";
|
|
|
|
|
|
//预判和确认出铁
|
|
|
private static final String ypqrct = "lnct";
|
|
@@ -108,15 +135,34 @@ public class DeviceEventListener extends EventListener {
|
|
|
//铁量差计算
|
|
|
private static final String tlc = "tlc";
|
|
|
|
|
|
- //1TH-1号车受铁速度
|
|
|
- private static final String TAG_CAR1 = "WZ540101.PV";
|
|
|
- //1TH-2号车受铁速度
|
|
|
- private static final String TAG_CAR2 = "WZ540201.PV";
|
|
|
+ //最近任一铁口出铁结束时间
|
|
|
+ private Date lastIronEndTimeRecently;
|
|
|
+
|
|
|
+ @Resource(name = "taskExecutor")
|
|
|
+ ThreadPoolTaskExecutor taskExecutor;
|
|
|
+
|
|
|
+ //铁水成分
|
|
|
+ public static final String IRON_ELEMENT = "ironElement";
|
|
|
+ //铁水温度
|
|
|
+ public static final String IRON_TEMP = "ironTemp";
|
|
|
+ //铁水流速
|
|
|
+ public static final String IRON_SPEED = "ironSpeed";
|
|
|
+ //重量
|
|
|
+ public static final String IRON_WEIGHT = "ironWeight";
|
|
|
+ //出铁状态
|
|
|
+ private static final String IRON_STATUS = "ironStatus";
|
|
|
+
|
|
|
+ //鱼雷罐车
|
|
|
+ private static final String CAR_STATUS = "ylgc";
|
|
|
+ //拔炮
|
|
|
+ private static final String GUN_STATUS = "npkkj";
|
|
|
+ //摆动溜咀
|
|
|
+ private static final String MOUTH_STATUS = "bdlz";
|
|
|
+ //冲渣状态
|
|
|
+ private static final String FLUSH_STATUS = "flushStatus";
|
|
|
+ //预计出铁结束时间
|
|
|
+ private static final String PLAN_END_TIME = "planEndTime";
|
|
|
|
|
|
- //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() {
|
|
@@ -133,6 +179,8 @@ public class DeviceEventListener extends EventListener {
|
|
|
return;
|
|
|
}
|
|
|
this.mOPCData = opcData;
|
|
|
+ //异步保存OPC数据
|
|
|
+ taskExecutor.submit(() -> opcDataService.save(mOPCData));
|
|
|
//出铁操作
|
|
|
operate();
|
|
|
|
|
@@ -141,6 +189,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
//实时数据
|
|
|
realtime();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/***
|
|
@@ -162,6 +211,9 @@ public class DeviceEventListener extends EventListener {
|
|
|
//将L2实时数据保存到数据库
|
|
|
tl2DataService.saveOrUpdate(tl2Data);
|
|
|
|
|
|
+ //将L2实时数据保存到Redis
|
|
|
+ RedisUtils.addFixedElement(IRON_ELEMENT, l2Data, 6);
|
|
|
+
|
|
|
for (IronStepVO stepDTO : mSteps) {
|
|
|
if (NODE.equalsIgnoreCase(stepDTO.getNodeType())) {
|
|
|
//处理子项
|
|
@@ -225,6 +277,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//实时数据显示
|
|
|
private void realtime() {
|
|
|
//铁水温度
|
|
@@ -236,90 +289,124 @@ public class DeviceEventListener extends EventListener {
|
|
|
if (ObjectUtils.isNotEmpty(mOPCData)) {
|
|
|
if (mOPCData.getPointName().contains(TAG_IRON_TEMP)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData() + "℃");
|
|
|
+ realtimeData.setValue(mOPCData.getData());
|
|
|
+ realtimeData.setUnit("℃");
|
|
|
realtimeData.setDesc("铁水温度");
|
|
|
- realtimeDataMap.put("ironTemp", realtimeData);
|
|
|
+ realtimeData.setTime(mOPCData.getServerTime().toString());
|
|
|
+ mRealtimeData.put(IRON_TEMP, realtimeData);
|
|
|
+ //redis添加数据
|
|
|
+ RedisUtils.addFixedElement(IRON_TEMP, realtimeData, 6);
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(TAG_CAR1) || mOPCData.getPointName().contains(TAG_CAR2)) {
|
|
|
+ if (mOPCData.getPointName().contains(TAG_CAR11) || mOPCData.getPointName().contains(TAG_CAR12)) {
|
|
|
// 1TH-1号车受铁速度
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(mOPCData.getData() + "t/s");
|
|
|
+ realtimeData.setValue(mOPCData.getData());
|
|
|
+ realtimeData.setUnit("t/s");
|
|
|
|
|
|
- RealtimeData ironSpeed = (RealtimeData) realtimeDataMap.get("ironSpeed");
|
|
|
+ RealtimeData ironSpeed = (RealtimeData) mRealtimeData.get(IRON_SPEED);
|
|
|
RealtimeData[] speeds = null;
|
|
|
if (ObjectUtils.isEmpty(ironSpeed)) {
|
|
|
ironSpeed = new RealtimeData();
|
|
|
ironSpeed.setDesc("铁水流速");
|
|
|
speeds = new RealtimeData[2];
|
|
|
ironSpeed.setValue(speeds);
|
|
|
- realtimeDataMap.put("ironSpeed", ironSpeed);
|
|
|
+ mRealtimeData.put(IRON_SPEED, ironSpeed);
|
|
|
} else {
|
|
|
speeds = (RealtimeData[]) ironSpeed.getValue();
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(TAG_CAR1)) {
|
|
|
+ if (mOPCData.getPointName().contains(TAG_CAR11)) {
|
|
|
realtimeData.setDesc("1号车");
|
|
|
speeds[0] = realtimeData;
|
|
|
} else {
|
|
|
realtimeData.setDesc("2号车");
|
|
|
speeds[1] = realtimeData;
|
|
|
}
|
|
|
-// ironSpeed.setValue(speeds);
|
|
|
-// realtimeDataMap.put("ironSpeed", ironSpeed);
|
|
|
+
|
|
|
+ //只在两个都有数据的时候才添加
|
|
|
+ if (ObjectUtils.isNotEmpty(speeds)
|
|
|
+ && ObjectUtils.isNotEmpty(speeds[0]) && ObjectUtils.isNotEmpty(speeds[0].getValue())
|
|
|
+ && ObjectUtils.isNotEmpty(speeds[1]) && ObjectUtils.isNotEmpty(speeds[1].getValue())
|
|
|
+ ) {
|
|
|
+ ironSpeed.setTime(mOPCData.getServerTime().toString());
|
|
|
+ RedisUtils.addFixedElement(IRON_SPEED, ironSpeed, 6);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_WEIGHT1) || mOPCData.getPointName().contains(TAG_IRON_WEIGHT2)) {
|
|
|
+ if (mOPCData.getPointName().contains(TAG_IRON_WEIGHT11) || mOPCData.getPointName().contains(TAG_IRON_WEIGHT12)) {
|
|
|
// 铁水流量
|
|
|
- RealtimeData ironWeight = (RealtimeData) realtimeDataMap.get("ironWeight");
|
|
|
+ RealtimeData ironWeight = (RealtimeData) mRealtimeData.get(IRON_WEIGHT);
|
|
|
if (ObjectUtils.isEmpty(ironWeight)) {
|
|
|
ironWeight = new RealtimeData();
|
|
|
ironWeight.setDesc("铁水流量");
|
|
|
+ ironWeight.setUnit("t");
|
|
|
ironWeight.setValue(new BigDecimal(String.valueOf(mOPCData.getData())));
|
|
|
- realtimeDataMap.put("ironWeight", ironWeight);
|
|
|
+ mRealtimeData.put(IRON_WEIGHT, ironWeight);
|
|
|
+
|
|
|
+ ironWeight.setTime(mOPCData.getServerTime().toString());
|
|
|
+ RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, 6);
|
|
|
} else {
|
|
|
BigDecimal bigDecimalOld = ((BigDecimal) ironWeight.getValue());
|
|
|
BigDecimal bigDecimalNew = new BigDecimal(mOPCData.getData().toString());
|
|
|
BigDecimal add = bigDecimalOld.add(bigDecimalNew);
|
|
|
ironWeight.setValue(add);
|
|
|
+
|
|
|
+ ironWeight.setTime(mOPCData.getServerTime().toString());
|
|
|
+ RedisUtils.addFixedElement(IRON_WEIGHT, ironWeight, 6);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
|
|
|
+
|
|
|
+ if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
realtimeData.setValue(mOPCData.getData());
|
|
|
realtimeData.setDesc("出铁状态");
|
|
|
- realtimeDataMap.put("ctzt", realtimeData);
|
|
|
+ mRealtimeStatus.put(IRON_STATUS, realtimeData);
|
|
|
}
|
|
|
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
|
|
|
+// if (mOPCData.getPointName().contains(CAR_STATUS)) {
|
|
|
+// RealtimeData realtimeData = new RealtimeData();
|
|
|
+// realtimeData.setValue(mOPCData.getData());
|
|
|
+// realtimeData.setDesc("鱼雷罐车到位状态");
|
|
|
+// mRealtimeDataMap.put(CAR_STATUS, realtimeData);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// if (mOPCData.getPointName().contains(TAG_IRON_STATUS1)) {
|
|
|
+// RealtimeData realtimeData = new RealtimeData();
|
|
|
+// realtimeData.setValue(mOPCData.getData());
|
|
|
+// realtimeData.setDesc("拔炮状态");
|
|
|
+// mRealtimeDataMap.put(GUN_STATUS, realtimeData);
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// if (mOPCData.getPointName().contains(TAG_IRON_STATUS1)) {
|
|
|
+// RealtimeData realtimeData = new RealtimeData();
|
|
|
+// realtimeData.setValue(mOPCData.getData());
|
|
|
+// realtimeData.setDesc("摆动溜咀");
|
|
|
+// mRealtimeDataMap.put(MOUTH_STATUS, realtimeData);
|
|
|
+// }
|
|
|
+
|
|
|
+ if (mOPCData.getPointName().contains(FLUSH_STATUS)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
realtimeData.setValue(mOPCData.getData());
|
|
|
- realtimeData.setDesc("鱼雷罐车到位状态");
|
|
|
- realtimeDataMap.put("ylgc", realtimeData);
|
|
|
+ realtimeData.setDesc("冲渣状态");
|
|
|
+ mRealtimeStatus.put(FLUSH_STATUS, realtimeData);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
|
|
|
+ if (mOPCData.getPointName().contains(PLAN_END_TIME)) {
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
realtimeData.setValue(mOPCData.getData());
|
|
|
- realtimeData.setDesc("拔炮状态");
|
|
|
- realtimeDataMap.put("bpzt", realtimeData);
|
|
|
+ realtimeData.setDesc("预计出铁结束时间");
|
|
|
+ mRealtimeData.put(PLAN_END_TIME, 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);
|
|
|
+ float yc = Float.valueOf(ObjectUtils.defaultIfNull(mContext.lookupVariable("yc"), "0").toString());
|
|
|
+ if (yc > 190) {
|
|
|
+ log.info("预警出铁");
|
|
|
+ PushData.send2Warn(AjaxResult.success("预警出铁"));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -331,12 +418,14 @@ public class DeviceEventListener extends EventListener {
|
|
|
String elementS = mL2Data.getElementS();
|
|
|
|
|
|
RealtimeData realtimeData = new RealtimeData();
|
|
|
- realtimeData.setValue(elementSi + "%");
|
|
|
+ realtimeData.setValue(elementSi);
|
|
|
+ realtimeData.setUnit("%");
|
|
|
realtimeData.setDesc("硅");
|
|
|
|
|
|
RealtimeData realtimeData2 = new RealtimeData();
|
|
|
- realtimeData.setValue(elementS + "%");
|
|
|
- realtimeData.setDesc("硫");
|
|
|
+ realtimeData2.setValue(elementS);
|
|
|
+ realtimeData2.setUnit("%");
|
|
|
+ realtimeData2.setDesc("硫");
|
|
|
|
|
|
List<RealtimeData> realtimeDataList = new ArrayList<>();
|
|
|
realtimeDataList.add(realtimeData);
|
|
@@ -344,15 +433,15 @@ public class DeviceEventListener extends EventListener {
|
|
|
|
|
|
RealtimeData realtimeData3 = new RealtimeData();
|
|
|
realtimeData3.setValue(realtimeDataList);
|
|
|
- realtimeData2.setDesc("铁水成分");
|
|
|
+ realtimeData3.setDesc("铁水成分");
|
|
|
|
|
|
- realtimeDataMap.put("ironElement", realtimeData3);
|
|
|
+ mRealtimeData.put(IRON_ELEMENT, realtimeData3);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- log.info("实时数据:{}", realtimeDataMap);
|
|
|
-
|
|
|
- PushData.send2Realtime(realtimeDataMap);
|
|
|
+ //推送实时数据
|
|
|
+ PushData.send2RealtimeData(mRealtimeData);
|
|
|
+ //推送实时状态
|
|
|
+ PushData.send2RealtimeStatus(mRealtimeStatus);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -411,7 +500,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
ironReady();
|
|
|
|
|
|
|
|
|
- PushData.send2Operation(mSteps, ironLoading);
|
|
|
+ PushData.send2Operation(mSteps, ironLoading1);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -490,13 +579,25 @@ public class DeviceEventListener extends EventListener {
|
|
|
//根据PLC订阅的数据,AOD25606.PV=1为出铁中,AOD25606.PV=0出铁结束的信号,进行判断
|
|
|
//为1表示开始出铁,此时如果未超过10分钟,就取消定时器
|
|
|
//出铁结束
|
|
|
- if (mOPCData.getPointName().contains(TAG_IRON_OPERATE1)) {
|
|
|
-
|
|
|
+ if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)) {
|
|
|
//1:出铁中
|
|
|
//0:出铁结束
|
|
|
- ironLoading = "1".equals(mOPCData.getData());
|
|
|
+ ironLoading1 = "1".equals(mOPCData.getData());
|
|
|
+
|
|
|
+ if ("1".equals(mOPCData.getData())) {
|
|
|
+ //由 0 -> 1
|
|
|
+ //表明1号铁口正在出铁
|
|
|
+ //根据理论铁量、实时铁水流速,推测距离出铁结束的剩余时间
|
|
|
+ //剩余时间=总时间-已经流去的时间
|
|
|
+// mContext.lookupVariable("");
|
|
|
+ //计算理论铁量= 矿批 × 综合品位 × 1.06,其中矿批是指L2中的干量
|
|
|
+
|
|
|
+// Date ironTime = mOPCData.getServerTime();
|
|
|
+// lastIronEndTimeRecently
|
|
|
|
|
|
- if ("0".equals(mOPCData.getData())) {
|
|
|
+
|
|
|
+ } else if ("0".equals(mOPCData.getData())) {
|
|
|
+ //由 1-> 0
|
|
|
try {
|
|
|
timer.cancel(); // 终止定时器
|
|
|
} catch (Exception e) {
|
|
@@ -509,7 +610,18 @@ public class DeviceEventListener extends EventListener {
|
|
|
LambdaQueryWrapper<TIronData> queryWrapper = new QueryWrapper<TIronData>().lambda().orderByDesc(TIronData::getCtcsbh);
|
|
|
List<TIronData> oldIronDataList = ironDataService.list(queryWrapper);
|
|
|
}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (mOPCData.getPointName().contains(TAG_TAPHOLE1_STATUS)
|
|
|
+ || mOPCData.getPointName().contains(TAG_TAPHOLE2_STATUS)
|
|
|
+ || mOPCData.getPointName().contains(TAG_TAPHOLE3_STATUS)
|
|
|
+ || mOPCData.getPointName().contains(TAG_TAPHOLE4_STATUS)
|
|
|
+ ) {
|
|
|
+ lastIronEndTimeRecently = mOPCData.getServerTime();
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/***
|
|
@@ -518,21 +630,21 @@ public class DeviceEventListener extends EventListener {
|
|
|
*/
|
|
|
private void validateStepPass(IronStepVO stepVO) {
|
|
|
//根据唯一名称设置环境变量
|
|
|
- ctx.setVariable(stepVO.getIdentifier(), stepVO.getData());
|
|
|
- String flowName = stepVO.getStepName();
|
|
|
+ mContext.setVariable(stepVO.getIdentifier(), stepVO.getData());
|
|
|
+ String flowName = "";
|
|
|
try {
|
|
|
if ("calc".equalsIgnoreCase(stepVO.getNodeType())) {
|
|
|
- flowName = parser.parseExpression(flowName).getValue(ctx, String.class);
|
|
|
+ flowName = parser.parseExpression(stepVO.getStepNameExpression()).getValue(mContext, String.class);
|
|
|
} else {
|
|
|
- flowName = parser.parseExpression("'" + flowName + "'").getValue(ctx, String.class);
|
|
|
+ flowName = parser.parseExpression("'" + stepVO.getStepName() + "'").getValue(mContext, String.class);
|
|
|
}
|
|
|
- stepVO.setFlowName(flowName);
|
|
|
+ stepVO.setStepName(flowName);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("stepName:{},flowName:{}", stepVO.getStepName(),flowName);
|
|
|
+ log.error("stepId:{},identifier:{},stepName:{}", stepVO.getStepId(), stepVO.getIdentifier(), flowName);
|
|
|
}
|
|
|
|
|
|
//非流程必须项,直接放行
|
|
|
- if ("0".equals(stepVO.getIdentifier())) {
|
|
|
+ if ("0".equals(stepVO.getRequired())) {
|
|
|
stepVO.setPassResult(1);
|
|
|
return;
|
|
|
}
|
|
@@ -540,7 +652,7 @@ public class DeviceEventListener extends EventListener {
|
|
|
if (ObjectUtils.isNotEmpty(stepVO.getStepCondition())) {
|
|
|
boolean result = false;
|
|
|
try {
|
|
|
- result = parser.parseExpression(stepVO.getStepCondition()).getValue(ctx, Boolean.class);
|
|
|
+ result = parser.parseExpression(stepVO.getStepCondition()).getValue(mContext, Boolean.class);
|
|
|
} catch (Exception e) {
|
|
|
result = false;
|
|
|
}
|
|
@@ -583,23 +695,49 @@ public class DeviceEventListener extends EventListener {
|
|
|
log.info("--->userId : {}", userId);
|
|
|
for (IronStepVO stepDTO : mSteps) {
|
|
|
for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
- if (validateUserData(message, userId, child)) {
|
|
|
+ if (validateManualData(message, userId, child)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- if (validateUserData(message, userId, stepDTO)) {
|
|
|
+ if (validateManualData(message, userId, stepDTO)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean validateUserData(IronStepDTO message, String userId, IronStepVO stepDTO) {
|
|
|
- if (stepDTO.getStepId().equals(message.getStepId())) {
|
|
|
+ private boolean validateManualData(IronStepDTO message, String userId, IronStepVO stepDTO) {
|
|
|
+ if (Objects.equals(stepDTO.getStepId(), message.getStepId()) && Objects.equals(stepDTO.getIdentifier(), message.getIdentifier()) && Objects.equals("2", stepDTO.getConfirmMode())) {
|
|
|
stepDTO.setData(message.getData());
|
|
|
setStepResult(mSteps);
|
|
|
- PushData.send2Operation(mSteps, ironLoading);
|
|
|
+ PushData.send2Operation(mSteps, ironLoading1);
|
|
|
//这里手动记录时间
|
|
|
log.info("userId:{},stepId:{},identifier:{},data:{},pass:{}", userId, message.getStepId(), message.getIdentifier(), message.getData(), message.isPass());
|
|
|
+
|
|
|
+
|
|
|
+ if (Objects.equals(message.getIdentifier(), CAR_STATUS)) {
|
|
|
+ RealtimeData realtimeData = new RealtimeData();
|
|
|
+ realtimeData.setValue(message.getData());
|
|
|
+ realtimeData.setDesc("鱼雷罐车到位状态");
|
|
|
+ mRealtimeStatus.put(CAR_STATUS, realtimeData);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Objects.equals(message.getIdentifier(), GUN_STATUS)) {
|
|
|
+ RealtimeData realtimeData = new RealtimeData();
|
|
|
+ realtimeData.setValue(message.getData());
|
|
|
+ realtimeData.setDesc("拔炮状态");
|
|
|
+ mRealtimeStatus.put(GUN_STATUS, realtimeData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (Objects.equals(message.getIdentifier(), MOUTH_STATUS)) {
|
|
|
+ RealtimeData realtimeData = new RealtimeData();
|
|
|
+ realtimeData.setValue(message.getData());
|
|
|
+ realtimeData.setDesc("摆动溜嘴状态");
|
|
|
+ mRealtimeStatus.put(MOUTH_STATUS, realtimeData);
|
|
|
+ }
|
|
|
+
|
|
|
+ PushData.send2RealtimeStatus(mRealtimeStatus);
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|