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/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index b7d3dbd..f98ca97 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -115,7 +115,8 @@
 
     private static final String ALARM_MODULE = "涓┖";
     private static final String ALARM_TYPE = "涓┖澶х悊鐗�";
-    private static final String ALARM_CODE = "sizeSame";
+    private static final String ALARM_CODE_SIZE = "sizeSame";
+    private static final String ALARM_CODE_ID = "idSame";
 
     /**
      * 鐩撮�氭牸瀛�
@@ -131,8 +132,7 @@
         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)
-                .eq(ProductAlarmInfo::getAlarmCode, ALARM_CODE));
+                .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE));
         if (CollectionUtil.isNotEmpty(alarmInfos)) {
             log.info("鐣岄潰鎶ヨ锛岀瓑寰呬汉宸ュ共棰勫鐞�");
             return;
@@ -179,6 +179,13 @@
         for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) {
             if (entry.getValue() > 1) {
                 log.info("杩涚墖鐜荤拑{}瀛樺湪鐩稿悓锛岀粨鏉熸湰娆′换鍔�", entry.getKey());
+                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);
                 //鍚憄lc鍙戦�佹姤璀�:鍚屼竴杞﹁繘鐗囩幓鐠冨瓨鍦ㄧ浉鍚�
                 s7DataZKDLPOne = new S7DataZKDLPOne();
                 s7DataZKDLPOne.setAlramSignal(2);
@@ -191,6 +198,16 @@
         if (CollectionUtil.isNotEmpty(detailsList)) {
             log.info("鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑{}锛岀粨鏉熸湰娆′换鍔�", detailsList);
             //鍚憄lc鍙戦�佹姤璀�:鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑
+            List<String> sameGlassIds = detailsList.stream()
+                    .map(HollowBigStorageCageDetails::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);
             s7DataZKDLPOne = new S7DataZKDLPOne();
             s7DataZKDLPOne.setAlramSignal(4);
             s7SerializerZKDLPOne.write(s7DataZKDLPOne);
@@ -275,7 +292,7 @@
                     alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
                     alarmInfo.setAlarmModule(ALARM_MODULE);
                     alarmInfo.setAlarmType(ALARM_TYPE);
-                    alarmInfo.setAlarmCode(ALARM_CODE);
+                    alarmInfo.setAlarmCode(ALARM_CODE_SIZE);
                     alarmInfo.setAlarmMessage(info.getGlassId());
                     productAlarmInfoService.save(alarmInfo);
                     //閲嶇疆璇︽儏琛ㄦ暟鎹�

--
Gitblit v1.8.0