| | |
| | | Integer slotMaxThickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS); |
| | | //按照玻璃厚度分组,判断剩余格子是否可以存放 |
| | | Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting())); |
| | | if (glassInfoList.get(0).getThickness() < slotMaxThickness) { |
| | | for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) { |
| | | int count = hollowBigStorageCageService.count(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth) |
| | | .le(HollowBigStorageCage::getMinThickness, entry.getKey()) |
| | | .ge(HollowBigStorageCage::getMaxThickness, entry.getKey())); |
| | | if (count < entry.getValue()) { |
| | | log.info("笼内格子剩余数量不足,结束本次进片"); |
| | | //向plc发送报警:笼内格子剩余数量不足 |
| | | s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | s7DataZKDLPOne.setAlramSignal(16); |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | //超大尺寸 |
| | | Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT); |
| | | Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS); |
| | | if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) { |
| | | int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | if (count > 0) { |
| | | log.info("直通片台存在玻璃,结束本次进片"); |
| | | //向plc发送报警:直通片台存在玻璃,无法继续直通 |
| | | // if (glassInfoList.get(0).getThickness() < slotMaxThickness) { |
| | | for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) { |
| | | int count = hollowBigStorageCageService.count(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth) |
| | | .le(HollowBigStorageCage::getMinThickness, entry.getKey()) |
| | | .ge(HollowBigStorageCage::getMaxThickness, entry.getKey())); |
| | | if (count < entry.getValue()) { |
| | | log.info("笼内格子剩余数量不足,结束本次进片"); |
| | | //向plc发送报警:笼内格子剩余数量不足 |
| | | s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | s7DataZKDLPOne.setAlramSignal(64); |
| | | s7DataZKDLPOne.setAlramSignal(16); |
| | | s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | return; |
| | | } |
| | | } |
| | | // } |
| | | //超大尺寸 |
| | | // Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT); |
| | | // Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS); |
| | | // if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) { |
| | | // int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | // .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | // .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | | // if (count > 0) { |
| | | // log.info("直通片台存在玻璃,结束本次进片"); |
| | | // //向plc发送报警:直通片台存在玻璃,无法继续直通 |
| | | // s7DataZKDLPOne = new S7DataZKDLPOne(); |
| | | // s7DataZKDLPOne.setAlramSignal(64); |
| | | // s7SerializerZKDLPOne.write(s7DataZKDLPOne); |
| | | // return; |
| | | // } |
| | | // } |
| | | |
| | | log.info("将钢化小片表内的状态改为钢化结束,玻璃id有:{}", glassIdList); |
| | | //修改钢化任务表中的状态 |
| | |
| | | Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP); |
| | | |
| | | log.info("开始计算目标格子,玻璃id有:{}", inTaskList); |
| | | if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) { |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | // if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) { |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | if (from == 910) { |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | HollowBigStorageDTO bigStorageDTO = null; |
| | | try { |
| | |
| | | .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence()) |
| | | .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence()) |
| | | ); |
| | | |
| | | } else { |
| | | task.setTargetSlot(THROUGH_SLOT); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | | historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN); |
| | | historyTask.setGlassCount(glassInfoList.size()); |
| | | historyTask.setTaskState(Const.ENGINEERING_NEW); |
| | | historyTasks.add(historyTask); |
| | | GlassInfo info = glassInfoList.get(0); |
| | | HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setSlot(THROUGH_SLOT); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setDeviceId(0); |
| | | cageDetails.setSequence(0); |
| | | cageDetails.setHollowSequence(0); |
| | | cageDetails.setGap(glassGap); |
| | | cageDetails.setFilmsId(info.getFilmsid()); |
| | | cageDetails.setId(null); |
| | | hollowBigStorageCageDetailsService.save(cageDetails); |
| | | } |
| | | } else { |
| | | BigStorageCageTask task = inTaskList.get(0); |
| | | task.setTargetSlot(THROUGH_SLOT); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | | historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN); |
| | | historyTask.setGlassCount(glassInfoList.size()); |
| | | historyTask.setTaskState(Const.ENGINEERING_NEW); |
| | | historyTasks.add(historyTask); |
| | | GlassInfo info = glassInfoList.get(0); |
| | | HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails(); |
| | | BeanUtils.copyProperties(info, cageDetails); |
| | | cageDetails.setSlot(THROUGH_SLOT); |
| | | cageDetails.setState(Const.GLASS_STATE_NEW); |
| | | cageDetails.setDeviceId(0); |
| | | cageDetails.setSequence(0); |
| | | cageDetails.setHollowSequence(0); |
| | | cageDetails.setGap(glassGap); |
| | | cageDetails.setFilmsId(info.getFilmsid()); |
| | | cageDetails.setId(null); |
| | | hollowBigStorageCageDetailsService.save(cageDetails); |
| | | } |
| | | |
| | | //历史数据入库 |
| | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inCarTask() { |
| | | //读取协议数据 |
| | | S7DataZKDLPTwo s7DataZKDLPTwo = s7SerializerZKDLPTwo.read(S7DataZKDLPTwo.class); |
| | | //汇报字为1 启动字为1是 清除所有任务信息 |
| | | //启动字和汇报字是否均为0 |
| | | List<String> glassIdList = hollowGlassQueueInfoService.queryNeedInCarGlass(); |
| | | if (CollectionUtil.isEmpty(glassIdList)) { |
| | | return; |
| | | } |
| | | List<HollowBigStorageCageDetails> list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .in(HollowBigStorageCageDetails::getDeviceId, 5) |
| | | .in(HollowBigStorageCageDetails::getGlassId, glassIdList)); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return; |
| | | } |
| | | //todo:生成进进片大车任务 |
| | | |
| | | } |
| | | |
| | | |
| | | private void dealDamageInTask(List<BigStorageCageTask> damageTaskList) { |
| | | // 获取进片任务表中状态为破损的数据 |
| | | log.info("破损的玻璃信息有:{}", damageTaskList); |