|
@@ -0,0 +1,739 @@
|
|
|
+package com.sckj.iron.socketio;
|
|
|
+
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.corundumstudio.socketio.SocketIOClient;
|
|
|
+import com.corundumstudio.socketio.annotation.OnEvent;
|
|
|
+import com.google.common.eventbus.Subscribe;
|
|
|
+import com.sckj.common.eventbus.EventListener;
|
|
|
+import com.sckj.common.socketio.SocketUtil;
|
|
|
+import com.sckj.iron.dto.IronStepDTO;
|
|
|
+import com.sckj.iron.service.impl.TIronStepServiceImpl;
|
|
|
+import com.sckj.iron.vo.IronOperataion;
|
|
|
+import com.sckj.iron.vo.IronStepVO;
|
|
|
+import com.sckj.opc.entity.OPCData;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.springframework.expression.spel.standard.SpelExpressionParser;
|
|
|
+import org.springframework.expression.spel.support.StandardEvaluationContext;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import javax.annotation.PostConstruct;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.concurrent.ConcurrentHashMap;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author feng
|
|
|
+ * @Date 2024-11-19 上午 11:05
|
|
|
+ * @Description TODO
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Slf4j
|
|
|
+public class DeviceEventListener extends EventListener {
|
|
|
+
|
|
|
+ private static final String TAG1 = "TAG1";
|
|
|
+ private static final String TAG2 = "TAG2";
|
|
|
+ private static final String TAG3 = "TAG3";
|
|
|
+ private static final String TAG4 = "TAG4";
|
|
|
+ private static final String TAG5 = "TAG5";
|
|
|
+ private static final String TAG6 = "TAG6";
|
|
|
+ private static final String TAG7 = "TAG7";
|
|
|
+ private static final String TAG8 = "TAG8";
|
|
|
+ private static final String TAG9 = "TAG9";
|
|
|
+ private static final String TAG10 = "TAG10";
|
|
|
+ private static final String TAG11 = "TAG11";
|
|
|
+ private static final String TAG12 = "TAG12";
|
|
|
+ private static final String TAG13 = "TAG13";
|
|
|
+ private static final String TAG14 = "TAG14";
|
|
|
+ private static final String TAG15 = "TAG15";
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TIronStepServiceImpl ironStepService;
|
|
|
+
|
|
|
+ @Deprecated
|
|
|
+ private Map<String, IronOperataion> operateMap = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ private Map<SocketIOClient, IronOperataion> operateMap2 = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ private Map<SocketIOClient, List<IronStepDTO>> operateMap3 = new ConcurrentHashMap<>();
|
|
|
+
|
|
|
+ // 1.创建表达式解析器
|
|
|
+ private SpelExpressionParser parser = new SpelExpressionParser();
|
|
|
+
|
|
|
+ // 2.创建变量上下文,设置变量
|
|
|
+ private StandardEvaluationContext ctx = new StandardEvaluationContext();
|
|
|
+
|
|
|
+ private List<IronStepVO> mSteps;
|
|
|
+
|
|
|
+ @PostConstruct
|
|
|
+ public void init() {
|
|
|
+ mSteps = ironStepService.getSteps();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Subscribe
|
|
|
+ public void onMessageEvent(OPCData opcData) {
|
|
|
+ if (SocketUtil.connectMap.isEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ operate3(opcData);
|
|
|
+
|
|
|
+// for (Map.Entry<SocketIOClient, String> entry : SocketUtil.clientUserIds.entrySet()) {
|
|
|
+// //根据在线用户初始化炼铁操作数据
|
|
|
+// if (!operateMap2.containsKey(entry.getKey())) {
|
|
|
+// operateMap2.put(entry.getKey(), new IronOperataion());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// for (Map.Entry<SocketIOClient, String> entry : SocketUtil.clientUserIds.entrySet()) {
|
|
|
+// //根据在线用户初始化炼铁操作数据
|
|
|
+// if (!operateMap3.containsKey(entry.getKey())) {
|
|
|
+// operateMap3.put(entry.getKey(), ironStepService.getSteps());
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// for (Map.Entry<SocketIOClient, List<IronStepDTO>> entry : operateMap3.entrySet()) {
|
|
|
+// //根据公共数据和私有数据进行填充
|
|
|
+// List<IronStepDTO> ironOperate = entry.getValue();
|
|
|
+//// if (!operateMap3.containsKey(entry.getKey())) {
|
|
|
+//// operateMap3.put()
|
|
|
+//// }
|
|
|
+//
|
|
|
+// operate3(ironOperate, opcData, entry.getKey());
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// for (Map.Entry<SocketIOClient, IronOperataion> entry : operateMap2.entrySet()) {
|
|
|
+// //根据公共数据和私有数据进行填充
|
|
|
+// IronOperataion ironOperate = entry.getValue();
|
|
|
+// operate2(ironOperate, opcData, entry.getKey());
|
|
|
+// }
|
|
|
+// for (Map.Entry<String, SocketIOClient> entry : SocketUtil.connectMap.entrySet()) {
|
|
|
+// //根据在线用户初始化炼铁操作数据
|
|
|
+// if (!operateMap.containsKey(entry.getKey())) {
|
|
|
+// operateMap.put(entry.getKey(), new IronOperataion());
|
|
|
+// }
|
|
|
+// }
|
|
|
+// for (Map.Entry<String, IronOperataion> entry : operateMap.entrySet()) {
|
|
|
+// //根据公共数据和私有数据进行填充
|
|
|
+// IronOperataion ironOperate = entry.getValue();
|
|
|
+// operate(ironOperate, opcData, entry.getKey());
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Deprecated
|
|
|
+ private void operate(IronOperataion ironOperate, OPCData opcData, String userId) {
|
|
|
+ String identifier = opcData.getPointName();
|
|
|
+ try {
|
|
|
+ identifier = identifier.split("\\.")[2];
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Object data = opcData.getData();
|
|
|
+
|
|
|
+ //出铁
|
|
|
+ if (TAG1.equals(identifier)
|
|
|
+ || TAG2.equals(identifier)
|
|
|
+ || TAG3.equals(identifier)
|
|
|
+ || TAG4.equals(identifier)
|
|
|
+ || TAG5.equals(identifier)
|
|
|
+ || TAG6.equals(identifier)
|
|
|
+ || TAG7.equals(identifier)
|
|
|
+ || TAG8.equals(identifier)
|
|
|
+ || TAG9.equals(identifier)
|
|
|
+ || TAG10.equals(identifier)
|
|
|
+ ) {
|
|
|
+ //ylgcdw 鱼雷罐车到位
|
|
|
+ if (identifier.equals(TAG1)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setYlgcdw("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setYlgcdw("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //tbxtzc 铁摆系统正常
|
|
|
+ if (identifier.equals(TAG2)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setTbxtzc("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setTbxtzc("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //npkkjzbwb 泥炮、开口机准备完毕
|
|
|
+ if (identifier.equals(TAG3)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setNpkkjzbwb("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setNpkkjzbwb("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //炉前准备
|
|
|
+ if ("1".equals(ironOperate.getYlgcdw())
|
|
|
+ && "1".equals(ironOperate.getTbxtzc())
|
|
|
+ && "1".equals(ironOperate.getNpkkjzbwb())
|
|
|
+ && "1".equals(ironOperate.getRydw())
|
|
|
+ ) {
|
|
|
+ ironOperate.setLqzb("1");
|
|
|
+ } else {
|
|
|
+ log.info("lqzb failed => ylgcdw:{},tbxtzc:{},npkkjzbwb:{},rydw:{}", ironOperate.getYlgcdw(), ironOperate.getTbxtzc(), ironOperate.getNpkkjzbwb(), ironOperate.getRydw());
|
|
|
+
|
|
|
+ ironOperate.setRydw("0");
|
|
|
+ ironOperate.setLqzb("0");
|
|
|
+
|
|
|
+ ironOperate.setSzbykq("0");
|
|
|
+ ironOperate.setCtmskq("0");
|
|
|
+ ironOperate.setZggbdj("0");
|
|
|
+ ironOperate.setWwtj("0");
|
|
|
+
|
|
|
+ ironOperate.setLqsqct("0");
|
|
|
+
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, userId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+// if (identifier.contains(TAG4)) {
|
|
|
+// ironOperate.setRydw(data);
|
|
|
+// }
|
|
|
+
|
|
|
+ //水闸泵已开启,水闸槽水量正常
|
|
|
+ if (identifier.equals(TAG4)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setSzbykq("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setSzbykq("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //除尘开启出铁模式
|
|
|
+ if (identifier.equals(TAG5)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setCtmskq("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setCtmskq("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //主沟盖板吊装机处于待机位
|
|
|
+ if (identifier.equals(TAG6)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setZggbdj("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setZggbdj("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //外围条件
|
|
|
+ if ("1".equals(ironOperate.getSzbykq())
|
|
|
+ && "1".equals(ironOperate.getCtmskq())
|
|
|
+ && "1".equals(ironOperate.getZggbdj())
|
|
|
+ ) {
|
|
|
+ ironOperate.setWwtj("1");
|
|
|
+ } else {
|
|
|
+ log.info("wwtj failed => szbykq:{},ctmskq:{},zggbdj:{}", ironOperate.getSzbykq(), ironOperate.getCtmskq(), ironOperate.getZggbdj());
|
|
|
+
|
|
|
+ ironOperate.setWwtj("0");
|
|
|
+
|
|
|
+ ironOperate.setLqsqct("0");
|
|
|
+
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, userId);
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("0".equals(ironOperate.getLqsqct())) {
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, userId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //高炉运行情况
|
|
|
+ if (identifier.equals(TAG7)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setGlyxqk("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //理论铁量、铁铁差计算
|
|
|
+ if (identifier.equals(TAG8)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setTlcjs("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //出铁口模式
|
|
|
+ if (identifier.equals(TAG9)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setCtfs("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //炉内出铁条件
|
|
|
+ if ("1".equals(ironOperate.getLqsqct())
|
|
|
+ && "1".equals(ironOperate.getGlyxqk())
|
|
|
+ && "1".equals(ironOperate.getTlcjs())
|
|
|
+ && "1".equals(ironOperate.getCtfs())
|
|
|
+ ) {
|
|
|
+ ironOperate.setLncttj("1");
|
|
|
+ } else {
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ log.info("lncttj failed => glyxqk:{},tlcjs:{},ctkms:{}", ironOperate.getGlyxqk(), ironOperate.getTlcjs(), ironOperate.getCtfs());
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, userId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("1".equals(ironOperate.getYpqrct())) {
|
|
|
+ ironOperate.setLqctcz("1");
|
|
|
+ } else {
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+ }
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, userId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //glyxqk 高炉运行情况
|
|
|
+ //tlcjs 理论铁量、铁铁差计算
|
|
|
+ //ctkms 出铁口模式
|
|
|
+
|
|
|
+ //趋势
|
|
|
+ if (Stream.of("TAG5", "TAG6", "TAG7", "TAG8").anyMatch(identifier::contains)) {
|
|
|
+ // PushData.sendToTrend(JSON.toJSONString(opcData));
|
|
|
+ //铁水成分
|
|
|
+ //铁水流速
|
|
|
+ //铁水流量
|
|
|
+ //铁水温度
|
|
|
+ }
|
|
|
+
|
|
|
+ //实时数据
|
|
|
+ if (Stream.of("TAG9", "TAG10").anyMatch(identifier::contains)) {
|
|
|
+// PushData.sendToRealtime(JSON.toJSONString(opcData));
|
|
|
+ //除铁中
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void operate2(IronOperataion ironOperate, OPCData opcData, SocketIOClient socketIOClient) {
|
|
|
+ String identifier = opcData.getPointName();
|
|
|
+ try {
|
|
|
+ identifier = identifier.split("\\.")[2];
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Object data = opcData.getData();
|
|
|
+
|
|
|
+ //出铁
|
|
|
+ if (TAG1.equals(identifier)
|
|
|
+ || TAG2.equals(identifier)
|
|
|
+ || TAG3.equals(identifier)
|
|
|
+ || TAG4.equals(identifier)
|
|
|
+ || TAG5.equals(identifier)
|
|
|
+ || TAG6.equals(identifier)
|
|
|
+ || TAG7.equals(identifier)
|
|
|
+ || TAG8.equals(identifier)
|
|
|
+ || TAG9.equals(identifier)
|
|
|
+ || TAG10.equals(identifier)
|
|
|
+ ) {
|
|
|
+ //ylgcdw 鱼雷罐车到位
|
|
|
+ if (identifier.equals(TAG1)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setYlgcdw("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setYlgcdw("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //tbxtzc 铁摆系统正常
|
|
|
+ if (identifier.equals(TAG2)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setTbxtzc("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setTbxtzc("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //npkkjzbwb 泥炮、开口机准备完毕
|
|
|
+ if (identifier.equals(TAG3)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setNpkkjzbwb("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setNpkkjzbwb("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //炉前准备
|
|
|
+ if ("1".equals(ironOperate.getYlgcdw())
|
|
|
+ && "1".equals(ironOperate.getTbxtzc())
|
|
|
+ && "1".equals(ironOperate.getNpkkjzbwb())
|
|
|
+ && "1".equals(ironOperate.getRydw())
|
|
|
+ ) {
|
|
|
+ ironOperate.setLqzb("1");
|
|
|
+ } else {
|
|
|
+ log.info("lqzb failed => ylgcdw:{},tbxtzc:{},npkkjzbwb:{},rydw:{}", ironOperate.getYlgcdw(), ironOperate.getTbxtzc(), ironOperate.getNpkkjzbwb(), ironOperate.getRydw());
|
|
|
+
|
|
|
+ ironOperate.setRydw("0");
|
|
|
+ ironOperate.setLqzb("0");
|
|
|
+
|
|
|
+ ironOperate.setSzbykq("0");
|
|
|
+ ironOperate.setCtmskq("0");
|
|
|
+ ironOperate.setZggbdj("0");
|
|
|
+ ironOperate.setWwtj("0");
|
|
|
+
|
|
|
+ ironOperate.setLqsqct("0");
|
|
|
+
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, socketIOClient);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+// if (identifier.contains(TAG4)) {
|
|
|
+// ironOperate.setRydw(data);
|
|
|
+// }
|
|
|
+
|
|
|
+ //水闸泵已开启,水闸槽水量正常
|
|
|
+ if (identifier.equals(TAG4)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setSzbykq("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setSzbykq("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //除尘开启出铁模式
|
|
|
+ if (identifier.equals(TAG5)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setCtmskq("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setCtmskq("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //主沟盖板吊装机处于待机位
|
|
|
+ if (identifier.equals(TAG6)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setZggbdj("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setZggbdj("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //外围条件
|
|
|
+ if ("1".equals(ironOperate.getSzbykq())
|
|
|
+ && "1".equals(ironOperate.getCtmskq())
|
|
|
+ && "1".equals(ironOperate.getZggbdj())
|
|
|
+ ) {
|
|
|
+ ironOperate.setWwtj("1");
|
|
|
+ } else {
|
|
|
+ log.info("wwtj failed => szbykq:{},ctmskq:{},zggbdj:{}", ironOperate.getSzbykq(), ironOperate.getCtmskq(), ironOperate.getZggbdj());
|
|
|
+
|
|
|
+ ironOperate.setWwtj("0");
|
|
|
+
|
|
|
+ ironOperate.setLqsqct("0");
|
|
|
+
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, socketIOClient);
|
|
|
+
|
|
|
+ return;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("0".equals(ironOperate.getLqsqct())) {
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, socketIOClient);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //高炉运行情况
|
|
|
+ if (identifier.equals(TAG7)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setGlyxqk("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setGlyxqk("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //理论铁量、铁铁差计算
|
|
|
+ if (identifier.equals(TAG8)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setTlcjs("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setTlcjs("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //出铁口模式
|
|
|
+ if (identifier.equals(TAG9)) {
|
|
|
+ if ("0".equals(data)) {
|
|
|
+ ironOperate.setCtfs("0");
|
|
|
+ } else {
|
|
|
+ ironOperate.setCtfs("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //炉内出铁条件
|
|
|
+ if ("1".equals(ironOperate.getLqsqct())
|
|
|
+ && "1".equals(ironOperate.getGlyxqk())
|
|
|
+ && "1".equals(ironOperate.getTlcjs())
|
|
|
+ && "1".equals(ironOperate.getCtfs())
|
|
|
+ ) {
|
|
|
+ ironOperate.setLqsqct(ironOperate.getLqsqct());
|
|
|
+ ironOperate.setLncttj("1");
|
|
|
+ } else {
|
|
|
+ ironOperate.setLncttj("0");
|
|
|
+
|
|
|
+ log.info("lncttj failed => glyxqk:{},tlcjs:{},ctkms:{}", ironOperate.getGlyxqk(), ironOperate.getTlcjs(), ironOperate.getCtfs());
|
|
|
+
|
|
|
+ ironOperate.setYpqrct("0");
|
|
|
+
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, socketIOClient);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ("1".equals(ironOperate.getYpqrct())) {
|
|
|
+ ironOperate.setLqctcz("1");
|
|
|
+ } else {
|
|
|
+ ironOperate.setLqctcz("0");
|
|
|
+ }
|
|
|
+
|
|
|
+ PushData.send2Operation(ironOperate, socketIOClient);
|
|
|
+ }
|
|
|
+
|
|
|
+ //glyxqk 高炉运行情况
|
|
|
+ //tlcjs 理论铁量、铁铁差计算
|
|
|
+ //ctkms 出铁口模式
|
|
|
+
|
|
|
+ //趋势
|
|
|
+ if (Stream.of("TAG5", "TAG6", "TAG7", "TAG8").anyMatch(identifier::contains)) {
|
|
|
+ // PushData.sendToTrend(JSON.toJSONString(opcData));
|
|
|
+ //铁水成分
|
|
|
+ //铁水流速
|
|
|
+ //铁水流量
|
|
|
+ //铁水温度
|
|
|
+ }
|
|
|
+
|
|
|
+ //实时数据
|
|
|
+ if (Stream.of("TAG9", "TAG10").anyMatch(identifier::contains)) {
|
|
|
+// PushData.sendToRealtime(JSON.toJSONString(opcData));
|
|
|
+ //除铁中
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ //
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void operate3(OPCData opcData) {
|
|
|
+ String pointName = opcData.getPointName();
|
|
|
+ Object data = opcData.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()) {
|
|
|
+ if (Objects.equals(child.getPointName(), pointName)) {
|
|
|
+ //3.创建变量上下文,设置变量
|
|
|
+ ctx.setVariable(child.getIdentifier(), data);
|
|
|
+ child.setData(data);
|
|
|
+
|
|
|
+ boolean result = false;
|
|
|
+
|
|
|
+ if (ObjectUtils.isNotEmpty(child.getStepTj())) {
|
|
|
+ try {
|
|
|
+ result = parser.parseExpression(child.getStepTj()).getValue(ctx, Boolean.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ child.setPass(result);
|
|
|
+
|
|
|
+ //log.info("pointName:{},data:{},tj:{},result:{}", pointName, data, child.getStepTj(), result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ boolean result = false;
|
|
|
+ if (ObjectUtils.isNotEmpty(stepDTO.getStepTj())) {
|
|
|
+ try {
|
|
|
+ result = parser.parseExpression(stepDTO.getStepTj()).getValue(ctx, Boolean.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ stepDTO.setPass(result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ stepDTO.setPass(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("==========================================");
|
|
|
+ //log.info("steps before:{}", JSON.toJSONString(mSteps));
|
|
|
+ log.info("==========================================");
|
|
|
+
|
|
|
+ boolean foundFalsePass = false;
|
|
|
+
|
|
|
+ //发现第一个pass是false,后续的手动操作都为false,包括父项和子项
|
|
|
+ for (IronStepVO stepDTO : mSteps) {
|
|
|
+ for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
+ if (!foundFalsePass && !child.isPass()) {
|
|
|
+ foundFalsePass = true;
|
|
|
+ }
|
|
|
+ if (foundFalsePass) {
|
|
|
+ child.setPass(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (foundFalsePass) {
|
|
|
+ stepDTO.setPass(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("==========================================");
|
|
|
+ log.info("steps after:{}", JSON.toJSONString(mSteps));
|
|
|
+ log.info("==========================================");
|
|
|
+
|
|
|
+
|
|
|
+ PushData.send2Operation(mSteps);
|
|
|
+ }
|
|
|
+
|
|
|
+ @OnEvent(value = PushData.IRON_CONFIRM)
|
|
|
+ public void confirmIron(SocketIOClient client, IronStepDTO message) {
|
|
|
+ if (ObjectUtils.isEmpty(message) || ObjectUtils.isEmpty(client)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("---> {}", SocketUtil.clientUserIds.get(client));
|
|
|
+ for (IronStepVO stepDTO : mSteps) {
|
|
|
+ for (IronStepVO child : stepDTO.getChilds()) {
|
|
|
+ if (child.getStepId().equals(message.getStepId())) {
|
|
|
+ ctx.setVariable(child.getIdentifier(), message.getData());
|
|
|
+ child.setPass(message.isPass());
|
|
|
+ PushData.send2Operation(mSteps);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /***
|
|
|
+ * 数据库更改后调用接口刷新步骤
|
|
|
+ * @param steps
|
|
|
+ */
|
|
|
+ @Subscribe
|
|
|
+ public void onIronStep(List<IronStepVO> steps) {
|
|
|
+ if (ObjectUtils.isNotEmpty(steps)) {
|
|
|
+ this.mSteps = steps;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// @OnEvent(value = PushData.IRON_CONFIRM)
|
|
|
+// public void confirmIron(SocketIOClient client, IronOperataion message) {
|
|
|
+// if (ObjectUtils.isEmpty(message) || ObjectUtils.isEmpty(client)) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// log.info("---> {}", SocketUtil.clientUserIds.get(client));
|
|
|
+// log.info("人员到位(rydw):{},{}", message.getUserId(), message.getRydw());
|
|
|
+// log.info("炉前申请出铁(rydw):{},{}", message.getUserId(), message.getLqsqct());
|
|
|
+// log.info("预判和确认出铁(rydw):{},{}", message.getUserId(), message.getYpqrct());
|
|
|
+// IronOperataion ironOperataion = operateMap2.get(client);
|
|
|
+// if (ObjectUtils.isNotEmpty(ironOperataion)) {
|
|
|
+// if (ObjectUtils.isNotEmpty(message.getRydw())) {
|
|
|
+// ironOperataion.setRydw(message.getRydw());
|
|
|
+// }
|
|
|
+// if (ObjectUtils.isNotEmpty(message.getLqsqct())) {
|
|
|
+// ironOperataion.setLqsqct(message.getLqsqct());
|
|
|
+// }
|
|
|
+// if (ObjectUtils.isNotEmpty(message.getYpqrct())) {
|
|
|
+// ironOperataion.setYpqrct(message.getYpqrct());
|
|
|
+// }
|
|
|
+// PushData.send2Operation(ironOperataion, client);
|
|
|
+// } else {
|
|
|
+// log.info("失效的会话");
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+}
|