ZengTao
2025-09-23 89c996b653b0a24e329d2a11f91f4eb20872432b
1、大理片添加报警功能
3个文件已修改
81 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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();
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());
                //向plc发送报警:同一车进片玻璃存在相同
                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);
            //向plc发送报警:理片笼存在相同的进片玻璃
            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);
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);
                //向plc发送报警:同一车进片玻璃存在相同
                s7DataZKDLPOne = new S7DataZKDLPOne();
                s7DataZKDLPOne.setAlramSignal(2);
@@ -191,6 +198,16 @@
        if (CollectionUtil.isNotEmpty(detailsList)) {
            log.info("理片笼存在相同的进片玻璃{},结束本次任务", detailsList);
            //向plc发送报警:理片笼存在相同的进片玻璃
            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);
                    //重置详情表数据