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 | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 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 a2aaa2f..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
@@ -3,11 +3,14 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.xingshuangs.iot.protocol.s7.serializer.S7Serializer;
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;
@@ -96,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();
@@ -154,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);
@@ -165,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);
@@ -367,8 +405,10 @@
}
String temperingEngineerId = redisUtil.getCacheObject("temperingEngineerId");
if (StringUtils.isNotBlank(temperingEngineerId)) {
- TemperingGlassInfo temperingGlassInfo = temperingGlassInfoService.getOne(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getEngineerId, temperingEngineerId)
- .orderByDesc(TemperingGlassInfo::getTemperingLayoutId).last("limit 1"));
+ TemperingGlassInfo temperingGlassInfo = temperingGlassInfoService.getOne(new QueryWrapper<TemperingGlassInfo>()
+ .select("Top 1 *")
+ .eq("engineer_id", temperingEngineerId)
+ .orderByDesc("tempering_layout_id"));
int temperingLayoutId = 1;
if (temperingGlassInfo != null) {
temperingLayoutId = temperingGlassInfo.getTemperingLayoutId() + 1;
--
Gitblit v1.8.0