| | |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Async |
| | | public void plcHomeEdgTask() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String requestWord = plcParameterObject.getPlcParameter("requestWord").getValue(); |
| | |
| | | String confirmationWrodAddress = plcParameterObject.getPlcParameter("confirmationWord").getAddress(); |
| | | String currentSlot = plcParameterObject.getPlcParameter("currentCell").getValue(); |
| | | |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:g06:{}、g08:{}、g11:{}、g13:{},当前格子号为:{}", |
| | | requestWord, glassIdeValue, confirmationWrodValue, out06Glassstate, out08Glassstate, out11Glassstate, out13Glassstate, currentSlot); |
| | | |
| | | if ("0".equals(requestWord)) { |
| | | if ("0".equals(confirmationWrodValue)) { |
| | | log.info("2、获取到的请求字为0,且确认字为0,不执行任务"); |
| | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Async |
| | | public void plcShelfFull() { |
| | | List<DownWorkstation> list = downGlassInfoService.queryWorkStationIsFull(); |
| | | S7control s7control = S7object.getinstance().plccontrol; |
| | | PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject; |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | S7control s7control = S7object.getinstance().plccontrol; |
| | | PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject; |
| | | s7control.writeWord(plcMesObject.getPlcParameter("alarm_signal").getAddress(), 1); |
| | | } else { |
| | | s7control.writeWord(plcMesObject.getPlcParameter("alarm_signal").getAddress(), 0); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | @Async |
| | | public void dealDamageTask() { |
| | | Date startDate = new Date(); |
| | | log.info("下片破损玻璃清除任务开始执行时间:{}", startDate); |
| | |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(e.getGlassId()); |
| | | damage.setLine(Const.TEMPERING_OUT_TARGET_POSITION); |
| | | damage.setWorkingProcedure("下片"); |
| | | damage.setWorkingProcedure("钢化"); |
| | | damage.setRemark("下片"); |
| | | damage.setStatus(0); |
| | | damage.setStatus(1); |
| | | damage.setType(e.getTaskStatus()); |
| | | return damage; |
| | | }).collect(Collectors.toList()); |
| | |
| | | * 更新已绑定工位流程卡的破损/拿走的数量信息 |
| | | */ |
| | | @Scheduled(fixedDelay = 1000) |
| | | @Async |
| | | public void updateWorkStationOtherCount() { |
| | | Date startDate = new Date(); |
| | | log.info("下片破更新损玻璃数量任务开始执行时间:{}", startDate); |
| | |
| | | //更新工位其他玻璃信息的数量 |
| | | QueryWrapper<Damage> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("process_id", downWorkstation.getFlowCardId()); |
| | | queryWrapper.eq("technology_number", downWorkstation.getLayer()); |
| | | queryWrapper.gt("type", 3); |
| | | if (downWorkstation.getLayer() != 0) { |
| | | queryWrapper.eq("technology_number", downWorkstation.getLayer()); |
| | | } |
| | | int otherNumber = damageService.count(queryWrapper); |
| | | downWorkstationService.update(new LambdaUpdateWrapper<DownWorkstation>().set(DownWorkstation::getOtherNumber, otherNumber) |
| | | .eq(DownWorkstation::getWorkstationId, downWorkstation.getWorkstationId())); |
| | |
| | | } else { |
| | | log.info("该玻璃尺寸非人工下片"); |
| | | //获取该玻璃的流程卡是否已绑定架子 |
| | | DownWorkstation one = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getLayer, glassInfo.getLayer()) |
| | | .eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); |
| | | DownWorkstation one; |
| | | if (glassInfo.getCombine() != 0) { |
| | | one = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); |
| | | } else { |
| | | one = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getLayer, glassInfo.getLayer()) |
| | | .eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); |
| | | } |
| | | |
| | | //是否已经绑定 true:已绑定 false:未绑定 |
| | | Boolean isBind = Boolean.FALSE; |
| | | if (null != one) { |
| | |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | log.info("有空架子,将流程卡与架子好绑定,执行进片任务 结束"); |
| | | //绑定流程卡 |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getWorkstationId(), glassInfo.getLayer()); |
| | | // downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getId(), glassInfo.getLayer()); |
| | | if (glassInfo.getCombine() == 0) { |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getWorkstationId(), glassInfo.getLayer()); |
| | | } else { |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getWorkstationId(), 0); |
| | | } |
| | | // downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getId(), glassInfo.getLayer()); |
| | | checkFlag = Boolean.TRUE; |
| | | } |
| | | } |
| | |
| | | DownStorageCageDetails downStorageCageDetails = new DownStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, downStorageCageDetails); |
| | | //当需要合并落架时不绑定层号 |
| | | if(glassInfo.getCombine()==0){ |
| | | downStorageCageDetails.setLayer(null); |
| | | if (glassInfo.getCombine() != 0) { |
| | | downStorageCageDetails.setLayer(0); |
| | | } |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_IN); |
| | | downStorageCageDetails.setSlot(nearestEmpty.getSlot()); |
| | |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | BeanUtils.copyProperties(glassInfo, cageDetails); |
| | | //当需要合并落架时不绑定层号 |
| | | if(glassInfo.getCombine()==0){ |
| | | cageDetails.setLayer(null); |
| | | if (glassInfo.getCombine() != 0) { |
| | | cageDetails.setLayer(0); |
| | | } |
| | | //获取当前笼子空格信息 |
| | | DownStorageCage empty = downStorageCageService.selectCacheEmpty(Integer.parseInt(currentSlot), Boolean.TRUE); |
| | |
| | | //2、08台空闲,先走扔工下片或2号机械臂,无玻璃出片 在走1号机械臂 |
| | | //机械臂被禁用的情况下不能继续向禁用的机械臂放玻璃 |
| | | Boolean flag08 = "1".equals(out08Glassstate) ? Boolean.TRUE : Boolean.FALSE; |
| | | flag08 = true; |
| | | if (!flag08) { |
| | | generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | } else { |
| | |
| | | Map<String, List<DownWorkstation>> listMap = downWorkstationList.stream() |
| | | .filter(item -> StringUtils.isNotBlank(item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | //过滤筛选获取架子上对应流程卡+层数的笼子内的玻璃信息 |
| | | |
| | | list = tempList.stream().filter(item -> listMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(list) && flag08 && !"2".equals(glassStatus13)) { |
| | | list = tempList.stream().filter(item -> { |
| | |
| | | return Boolean.FALSE; |
| | | } |
| | | } else { |
| | | if (downStorageCageDetails.getWidth() > maxWidth || downStorageCageDetails.getHeight() > maxHeight) { |
| | | double firstLength = Math.max(downStorageCageDetails.getWidth(), downStorageCageDetails.getHeight()); |
| | | double secondLength = Math.min(downStorageCageDetails.getWidth(), downStorageCageDetails.getHeight()); |
| | | if (firstLength > maxWidth || secondLength > maxHeight) { |
| | | endCell = Const.G13_WORK_STATION; |
| | | } else { |
| | | DownWorkstation workstation = downWorkstationService.getOne(new LambdaUpdateWrapper<DownWorkstation>() |
| | | DownWorkstation workstation; |
| | | workstation = downWorkstationService.getOne(new LambdaUpdateWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getFlowCardId, downStorageCageDetails.getFlowCardId()).eq(DownWorkstation::getLayer, downStorageCageDetails.getLayer())); |
| | | endCell = workstation.getWorkstationId(); |
| | | } |
| | |
| | | DownGlassInfo downGlassInfo = new DownGlassInfo(); |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | LambdaQueryWrapper<DownGlassInfo> wrapper = new LambdaQueryWrapper<DownGlassInfo>(); |
| | | wrapper.eq(DownGlassInfo::getFlowCardId, downGlassInfo.getFlowCardId()) |
| | | .orderByDesc(DownGlassInfo::getSequence) |
| | | .last("limit 1"); |
| | | if (downStorageCageDetails.getLayer() != 0) { |
| | | wrapper.eq(DownGlassInfo::getLayer, downGlassInfo.getLayer()); |
| | | } |
| | | // downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | int k = 0; |
| | | DownGlassInfo downGlassInfo1 = downGlassInfoService.getOne(wrapper); |
| | | if (downGlassInfo1 != null) { |
| | | k = 1; |
| | | } else { |
| | | k = 1; |
| | | } |
| | | downGlassInfo.setSequence(k); |
| | | downGlassInfo.setWorkStationId(endCell); |
| | | downGlassInfo.setGmtCreate(new Date()); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | | downStorageCageDetails.setLayer(0); |
| | | BeanUtils.copyProperties(downStorageCageDetails, glassInfo); |
| | | //删除理片笼表拿走/破损数据数据 |
| | | damageService.deleteByGlassId(glassInfo.getGlassId()); |
| | |
| | | downGlassTask.setTaskStatus(0); |
| | | downGlassTask.setCreateTime(new Date()); |
| | | downGlassTaskService.save(downGlassTask); |
| | | //添加报工数据 |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(glassInfo.getGlassId()); |
| | | damage.setWorkingProcedure("钢化"); |
| | | damage.setLine(4001); |
| | | damage.setType(1); |
| | | damage.setRemark("钢化后卧式理片"); |
| | | damageService.insertDamage(damage); |
| | | //向plc发送命令 |
| | | return sendMessageToPlc((int) glassInfo.getWidth(), (int) glassInfo.getHeight(), (int) glassInfo.getThickness(), |
| | | startCell, endCell, taskType); |