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/OPCPlcSlicecage.java | 19 ++++++++-
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java | 37 ++++++++++++++++++
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java | 25 ++++++++++--
3 files changed, 75 insertions(+), 6 deletions(-)
diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
index ec636fd..82720c8 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer;
import com.kangaroohy.milo.service.MiloService;
+import com.mes.alarm.entity.ProductAlarmInfo;
+import com.mes.alarm.service.ProductAlarmInfoService;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.entity.dto.BigStorageSummaryDTO;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
@@ -72,11 +74,22 @@
@Resource
private WebSocketUtils webSocketUtils;
+ @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";
+
private JSONObject jsonObject = new JSONObject();
public void queryDataSource1() throws Exception {
- S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class);
- S7DataDLPTwo s7DataWLTwo = s7SerializerDLPTwo.read(S7DataDLPTwo.class);
+ jsonObject.append("alarmInfo", productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>()
+ .eq(ProductAlarmInfo::getState, Const.LOAD_RAW_GLASS_NEW)
+ .eq(ProductAlarmInfo::getAlarmModule, ALARM_MODULE)
+ .eq(ProductAlarmInfo::getAlarmType, ALARM_TYPE)));
List<Double> carPostion = new ArrayList<>();
carPostion.add(0.25);
carPostion.add(0.5);
@@ -84,6 +97,8 @@
//鐣岄潰灞曠ず绗煎瓙淇℃伅
jsonObject.append("bigStorageCageInfos", bigStorageCageDetailsService.querybigStorageCageDetail());
+ S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class);
+ S7DataDLPTwo s7DataWLTwo = s7SerializerDLPTwo.read(S7DataDLPTwo.class);
try {
//杩涚墖浠诲姟鏁版嵁
List<BigStorageTaskVO> inTaskList = new ArrayList();
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);
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