wangxiaofei 2 settimane fa
parent
commit
b78d22b227

+ 2 - 1
taphole-iron/src/main/java/com/sckj/iron/service/impl/TIronVisualScreenServiceImpl.java

@@ -707,9 +707,10 @@ public class TIronVisualScreenServiceImpl {
                 if (!inTappingCycle) {
                     //刚刚开始出铁
                     inTappingCycle = true;
-                    log.info("[出铁周期结束] 开始于: " + time);
+                    log.info("[出铁周期开始] 开始于: " + time);
                     if(bigDecimal.compareTo(new BigDecimal("70")) > 0){
                         bigDecimal  = BigDecimal.ZERO;
+                        lastValue =  BigDecimal.ZERO;
                     }
                 }
                 if (bigDecimal.compareTo(BigDecimal.ZERO) == 0) {

+ 64 - 8
taphole-iron/src/main/java/com/sckj/iron/socketio/DeviceEventListener.java

@@ -307,7 +307,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                 scheduledTaskManager.addTask(opcdasubscribe.getName(), opcdasubscribe.getDelay(), opcdasubscribe.getPeriod(), TimeUnit.SECONDS, () -> {
                     if ("prod".equals(activeProfiles)) {
                         log.info("HDC subscribe available");
-                         hdService.subscribeAvailable();
+                        hdService.subscribeAvailable();
                     } else if ("test".equals(activeProfiles)) {
                         log.info("DA subscribe available");
                         opcuaService.subscribeAvailable();
@@ -580,6 +580,9 @@ public class DeviceEventListener extends AbstractEventListener { //
                     //关联实时出铁信息
                     opcData.setIronDataId(mTIronData.getId());
                 }
+                if (opcData.getPointName().contains(SubscribeTagConstants.TAG_TAPHOLE1_STATUS(opcData.getServerType()))) {
+                    return;
+                }
                 opcDataService.save(opcData);
             }
         });
@@ -724,7 +727,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                                 BigDecimal tlcjlc = tlcLast.add(tlcGrand);
 
                                 Map<String, Object> extraInfo = child.getExtraInfo();
-                                if(null == extraInfo){
+                                if (null == extraInfo) {
                                     extraInfo = new HashMap<>();
                                 }
                                 extraInfo.put("tlcDetails", Arrays.asList(dtoLast, dtoGrand));
@@ -833,7 +836,7 @@ public class DeviceEventListener extends AbstractEventListener { //
         //最大出铁标准量
         double stdIronWeightMax = Double.parseDouble(mContext.lookupVariable(ExpressionConstants.stdIronWeightMax).toString());
         //实时总铁量
-       // BigDecimal totalWeight = rtTotalWeight;
+        // BigDecimal totalWeight = rtTotalWeight;
         //平均流速
         BigDecimal avgSpeed = totalWeight.divide(BigDecimal.valueOf(ironElapsedMinute), 2, RoundingMode.HALF_UP);
         //剩余重量
@@ -858,7 +861,7 @@ public class DeviceEventListener extends AbstractEventListener { //
         PushData.send2CloseTime(realtimeData);
         log.info("推送剩余出铁时间数据完成");
 
-        if(ObjectUtils.isNotEmpty(mTIronData) && ObjectUtils.isNotEmpty(mTIronData.getId()) ) {
+        if (ObjectUtils.isNotEmpty(mTIronData) && ObjectUtils.isNotEmpty(mTIronData.getId())) {
             //ironCalctime
             mTIronData.setIronCalctime(diffCloseTime);
             boolean saveResult = ironDataService.saveOrUpdate(mTIronData);
@@ -1260,7 +1263,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                             log.warn("模型1触发堵口告警2");
 
                             taskExecutor.submit(() -> {
-                                PushData.send2Warn( audioMap.get(ExceptionTypeEnum.CLOSURE2.getCode()));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.CLOSURE2.getCode()));
                                 saveException(ExceptionTypeEnum.NEED_CLOSURE, String.format("流速过小,但其它铁口正在出铁,请将当前铁口堵口"));
                                 //推送预警列表
                                 getExceptionList();
@@ -1563,7 +1566,7 @@ public class DeviceEventListener extends AbstractEventListener { //
 
                 log.info("打泥量计算完成: {} L", mCalcHitMud);
 
-                if(ObjectUtils.isNotEmpty(mTIronData) && ObjectUtils.isNotEmpty(mTIronData.getId()) ) {
+                if (ObjectUtils.isNotEmpty(mTIronData) && ObjectUtils.isNotEmpty(mTIronData.getId())) {
                     //ironCalctime
                     mTIronData.setMudWeight(mCalcHitMud);
                     boolean saveResult = ironDataService.saveOrUpdate(mTIronData);
@@ -1958,7 +1961,60 @@ public class DeviceEventListener extends AbstractEventListener { //
                                     }
 
 
-                                    log.info("   └─ 已出铁时长: {}秒", diffInSeconds);
+                                    log.info("   └─ 已出铁时长: {}分钟", diffInSeconds);
+
+
+                                    List<HDRecord> weight1 = hdService.queryTagHisRawRecords(
+                                            204492,
+                                            LocalDateUtils.formatDate(tappingInfo.getSourceTime()),
+                                            LocalDateUtils.getFormatDateTime(LocalDateTime.now()));
+
+                                    log.info("   ├─ weight1历史数据记录数: {}", weight1 != null ? weight1.size() : 0);
+
+                                    if (ObjectUtils.isNotEmpty(weight1)) {
+                                        for (int i = 0; i < weight1.size(); i++) {
+                                            HDRecord hdRecord = weight1.get(i);
+                                            double currentValue = Double.parseDouble(hdRecord.getValueStr());
+                                            if (i < weight1.size() - 1) {
+                                                HDRecord next = weight1.get(i + 1);
+                                                double nextValue = Double.parseDouble(next.getValueStr());
+                                                double abs = Math.abs(currentValue - nextValue);
+                                                if (abs > 70) {
+                                                    double max = Math.max(currentValue, nextValue);
+                                                    mTotalWeight = mTotalWeight.add(BigDecimal.valueOf(max));
+                                                    log.info("   ├─  1车有效铁水重量(t):{},总重量:{} ", max, mTotalWeight);
+                                                }
+                                            }
+                                        }
+
+                                    }
+
+                                    List<HDRecord> weight2 = hdService.queryTagHisRawRecords(
+                                            204493,
+                                            LocalDateUtils.formatDate(tappingInfo.getSourceTime()),
+                                            LocalDateUtils.getFormatDateTime(LocalDateTime.now()));
+
+                                    log.info("   ├─ weight2历史数据记录数: {}", weight2 != null ? weight2.size() : 0);
+
+                                    if (ObjectUtils.isNotEmpty(weight2)) {
+                                        for (int i = 0; i < weight2.size(); i++) {
+                                            HDRecord hdRecord = weight2.get(i);
+                                            double currentValue = Double.parseDouble(hdRecord.getValueStr());
+                                            if (i < weight2.size() - 1) {
+                                                HDRecord next = weight2.get(i + 1);
+                                                double nextValue = Double.parseDouble(next.getValueStr());
+                                                double abs = Math.abs(currentValue - nextValue);
+                                                if (abs > 70) {
+                                                    double max = Math.max(currentValue, nextValue);
+                                                    mTotalWeight = mTotalWeight.add(BigDecimal.valueOf(max));
+                                                    log.info("   ├─  2车有效铁水重量(t):{},总重量:{} ", max, mTotalWeight);
+                                                }
+                                            }
+                                        }
+
+                                    }
+
+
                                 } else {
                                     log.info("   └─ 处理模式: 开始新的出铁");
                                     initIronData(opcData);
@@ -2141,7 +2197,7 @@ public class DeviceEventListener extends AbstractEventListener { //
                         taskExecutor.submit(() -> {
                             try {
                                 String exceptionMsg = String.format("温度%s℃", tempNow);
-                                PushData.send2Warn( audioMap.get(ExceptionTypeEnum.IRON_TEMP_HIGH.getCode()));
+                                PushData.send2Warn(audioMap.get(ExceptionTypeEnum.IRON_TEMP_HIGH.getCode()));
                                 saveException(ExceptionTypeEnum.IRON_TEMP_HIGH, exceptionMsg);
                                 log.warn("已记录温度过低异常: {}", exceptionMsg);