| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | 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,不执行任务"); |
| | |
| | | List<String> glassList = downGlassTaskList.stream().map(DownGlassTask::getGlassId).collect(Collectors.toList()); |
| | | //将任务表中的数据删除 |
| | | downGlassTaskService.remove(new LambdaQueryWrapper<DownGlassTask>().in(DownGlassTask::getTaskType, Const.GLASS_CACHE_TYPE_OUT_ALL).in(DownGlassTask::getGlassId, glassList)); |
| | | //清除下片玻璃信息表数据 |
| | | downGlassInfoService.remove(new LambdaQueryWrapper<DownGlassInfo>().in(DownGlassInfo::getGlassId, glassList)); |
| | | //下片数量-1 |
| | | for (DownGlassTask downGlassTask : downGlassTaskList |
| | | ) { |
| | | if (Const.GLASS_CACHE_TYPE_OUT_ALL.equals(downGlassTask.getTaskType())) { |
| | | downWorkstationService.update( |
| | | new LambdaUpdateWrapper<DownWorkstation>() |
| | | .setSql("racks_number = racks_number-1") |
| | | .eq(DownWorkstation::getWorkstationId, downGlassTask.getEndCell()) |
| | | ); |
| | | |
| | | } |
| | | } |
| | | List<Damage> damageList = downGlassTaskList.stream().map(e -> { |
| | | Damage damage = new Damage(); |
| | | damage.setGlassId(e.getGlassId()); |
| | |
| | | } 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()); |
| | | 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(0); |
| | | } |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_IN); |
| | | downStorageCageDetails.setSlot(nearestEmpty.getSlot()); |
| | | downStorageCageDetails.setDeviceId(nearestEmpty.getDeviceId()); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | // 生成进片任务 |
| | | initDownGlassTask(glassInfo, 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | //删除理片笼表拿走/破损数据数据 |
| | | damageService.deleteByGlassId(glassInfo.getGlassId()); |
| | | } |
| | | |
| | | public Boolean outTo(String glassStatus06, String out08Glassstate, String glassStatus11, String |
| | |
| | | if (StringUtils.isNotBlank(glassId)) { |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | BeanUtils.copyProperties(glassInfo, cageDetails); |
| | | //当需要合并落架时不绑定层号 |
| | | if (glassInfo.getCombine() != 0) { |
| | | cageDetails.setLayer(0); |
| | | } |
| | | //获取当前笼子空格信息 |
| | | DownStorageCage empty = downStorageCageService.selectCacheEmpty(Integer.parseInt(currentSlot), Boolean.TRUE); |
| | | cageDetails.setSlot(empty.getSlot()); |
| | |
| | | //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 { |
| | |
| | | List<Integer> workList = new ArrayList(); |
| | | if (flag08) { |
| | | if (!"2".equals(glassStatus11)) { |
| | | workList.addAll(Const.G11_WORK_STATION); |
| | | List<Integer> wroklistOne = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getEnableState, Const.SLOT_ON).in(DownWorkstation::getWorkstationId, Const.G11_WORK_STATION)) |
| | | .stream() |
| | | .map(DownWorkstation::getWorkstationId) |
| | | .collect(Collectors.toList()); |
| | | workList.addAll(wroklistOne); |
| | | } |
| | | } else { |
| | | if (!"2".equals(glassStatus06)) { |
| | | workList.addAll(Const.G06_WORK_STATION); |
| | | List<Integer> wroklistTwo = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getEnableState, Const.SLOT_ON).in(DownWorkstation::getWorkstationId, Const.G06_WORK_STATION)) |
| | | .stream() |
| | | .map(DownWorkstation::getWorkstationId) |
| | | .collect(Collectors.toList()); |
| | | workList.addAll(wroklistTwo); |
| | | } |
| | | } |
| | | List<Integer> workStationAll = Arrays.asList(1, 2, 3, 4, 5, 6); |
| | |
| | | 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 -> { |
| | |
| | | if (null != emptyDownWorkstation) { |
| | | log.info("获取到空架子信息,绑定流程卡"); |
| | | downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), emptyDownWorkstation.getWorkstationId(), downStorageCageDetails.getLayer()); |
| | | // downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), emptyDownWorkstation.getId(), downStorageCageDetails.getLayer()); |
| | | endCell = emptyDownWorkstation.getWorkstationId(); |
| | | } else { |
| | | //todo:增加虚拟工位,绑定流程卡 |
| | | // downWorkstationService.insertDownWorkstation(); |
| | | // endCell = Const.G13_WORK_STATION; |
| | | // downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), emptyDownWorkstation.getId(), downStorageCageDetails.getLayer()); |
| | | log.info("没有空架子信息,无法绑定流程卡"); |
| | | return Boolean.FALSE; |
| | | } |
| | | } else { |
| | | DownWorkstation workstation = downWorkstationService.getOne(new LambdaUpdateWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getFlowCardId, downStorageCageDetails.getFlowCardId()).eq(DownWorkstation::getLayer, downStorageCageDetails.getLayer())); |
| | | endCell = workstation.getWorkstationId(); |
| | | if (downStorageCageDetails.getWidth() > maxWidth || downStorageCageDetails.getHeight() > maxHeight) { |
| | | endCell = Const.G13_WORK_STATION; |
| | | } else { |
| | | DownWorkstation workstation; |
| | | workstation = downWorkstationService.getOne(new LambdaUpdateWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getFlowCardId, downStorageCageDetails.getFlowCardId()).eq(DownWorkstation::getLayer, downStorageCageDetails.getLayer())); |
| | | endCell = workstation.getWorkstationId(); |
| | | } |
| | | } |
| | | //更新落架玻璃数量 |
| | | if (endCell == Const.G13_WORK_STATION) { |
| | |
| | | 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()); |
| | | return initDownGlassTask(glassInfo, downStorageCageDetails.getSlot(), endCell, taskType); |
| | | } |
| | | |