| | |
| | | private Integer minHeight; |
| | | |
| | | |
| | | @Scheduled(fixedDelay = 3000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcHomeEdgTask() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String requestWord = plcParameterObject.getPlcParameter("requestWord").getValue(); |
| | |
| | | String confirmationWrodValue = plcParameterObject.getPlcParameter("confirmationWord").getValue(); |
| | | String confirmationWrodAddress = plcParameterObject.getPlcParameter("confirmationWord").getAddress(); |
| | | String currentSlot = plcParameterObject.getPlcParameter("currentCell").getValue(); |
| | | |
| | | |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:g06:{}、g08:{}、g11:{}、g13:{},当前格子号为:{}", |
| | |
| | | log.info("2、查询卧式理片笼里面的空格:{}", nearestEmpty); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | Assert.isFalse(null == glassInfo, "玻璃信息不存在"); |
| | | if ("1".equals(requestWord) && (glassInfo.getWidth() > throughWidth || glassInfo.getHeight() > throughHeight)) { |
| | | log.info("玻璃当前尺寸宽:{},高:{}只能直通,当前进片任务需等待", glassInfo.getWidth(), glassInfo.getHeight()); |
| | | double glassWidth = Math.max(glassInfo.getWidth(), glassInfo.getHeight()); |
| | | double glassHeight = Math.min(glassInfo.getWidth(), glassInfo.getHeight()); |
| | | if ("1".equals(requestWord) && (glassWidth > throughWidth || glassHeight > throughHeight)) { |
| | | log.info("玻璃当前尺寸宽:{},高:{}只能直通,当前进片任务需等待", glassWidth, glassHeight); |
| | | return; |
| | | } |
| | | Boolean checkFlag = Boolean.FALSE; |
| | | //玻璃尺寸是否走人工下片 |
| | | if (glassInfo.getWidth() > maxWidth || glassInfo.getHeight() > maxHeight || glassInfo.getWidth() < minWidth || glassInfo.getHeight() < minHeight) { |
| | | if (glassWidth > maxWidth || glassHeight > maxHeight || glassWidth < minWidth || glassHeight < minHeight) { |
| | | log.info("该玻璃尺寸不符合要求,需要走人工下片直接进片"); |
| | | } else { |
| | | log.info("该玻璃尺寸非人工下片"); |
| | |
| | | DownWorkstation 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) { |
| | | log.info("该流程卡已绑定架子"); |
| | |
| | | if (!checkFlag && !isBind) { |
| | | log.info("该玻璃的流程卡未绑定架子,获取是否有空架子"); |
| | | List<DownWorkstation> list = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNull(DownWorkstation::getFlowCardId).orderByDesc(DownWorkstation::getWorkstationId)); |
| | | .and(on -> on.isNull(DownWorkstation::getFlowCardId).or().eq(DownWorkstation::getFlowCardId, "")).orderByDesc(DownWorkstation::getWorkstationId)); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | log.info("有空架子,将流程卡与架子好绑定,执行进片任务 结束"); |
| | | //绑定流程卡 |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), glassInfo.getLayer(), list.get(0).getWorkstationId()); |
| | | downWorkstationService.updateFlowCardIdAndCount(glassInfo.getFlowCardId(), list.get(0).getWorkstationId(), glassInfo.getLayer()); |
| | | checkFlag = Boolean.TRUE; |
| | | } |
| | | } |
| | |
| | | endLoop: |
| | | for (DownGlassInfoDTO e : downGlassInfoDTOList) { |
| | | List<GlassInfo> glassInfoList = e.getGlassInfoList(); |
| | | Optional<GlassInfo> glassInfoTempOptional = glassInfoList.stream().filter(item -> item.getWidth() == glassInfo.getWidth() && item.getHeight() == glassInfo.getHeight() |
| | | && item.getThickness() == glassInfo.getThickness() && item.getFilmsid().equals(glassInfo.getFilmsid())) |
| | | .findFirst(); |
| | | if (glassInfoTempOptional.isPresent()) { |
| | | GlassInfo item = glassInfoTempOptional.get(); |
| | | //玻璃是否为多层 |
| | | checkFlag = multilayerCheck(item, Boolean.FALSE); |
| | | if (checkFlag) { |
| | | //玻璃替换 仅替换流程卡id及层数 |
| | | String tempFlowCardId = item.getFlowCardId(); |
| | | Integer tempLayer = item.getLayer(); |
| | | String flowCardId = glassInfo.getFlowCardId(); |
| | | Integer layer = glassInfo.getLayer(); |
| | | log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", |
| | | item, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); |
| | | glassInfo.setFlowCardId(tempFlowCardId); |
| | | glassInfo.setLayer(tempLayer); |
| | | glassInfoService.updateById(glassInfo); |
| | | item.setFlowCardId(flowCardId); |
| | | item.setLayer(layer); |
| | | glassInfoService.updateById(item); |
| | | break endLoop; |
| | | List<GlassInfo> glassInfoTempList = glassInfoList.stream().filter(item -> item.getWidth() == glassInfo.getWidth() && item.getHeight() == glassInfo.getHeight() |
| | | && item.getThickness() == glassInfo.getThickness() && item.getFilmsid().equals(glassInfo.getFilmsid())).collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(glassInfoTempList)) { |
| | | for (GlassInfo item : glassInfoTempList) { |
| | | //玻璃是否为多层:1、先获取当前流程卡落架最多的层数,如果为空,表明未绑定流程卡,未落架,然后按照是否可绑定架子决定是否替换。(可忽略不计,本校验仅在前一次调用起作用) |
| | | // 2、判断落架最多的层数是否为当前替换玻璃的层数,是 则走替换逻辑返回true |
| | | // 3、不是最多的层数,获取落架最多层数的相同次序的玻璃尺寸与当前替换玻璃的尺寸比较,相同走替换,否则继续循环 |
| | | // 4、单层玻璃直接走替换 |
| | | checkFlag = multilayerCheck(item, Boolean.FALSE); |
| | | if (checkFlag) { |
| | | //玻璃替换 仅替换流程卡id及层数 |
| | | String tempFlowCardId = item.getFlowCardId(); |
| | | Integer tempLayer = item.getLayer(); |
| | | String flowCardId = glassInfo.getFlowCardId(); |
| | | Integer layer = glassInfo.getLayer(); |
| | | log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", |
| | | item, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); |
| | | glassInfo.setFlowCardId(tempFlowCardId); |
| | | glassInfo.setLayer(tempLayer); |
| | | glassInfoService.updateById(glassInfo); |
| | | item.setFlowCardId(flowCardId); |
| | | item.setLayer(layer); |
| | | glassInfoService.updateById(item); |
| | | break endLoop; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_IN); |
| | | downStorageCageDetails.setSlot(nearestEmpty.getSlot()); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | |
| | | // 生成进片任务 |
| | | initDownGlassTask(glassInfo, 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | } |
| | |
| | | log.info("G06、G11、G13分别为{},{}、{}非自动状态,无法出片", glassStatus06, glassStatus11, glassStatus13); |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | List<DownStorageCageDetails> tempList = downStorageCageDetailsService.list(new LambdaQueryWrapper<DownStorageCageDetails>() |
| | | .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | log.info("出片1、笼内的玻璃信息有:{}", tempList); |
| | | //获取待进片玻璃 |
| | | DownStorageCageDetails cageDetails = new DownStorageCageDetails(); |
| | | if (StringUtils.isNotBlank(glassId)) { |
| | |
| | | cageDetails.setSlot(empty.getSlot()); |
| | | tempList.add(cageDetails); |
| | | } |
| | | |
| | | log.info("笼内玻璃的数据有:{}", tempList); |
| | | log.info("出片2:笼内玻璃的数据(包括待进片)有:{}", tempList); |
| | | if (CollectionUtils.isEmpty(tempList)) { |
| | | log.info("笼内没有玻璃,无法执行出片"); |
| | | return Boolean.FALSE; |
| | | } |
| | | //优先走08片台的玻璃:走人工下片或者2号机械臂 |
| | | //1、08台忙碌,仅走1号机械臂 |
| | | //2、08台空闲,先走扔工下片或2号机械臂,无玻璃出片 在走1号机械臂 |
| | | //机械臂被禁用的情况下不能继续向禁用的机械臂放玻璃 |
| | | Boolean flag08 = "1".equals(out08Glassstate) ? Boolean.TRUE : Boolean.FALSE; |
| | | if (!generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId)) { |
| | | return generateTaskByShelf(glassStatus06, glassStatus11, !flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | if (!flag08) { |
| | | generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | } else { |
| | | if (!generateTaskByShelf(glassStatus06, glassStatus11, flag08, glassStatus13, tempList, cageDetails, glassId)) { |
| | | return generateTaskByShelf(glassStatus06, glassStatus11, !flag08, glassStatus13, tempList, cageDetails, glassId); |
| | | } |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | |
| | | log.info("架子已经占满,多层玻璃无法找到对应的格子,需执行替换玻璃的操作"); |
| | | return Boolean.FALSE; |
| | | } |
| | | |
| | | } |
| | | if (downGlassInfoDTO.getLayer().equals(glassInfo.getLayer())) { |
| | | log.info("当前玻璃的流程在架子上落架最多 直接进片"); |
| | |
| | | glassStatus13, List<DownStorageCageDetails> tempList, DownStorageCageDetails cageDetails, String glassId) { |
| | | //获取2个机械臂范围内的架子绑定的流程卡信息 |
| | | List<Integer> workList = new ArrayList(); |
| | | |
| | | if (flag08) { |
| | | if (!"2".equals(glassStatus11)) { |
| | | workList.addAll(Const.G11_WORK_STATION); |
| | |
| | | workList.addAll(Const.G06_WORK_STATION); |
| | | } |
| | | } |
| | | List<Integer> workStationAll = Arrays.asList(1, 2, 3, 4, 5, 6); |
| | | List<Integer> offWorkStationList = workStationAll.stream().filter(e -> !workList.contains(e)).collect(Collectors.toList()); |
| | | List<DownStorageCageDetails> list = new ArrayList(); |
| | | //是否有空架子 true:有 false:无 |
| | | Boolean isEmptyShelf = Boolean.FALSE; |
| | | //对笼内玻璃进行过滤,仅出符合逻辑的玻璃 |
| | | if (CollectionUtils.isNotEmpty(workList)) { |
| | | List<DownWorkstation> downWorkstationList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .eq(DownWorkstation::getEnableState, Const.SLOT_ON).in(DownWorkstation::getWorkstationId, workList)); |
| | | // log.info("架子被禁用,无法出片落架"); |
| | | if (CollectionUtils.isEmpty(downWorkstationList)) { |
| | | log.info("笼子被禁用,无法走机械臂下片"); |
| | | //走人工下片 |
| | | if (!"2".equals(glassStatus13)) { |
| | | list = tempList.stream().filter(item -> item.getWidth() > maxWidth || item.getHeight() > maxHeight).collect(Collectors.toList()); |
| | | if (flag08 && !"2".equals(glassStatus13)) { |
| | | list = tempList.stream().filter(item -> { |
| | | double firstLength = Math.max(item.getWidth(), item.getHeight()); |
| | | double secondLength = Math.min(item.getWidth(), item.getHeight()); |
| | | return firstLength > maxWidth || secondLength > maxHeight; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } else { |
| | | List<DownWorkstation> workstationsIsNotBind = downWorkstationList.stream().filter(item -> null == (item.getFlowCardId())).collect(Collectors.toList()); |
| | | Map<String, List<DownWorkstation>> listMap = downWorkstationList.stream().collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | //获取可落架的的架子信息(包括空架子) |
| | | //仅获取空架子信息 |
| | | List<DownWorkstation> workstationsIsNotBind = downWorkstationList.stream().filter(item -> StringUtils.isBlank(item.getFlowCardId())).collect(Collectors.toList()); |
| | | //将架子的流程卡号及层数作为key 不存在空架子的情况 |
| | | if (CollectionUtils.isEmpty(workstationsIsNotBind)) { |
| | | log.info("不存在未绑定流程卡架子"); |
| | | //筛选出对应架子已绑定流程卡可下片的玻璃 |
| | | 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()); |
| | | } else { |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃"); |
| | | log.info("存在未绑定流程卡架子,直接获取笼内所有玻璃,且未绑定架子的玻璃信息"); |
| | | //获取禁用及非本机械臂的架子的流程号及层数对应的玻璃信息 |
| | | List<DownWorkstation> downWorkstationOffList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | .and(i -> i.in(DownWorkstation::getWorkstationId, offWorkStationList).or().eq(DownWorkstation::getEnableState, Const.SLOT_OFF))); |
| | | //获取被禁用的流程卡信息 为空:将返回笼内的所有玻璃信息 |
| | | if (CollectionUtils.isEmpty(downWorkstationOffList)) { |
| | | list = tempList; |
| | | } else { |
| | | //笼内存在无法出片的玻璃信息,过滤无法出片的玻璃信息,仅获取可出片的玻璃信息 无法出片的玻璃为:未绑定架子、绑定架子被禁用、非本机械臂对应的架子 |
| | | Map<String, List<DownWorkstation>> listOffMap = downWorkstationOffList.stream().filter(item -> StringUtils.isNotBlank(item.getFlowCardId())).collect(Collectors.groupingBy(item -> item.getFlowCardId() + ":" + item.getLayer())); |
| | | list = tempList.stream().filter(item -> !listOffMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | } |
| | | //空架子表示置为true |
| | | isEmptyShelf = Boolean.TRUE; |
| | | //todo:如果禁用架子已绑定流程卡,因为时间不确定,笼子内的玻璃可重新绑定新架子 |
| | | // list = tempList.stream().filter(item -> !listMap.containsKey(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | list = tempList; |
| | | } |
| | | } |
| | | } else { |
| | | if (flag08 && !"2".equals(glassStatus13)) { |
| | | //直接走人工下片 |
| | | list = tempList.stream().filter(item -> item.getWidth() > maxWidth || item.getHeight() > maxHeight).collect(Collectors.toList()); |
| | | list = tempList.stream().filter(item -> { |
| | | double firstLength = Math.max(item.getWidth(), item.getHeight()); |
| | | double secondLength = Math.min(item.getWidth(), item.getHeight()); |
| | | return firstLength > maxWidth || secondLength > maxHeight; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | if (CollectionUtils.isEmpty(list)) { |
| | |
| | | return Boolean.FALSE; |
| | | } |
| | | String tempGlassId = null; |
| | | Boolean isBind = Boolean.FALSE; |
| | | Boolean isNeedBind = Boolean.FALSE; |
| | | |
| | | for (DownStorageCageDetails item : list) { |
| | | if (item.getWidth() > maxWidth || item.getHeight() > maxHeight) { |
| | | double firstLength = Math.max(item.getWidth(), item.getHeight()); |
| | | double secondLength = Math.min(item.getWidth(), item.getHeight()); |
| | | if (firstLength > maxWidth || secondLength > maxHeight) { |
| | | if (flag08 && !"2".equals(glassStatus13)) { |
| | | log.info("玻璃宽度或高度超出阈值,执行人工下片"); |
| | | tempGlassId = item.getGlassId(); |
| | |
| | | } |
| | | } |
| | | loop: |
| | | if (tempGlassId == null) { |
| | | if (StringUtils.isBlank(tempGlassId)) { |
| | | //获取正在落架的绑定流程卡的信息(流程卡、层数、落架数量) |
| | | List<DownGlassInfoDTO> downGlassInfoDTOList = downGlassInfoService.queryWorkStationIsIn(Boolean.TRUE); |
| | | List<String> downGlassFlowList = downGlassInfoDTOList.stream().map(item -> item.getFlowCardId() + ":" + item.getLayer()).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(downGlassFlowList)) { |
| | | //架子都未绑定流程卡,出笼内子数量最多尺寸最大的玻璃id,无 则返回扫描扫到的玻璃id进行出片 |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId); |
| | | isBind = Boolean.TRUE; |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId, offWorkStationList); |
| | | |
| | | isNeedBind = Boolean.TRUE; |
| | | break loop; |
| | | } |
| | | //将笼子内的玻璃进行过滤,仅获取无法落架的流程卡玻璃 |
| | | List<DownStorageCageDetails> noDownLoadList = list.stream().filter(item -> !downGlassFlowList.contains(item.getFlowCardId() + ":" + item.getLayer())).collect(Collectors.toList()); |
| | | List<DownStorageCageDetails> noDownLoadList = list.stream().filter(item -> !downGlassFlowList.contains(item.getFlowCardId() + ":" + item.getLayer())) |
| | | .collect(Collectors.toList()); |
| | | if (CollectionUtils.isNotEmpty(noDownLoadList)) { |
| | | //是否有空架子 |
| | | // List<DownWorkstation> emptyShelfList = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>() |
| | | // .isNull(DownWorkstation::getFlowCardId)); |
| | | if (isEmptyShelf) { |
| | | //架子都未绑定流程卡,出笼内子数量最多尺寸最大的玻璃id,无 则返回扫描扫到的玻璃id进行出片 |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId); |
| | | isBind = Boolean.TRUE; |
| | | tempGlassId = downStorageCageDetailsService.getGlassInfoMaxCount(glassId, offWorkStationList); |
| | | isNeedBind = Boolean.TRUE; |
| | | break loop; |
| | | } |
| | | } |
| | |
| | | DownGlassInfoDTO downGlassInfoDTO = downGlassInfoService.queryDownGlassMaxLayer(item.getFlowCardId()); |
| | | if (null == downGlassInfoDTO) { |
| | | // 历史落架玻璃按照相关流程卡取数据库未找到最多玻璃信息,表明当前流程卡下的有层的玻璃均未落架,直接可出当前玻璃 |
| | | log.info(""); |
| | | isBind = Boolean.FALSE; |
| | | tempGlassId = item.getGlassId(); |
| | | log.info("当前流程卡不存在落架的玻璃,可直接出片落架,玻璃id:{}", tempGlassId); |
| | | break loop; |
| | | } |
| | | if (downGlassInfoDTO.getLayer().equals(downGlassInfoDTO.getLayer())) { |
| | | log.info("当前玻璃的流程在架子上落架最多,直接出片"); |
| | | //更新玻璃状态,生成出片任务 |
| | | tempGlassId = item.getGlassId(); |
| | | isBind = Boolean.FALSE; |
| | | log.info("当前玻璃的流程在架子上落架最多,直接出片,玻璃id:{}", tempGlassId); |
| | | break loop; |
| | | } |
| | | Integer sequence = downGlassInfoService.queryMaxSequence(item.getFlowCardId(), item.getLayer()); |
| | |
| | | .eq(DownGlassInfo::getFlowCardId, downGlassInfoDTO.getFlowCardId()) |
| | | .eq(DownGlassInfo::getLayer, downGlassInfoDTO.getLayer()).eq(DownGlassInfo::getSequence, sequence)); |
| | | if (null != downGlassInfoDTO && downGlassInfo.getWidth() == item.getWidth() && downGlassInfo.getHeight() == item.getHeight()) { |
| | | log.info("相同次序玻璃对应上,可执行进片任务"); |
| | | //更新玻璃状态,生成出片任务 |
| | | tempGlassId = item.getGlassId(); |
| | | isBind = Boolean.FALSE; |
| | | log.info("相同次序玻璃对应上,可执行进片任务,玻璃id:{}", tempGlassId); |
| | | break loop; |
| | | } |
| | | } |
| | |
| | | |
| | | Map<String, List<DownStorageCageDetails>> singleLayerMap = list.stream().filter(item -> item.getTotalLayer() == 1) |
| | | .collect(Collectors.groupingBy(item -> item.getFlowCardId() + item.getLayer(), Collectors.toList())); |
| | | if (tempGlassId == null) { |
| | | if (StringUtils.isBlank(tempGlassId)) { |
| | | if (CollectionUtils.isNotEmpty(singleLayerMap)) { |
| | | //获取已落架流程卡信息,按落架数量排序 |
| | | for (DownGlassInfoDTO e : downGlassInfoDTOList) { |
| | | List<DownStorageCageDetails> downStorageCageDetails = singleLayerMap.get(e.getFlowCardId() + e.getLayer()); |
| | | if (CollectionUtils.isNotEmpty(downStorageCageDetails)) { |
| | | tempGlassId = downStorageCageDetails.get(0).getGlassId(); |
| | | isBind = Boolean.FALSE; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (tempGlassId == null) { |
| | | if (StringUtils.isBlank(tempGlassId)) { |
| | | log.info("没有找到可以下片的的玻璃,结束任务"); |
| | | return Boolean.FALSE; |
| | | } else { |
| | | //按照出片的玻璃id更新笼内的玻璃状态为已出片 |
| | | return generateDownGlassOutTask(tempGlassId, Const.GLASS_CACHE_TYPE_OUT, isBind, cageDetails); |
| | | return generateDownGlassOutTask(tempGlassId, Const.GLASS_CACHE_TYPE_OUT, isNeedBind, cageDetails, workList); |
| | | } |
| | | } |
| | | |
| | | public Boolean generateDownGlassOutTask(String glassId, Integer taskType, Boolean |
| | | isBind, DownStorageCageDetails cageDetails) { |
| | | isNeedBind, DownStorageCageDetails cageDetails, List<Integer> workList) { |
| | | //按玻璃id获取玻璃信息 |
| | | DownStorageCageDetails downStorageCageDetails = null; |
| | | if (glassId.equals(cageDetails.getGlassId())) { |
| | | downStorageCageDetails = cageDetails; |
| | | taskType = 3; |
| | | //将下片玻璃存入笼子详情信息表中 |
| | | //将任务插入理片笼详情表 |
| | | downStorageCageDetails.setState(Const.GLASS_STATE_OUT); |
| | | downStorageCageDetailsService.save(downStorageCageDetails); |
| | | } else { |
| | | downStorageCageDetails = downStorageCageDetailsService.getOne(new LambdaQueryWrapper<DownStorageCageDetails>() |
| | | .eq(DownStorageCageDetails::getGlassId, glassId).eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | if (downStorageCageDetailsService.update(new LambdaUpdateWrapper<DownStorageCageDetails>() |
| | | .set(DownStorageCageDetails::getState, Const.GLASS_STATE_OUT).eq(DownStorageCageDetails::getGlassId, glassId))) { |
| | | log.info("更新详情表内的状态成功"); |
| | | // return Boolean.TRUE; |
| | | } else { |
| | | log.info("更新详情表内的状态失败"); |
| | | return Boolean.FALSE; |
| | | } |
| | | } |
| | | |
| | | Integer endCell = null; |
| | | if (!isBind) { |
| | | if (isNeedBind) { |
| | | //获取空架子信息,将空架子信息绑定流程卡 |
| | | DownWorkstation emptyDownWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() |
| | | .isNull(DownWorkstation::getFlowCardId).orderByDesc(DownWorkstation::getWorkstationId).last("limit 1")); |
| | | .and(on -> on.isNull(DownWorkstation::getFlowCardId).or().eq(DownWorkstation::getFlowCardId, "")).in(DownWorkstation::getWorkstationId, workList).orderByDesc(DownWorkstation::getWorkstationId).last("limit 1")); |
| | | if (null != emptyDownWorkstation) { |
| | | log.info("获取到空架子信息,绑定流程卡"); |
| | | downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), downStorageCageDetails.getLayer(), emptyDownWorkstation.getWorkstationId()); |
| | | downWorkstationService.updateFlowCardIdAndCount(downStorageCageDetails.getFlowCardId(), emptyDownWorkstation.getWorkstationId(), downStorageCageDetails.getLayer()); |
| | | endCell = emptyDownWorkstation.getWorkstationId(); |
| | | } else { |
| | | log.info("没有空架子信息,无法绑定流程卡"); |
| | |
| | | .eq(DownWorkstation::getFlowCardId, downStorageCageDetails.getFlowCardId()).eq(DownWorkstation::getLayer, downStorageCageDetails.getLayer())); |
| | | endCell = workstation.getWorkstationId(); |
| | | } |
| | | //更新详情表内的状态 |
| | | if (downStorageCageDetailsService.update(new LambdaUpdateWrapper<DownStorageCageDetails>() |
| | | .set(DownStorageCageDetails::getState, Const.GLASS_STATE_OUT).eq(DownStorageCageDetails::getGlassId, glassId))) { |
| | | log.info("更新详情表内的状态成功"); |
| | | } else { |
| | | log.info("更新详情表内的状态失败"); |
| | | return Boolean.FALSE; |
| | | } |
| | | //更新落架玻璃数量 |
| | | if (endCell == 7) { |
| | | if (endCell == Const.G13_WORK_STATION) { |
| | | downWorkstationService.update(new UpdateWrapper<DownWorkstation>().eq("flow_card_id", downStorageCageDetails.getFlowCardId()) |
| | | .eq("layer", downStorageCageDetails.getLayer()).setSql("other_number = other_number +1")); |
| | | } else { |
| | |
| | | //生成任务信息 |
| | | DownGlassInfo downGlassInfo = new DownGlassInfo(); |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //todo:落架片序 |
| | | //落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfo.setWorkStationId(endCell); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |