| | |
| | | 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() throws Exception { |
| | | 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); |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("进片任务开始{}", s7DataDLPOne); |
| | | Boolean inkageEntity = s7DataDLPOne.getMesControl(); |
| | | if (true != inkageEntity) { |
| | | log.info("当前为非联机状态,结束进片任务"); |
| | | return; |
| | | } |
| | | // ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP1A.DLP1A.RequestMes"); |
| | | // if (!"1".equals(requestEntity.getValue() + "")) { |
| | | String requestEntity = s7DataDLPOne.getRequestMes().toString(); |
| | | if (!"1".equals(requestEntity)) { |
| | | log.info("当前未收到进片请求,结束进片任务"); |
| | | return; |
| | | } |
| | | // ReadWriteEntity mesReplyEntity = miloService.readFromOpcUa("DLP1A.DLP1A.MesReply"); |
| | | // if ("1".equals(mesReplyEntity.getValue() + "")) { |
| | | String mesReplyEntity = s7DataDLPOne.getMesReply().toString(); |
| | | if ("1".equals(mesReplyEntity)) { |
| | | log.info("有正在执行的任务,结束进片任务"); |
| | |
| | | } |
| | | //获取进片任务信息 |
| | | List<BigStorageCageTask> inTaskList = new ArrayList(); |
| | | // ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM1"); |
| | | String fromOpcUa = s7DataDLPOne.getFrom1().toString(); |
| | | |
| | | List<String> ids = s7DataDLPOne.getIds(); |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | for (int i = 0; i < 6; i++) { |
| | | // ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i); |
| | | String requestWord = ids.get(i); |
| | | // if (null != requestWord.getValue()) { |
| | | if (null != requestWord && !requestWord.isEmpty()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | // task.setGlassId(requestWord.getValue() + ""); |
| | | task.setGlassId(requestWord); |
| | | // task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + "")); |
| | | task.setStartSlot(Integer.parseInt(fromOpcUa)); |
| | | inTaskList.add(task); |
| | | // glassIdList.add(requestWord.getValue() + ""); |
| | | glassIdList.add(requestWord); |
| | | continue; |
| | | } |
| | |
| | | return; |
| | | } |
| | | log.info("获取任务的玻璃id:{}", glassIdList); |
| | | // ReadWriteEntity countEntity = miloService.readFromOpcUa("DLP1A.DLP1A.glassCount"); |
| | | String countEntity = s7DataDLPOne.getGlassCount().toString(); |
| | | // if (null == countEntity.getValue() || Integer.parseInt(countEntity.getValue() + "") != glassIdList.size()) { |
| | | if (null == countEntity || Integer.parseInt(countEntity) != glassIdList.size()) { |
| | | log.info("当前大车进片玻璃数量{}与mes读取到的数量{}不匹配,结束进片任务", countEntity, glassIdList.size()); |
| | | //向plc发送报警:当前大车进片玻璃数量与mes读取到的数量不匹配 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 1)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlarmSignal(1); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | |
| | | if (entry.getValue() > 1) { |
| | | log.info("进片玻璃{}存在相同,结束本次任务", entry.getKey()); |
| | | //向plc发送报警:同一车进片玻璃存在相同 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 2)); |
| | | 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发送报警:理片笼存在相同的进片玻璃 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 4)); |
| | | 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); |
| | |
| | | if (glassInfoList.size() != inTaskList.size()) { |
| | | log.info("进片任务数量{}与玻璃数量{}不匹配,结束本次进片", inTaskList.size(), glassInfoList.size()); |
| | | //向plc发送报警:进片任务数量与系统查询到的玻璃数量不匹配 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 8)); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setAlarmSignal(8); |
| | | s7SerializerDLPOne.write(s7DataDLPOne); |
| | |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | BigStorageDTO bigStorageDTO = bigStorageGlassInfoService.queryBigStorageTargetSlot(info.getEngineerId(), info.getTemperingLayoutId(), info.getTemperingFeedSequence()); |
| | | //获取目标格子信息 |
| | | // BigStorageDTO bigStorageDTO = bigStorageCageDetailsService.queryTargetSlotByTempering(info); |
| | | // 临时更新格子的剩余尺寸:防止相邻玻璃进同一格子造成剩余尺寸不足,玻璃越界的情况,任务完成后再次更新大理片笼表剩余宽度(按照笼内玻璃数量更新大理片笼剩余尺寸) |
| | | bigStorageCageService.update(new LambdaUpdateWrapper<BigStorageCage>() |
| | | .set(BigStorageCage::getRemainWidth, bigStorageDTO.getWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap) |
| | |
| | | } else { |
| | | BigStorageCageTask task = inTaskList.get(0); |
| | | task.setTargetSlot(THROUGH_SLOT); |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", task); |
| | | //存放历史任务 |
| | | BigStorageCageHistoryTask historyTask = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | |
| | | //历史数据入库 |
| | | bigStorageCageHistoryTaskService.saveBatch(historyTasks); |
| | | //向opc发送启动信号 |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // for (int i = 1; i <= inTaskList.size(); i++) { |
| | | // list.add(generateReadWriteEntity("DLP1A.DLP1A.TO" + i, inTaskList.get(i - 1).getTargetSlot())); |
| | | // } |
| | | // list.add(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 1)); |
| | | // miloService.writeToOpcWord(list); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | for (int i = 0; i < inTaskList.size(); i++) { |
| | | Integer value = Integer.parseInt(inTaskList.get(i).getTargetSlot().toString()); |
| | |
| | | public void outBigStorageTask() throws Exception { |
| | | Date startDate = new Date(); |
| | | S7DataDLPTwo s7DataWLTwo = s7SerializerDLPTwo.read(S7DataDLPTwo.class); |
| | | log.info("出片任务开始{}",s7DataWLTwo); |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | log.info("出片任务开始{}", s7DataWLTwo); |
| | | Boolean inkageEntity = s7DataWLTwo.getMesControl(); |
| | | if (true != inkageEntity) { |
| | | log.info("当前为非联机状态,结束进片任务"); |
| | | return; |
| | | } |
| | | // ReadWriteEntity requestEntity = miloService.readFromOpcUa("DLP1B.DLP1B.RequestMes"); |
| | | // if (!"1".equals(requestEntity.getValue() + "")) { |
| | | String requestEntity = s7DataWLTwo.getRequestMes().toString(); |
| | | if (!"1".equals(requestEntity)) { |
| | | log.info("当前未收到出片请求,结束出片任务"); |
| | |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataWLTwo); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | | } |
| | | //是否允许钢化 |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | |
| | | Integer temperingOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_TEMPERING_OUT_TARGET_POSITION); |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingLayoutId).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfoByVirtualSlot(unFinishTemperingGlassInfoList, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | BigStorageCageDetails details = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1")); |
| | | if (details != null) { |
| | | TemperingGlassInfo temperingGlassInfo = new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(details, temperingGlassInfo); |
| | | temperingGlassInfo.setState(-1); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | computeOutGlassInfoByVirtualSlot(Arrays.asList(temperingGlassInfo), "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | return; |
| | | } |
| | | |
| | | if (redisUtil.getCacheObject("temperingSwitch")) { |
| | | //钢化优先:获取理片笼 玻璃小片 破损表 数量 判断笼内版图是否到齐 |
| | | List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll(); |
| | | if (CollectionUtil.isNotEmpty(temperingLayoutDTOList)) { |
| | | //玻璃到齐包括已出片的 |
| | | //到齐,将玻璃小片数据存入钢化小片表,逻辑生成出片任务 结束 |
| | | for (TemperingLayoutDTO item : temperingLayoutDTOList) { |
| | | // if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) { |
| | | //是否允许钢化 |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingLayoutId).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfoByVirtualSlot(unFinishTemperingGlassInfoList, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | BigStorageCageDetails details = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1")); |
| | | if (details != null) { |
| | | TemperingGlassInfo temperingGlassInfo = new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(details, temperingGlassInfo); |
| | | temperingGlassInfo.setState(-1); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | computeOutGlassInfoByVirtualSlot(Arrays.asList(temperingGlassInfo), "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | return; |
| | | } |
| | | String temperingEngineerId = redisUtil.getCacheObject("temperingEngineerId"); |
| | | if (StringUtils.isNotBlank(temperingEngineerId)) { |
| | | 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; |
| | | } |
| | | List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getEngineerId, temperingEngineerId).eq(GlassInfo::getTemperingLayoutId, temperingLayoutId)); |
| | | if (CollectionUtil.isEmpty(glassInfos)) { |
| | | //指定钢化工程执行完成,移除工程号 |
| | | redisUtil.deleteObject("temperingEngineerId"); |
| | | return; |
| | | } |
| | | List<TemperingLayoutDTO> temperingLayoutDTOS = bigStorageCageDetailsService.temperingIsAllByTemperingLayoutId(temperingEngineerId, temperingLayoutId); |
| | | if (CollectionUtil.isNotEmpty(temperingLayoutDTOS)) { |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) |
| | | .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + |
| | | ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + |
| | | "t.angle,t1.slot,t.engineer_id") |
| | | .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId()) |
| | | .eq(GlassInfo::getEngineerId, item.getEngineerId()) |
| | | .eq(GlassInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(GlassInfo::getEngineerId, temperingEngineerId) |
| | | .orderByAsc(GlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //是否有人工下片任务 有直接出 |
| | | Integer artificialOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_ARTIFICIAL_OUT_TARGET_POSITION); |
| | | Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE); |
| | |
| | | } |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | | if (redisUtil.getCacheObject("dispatchSwitch")) { |
| | | //获取进片协议内容,在进片有请求/进片任务执行中不执行调度任务 |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | String requestInEntity = s7DataDLPOne.getRequestMes().toString(); |
| | | if ("1".equals(requestInEntity)) { |
| | | log.info("当前收到进片请求,结束调度任务"); |
| | | return; |
| | | } |
| | | String mesReplyInEntity = s7DataDLPOne.getMesReply().toString(); |
| | | if ("1".equals(mesReplyInEntity)) { |
| | | log.info("有正在执行的进片任务,结束调度任务"); |
| | | return; |
| | | } |
| | | //todo:获取笼内单格已经到齐的玻璃格子信息 |
| | | List<BigStorageRelationDTO> virtualList = bigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot(); |
| | | if (CollectionUtil.isEmpty(virtualList)) { |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishInBigStorageTask() throws Exception { |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1A.DLP1A.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | Boolean inkageEntity = s7DataDLPOne.getMesControl(); |
| | | if (true != inkageEntity) { |
| | | log.info("当前为非联机状态,结束完成进片任务"); |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | // List<BigStorageCageTask> inTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_in_one_task"); |
| | | List<BigStorageCageTask> inTaskList = new ArrayList(); |
| | | |
| | | List<String> glassIdList = new ArrayList<>(); |
| | | // ReadWriteEntity toWord = miloService.readFromOpcUa("DLP1A.DLP1A.TO1"); |
| | | // if ("0".equals(toWord.getValue() + "")) { |
| | | String toWord = s7DataDLPOne.getTo1().toString(); |
| | | if ("0".equals(toWord)) { |
| | | log.info("完成任务已执行,结束本次完成进片任务"); |
| | | return; |
| | | } |
| | | for (int i = 0; i < 6; i++) { |
| | | // ReadWriteEntity requestWord = miloService.readFromOpcUa("DLP1A.DLP1A.DI" + i); |
| | | // ReadWriteEntity statetWord = miloService.readFromOpcUa("DLP1A.DLP1A.STATE" + i); |
| | | // ReadWriteEntity toOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.TO" + i); |
| | | // ReadWriteEntity fromOpcUa = miloService.readFromOpcUa("DLP1A.DLP1A.FROM" + i); |
| | | String requestWord = ""; |
| | | String statetWord = ""; |
| | | String toOpcUa = ""; |
| | |
| | | break; |
| | | } |
| | | |
| | | // if (null != requestWord.getValue()) { |
| | | if (!requestWord.isEmpty()) { |
| | | BigStorageCageTask task = new BigStorageCageTask(); |
| | | // task.setGlassId(requestWord.getValue() + ""); |
| | | // task.setTargetSlot(Integer.parseInt(toOpcUa.getValue() + "")); |
| | | // task.setTaskState(Integer.parseInt(statetWord.getValue() + "")); |
| | | // task.setStartSlot(Integer.parseInt(fromOpcUa.getValue() + "")); |
| | | task.setGlassId(requestWord); |
| | | task.setTargetSlot(Integer.parseInt(toOpcUa)); |
| | | task.setTaskState(Integer.parseInt(statetWord)); |
| | | task.setStartSlot(Integer.parseInt(fromOpcUa)); |
| | | inTaskList.add(task); |
| | | // glassIdList.add(requestWord.getValue() + ""); |
| | | glassIdList.add(requestWord); |
| | | continue; |
| | | } |
| | |
| | | .eq(BigStorageCageHistoryTask::getGlassId, item.getGlassId())); |
| | | item.setTargetSlot(0); |
| | | //清空任务表数据 |
| | | // bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_one_task", item); |
| | | } |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | //向opc发送启动信号 |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // for (int i = 1; i <= 6; i++) { |
| | | // list.add(generateReadWriteEntity("DLP1A.DLP1A.TO" + i, 0)); |
| | | // } |
| | | // list.add(generateReadWriteEntity("DLP1A.DLP1A.MesReply", 0)); |
| | | // miloService.writeToOpcWord(list); |
| | | s7DataDLPOne = new S7DataDLPOne(); |
| | | s7DataDLPOne.setTo1(0); |
| | | s7DataDLPOne.setTo2(0); |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void finishOutBigStorageTask() throws Exception { |
| | | S7DataDLPTwo s7DataWLTwo = s7SerializerDLPTwo.read(S7DataDLPTwo.class); |
| | | // ReadWriteEntity inkageEntity = miloService.readFromOpcUa("DLP1B.DLP1B.mesControl"); |
| | | // if (true != Boolean.parseBoolean(inkageEntity.getValue() + "")) { |
| | | Boolean inkageEntity = s7DataWLTwo.getMesControl(); |
| | | if (true != inkageEntity) { |
| | | log.info("当前为非联机状态,结束完成出片任务"); |
| | |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = getOutTaskList(s7DataWLTwo); |
| | | // List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无出片玻璃,结束完成出片任务"); |
| | | return; |
| | |
| | | } |
| | | } |
| | | // 重置任务表数据 |
| | | // bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task"); |
| | | resetOutTask(); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | // miloService.writeToOpcWord(generateReadWriteEntity("DLP1B.DLP1B.MesReply", 0)); |
| | | S7DataDLPTwo s7DataDLPTwo = new S7DataDLPTwo(); |
| | | s7DataDLPTwo.setMesReply(0); |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | |
| | | } |
| | | } |
| | | s7SerializerDLPTwo.write(s7DataDLPTwo); |
| | | // bigStorageCageTaskService.removeAll("big_storage_cage_out_one_task"); |
| | | // bigStorageCageTaskService.saveTaskMessage(tableName, bigStorageCageTaskList); |
| | | List<BigStorageCageHistoryTask> historyList = bigStorageCageTaskList.stream().filter(e -> StringUtils.isNotBlank(e.getGlassId())).map(e -> { |
| | | BigStorageCageHistoryTask history = new BigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(e, history); |