From 89c996b653b0a24e329d2a11f91f4eb20872432b Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 23 九月 2025 15:31:27 +0800
Subject: [PATCH] 1、大理片添加报警功能

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
index e10c668..8c21cb2 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -9,6 +9,8 @@
 import com.github.yulichang.toolkit.JoinWrappers;
 import com.kangaroohy.milo.model.ReadWriteEntity;
 import com.kangaroohy.milo.service.MiloService;
+import com.mes.alarm.entity.ProductAlarmInfo;
+import com.mes.alarm.service.ProductAlarmInfoService;
 import com.mes.base.entity.BigStorageCageBaseInfo;
 import com.mes.bigstorage.entity.BigStorageCage;
 import com.mes.bigstorage.entity.BigStorageCageDetails;
@@ -97,11 +99,28 @@
      */
     private static final Integer THROUGH_SLOT = 920;
 
+
+    @Resource
+    private ProductAlarmInfoService productAlarmInfoService;
+
+    private static final String ALARM_MODULE = "閽㈠寲";
+    private static final String ALARM_TYPE = "閽㈠寲澶х悊鐗�";
+    private static final String ALARM_CODE_SIZE = "sizeSame";
+    private static final String ALARM_CODE_ID = "idSame";
+
     @Resource
     private RedisUtil redisUtil;
 
     @Scheduled(fixedDelay = 1000)
     public void inBigStorageTask() {
+        List<ProductAlarmInfo> alarmInfos = productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>()
+                .eq(ProductAlarmInfo::getState, Const.LOAD_RAW_GLASS_NEW)
+                .eq(ProductAlarmInfo::getAlarmModule, ALARM_MODULE)
+                .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE));
+        if (CollectionUtil.isNotEmpty(alarmInfos)) {
+            log.info("鐣岄潰鎶ヨ锛岀瓑寰呬汉宸ュ共棰勫鐞�");
+            return;
+        }
         S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class);
         log.info("杩涚墖浠诲姟寮�濮媨}", s7DataDLPOne);
         Boolean inkageEntity = s7DataDLPOne.getMesControl();
@@ -155,6 +174,13 @@
             if (entry.getValue() > 1) {
                 log.info("杩涚墖鐜荤拑{}瀛樺湪鐩稿悓锛岀粨鏉熸湰娆′换鍔�", entry.getKey());
                 //鍚憄lc鍙戦�佹姤璀�:鍚屼竴杞﹁繘鐗囩幓鐠冨瓨鍦ㄧ浉鍚�
+                ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
+                alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
+                alarmInfo.setAlarmModule(ALARM_MODULE);
+                alarmInfo.setAlarmType(ALARM_TYPE);
+                alarmInfo.setAlarmCode(ALARM_CODE_ID);
+                alarmInfo.setAlarmMessage(entry.getKey());
+                productAlarmInfoService.save(alarmInfo);
                 s7DataDLPOne = new S7DataDLPOne();
                 s7DataDLPOne.setAlarmSignal(2);
                 s7SerializerDLPOne.write(s7DataDLPOne);
@@ -166,6 +192,17 @@
         if (CollectionUtil.isNotEmpty(detailsList)) {
             log.info("鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑{}锛岀粨鏉熸湰娆′换鍔�", detailsList);
             //鍚憄lc鍙戦�佹姤璀�:鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑
+            List<String> sameGlassIds = detailsList.stream()
+                    .map(BigStorageCageDetails::getGlassId)
+                    .collect(Collectors.toList());
+            ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
+            alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
+            alarmInfo.setAlarmModule(ALARM_MODULE);
+            alarmInfo.setAlarmType(ALARM_TYPE);
+            alarmInfo.setAlarmCode(ALARM_CODE_ID);
+            alarmInfo.setAlarmMessage(sameGlassIds.toString());
+            productAlarmInfoService.save(alarmInfo);
+
             s7DataDLPOne = new S7DataDLPOne();
             s7DataDLPOne.setAlarmSignal(4);
             s7SerializerDLPOne.write(s7DataDLPOne);

--
Gitblit v1.8.0