| | |
| | | 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; |
| | |
| | | */ |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | } |
| | | 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; |