| | |
| | | |
| | | private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task"; |
| | | private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task"; |
| | | /** |
| | | * 直通格子 |
| | | */ |
| | | private static final Integer THROUGH_SLOT = 920; |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | | @Resource |
| | |
| | | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Value("${mes.slotMaxHeight}") |
| | | private Integer slotMaxHeight; |
| | | @Value("${mes.slotMaxthickness}") |
| | | private Integer slotMaxthickness; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | //按照玻璃厚度分组,判断剩余格子是否可以存放 |
| | | Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting())); |
| | | 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("笼内格子剩余数量不足,结束本次进片"); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | } |
| | | //todo:超大尺寸 |
| | | 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("直通片台存在玻璃,结束本次进片"); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | } |
| | | |
| | | log.info("将钢化小片表内的状态改为钢化结束,玻璃id有:{}", glassIdList); |
| | | //修改钢化任务表中的状态 |
| | | temperingGlassInfoService.update(new LambdaUpdateWrapper<TemperingGlassInfo>() |
| | | .set(TemperingGlassInfo::getState, Const.TEMPERING_END).in(TemperingGlassInfo::getGlassId, glassIdList)); |
| | | |
| | | //报工 |
| | | log.info("将接收到的玻璃进行钢化自动报工,玻璃id有:{}", glassIdList); |
| | | for (String glass : glassIdList) { |
| | | damageService.autoSubmitReport(glass, inTaskList.get(0).getStartSlot(), "钢化", "进中空理片笼", 1); |
| | | } |
| | | Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId)); |
| | | |
| | | //计算目标格子 |
| | |
| | | } |
| | | |
| | | //获取空闲且领取任务的数据信息,没有任务直接走玻璃调度 |
| | | ReadWriteEntity oneEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outOneRequest"); |
| | | ReadWriteEntity twoEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outTwoRequest"); |
| | | ReadWriteEntity threeEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outThreeRequest"); |
| | | int cell = -1; |
| | | ReadWriteEntity oneEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree"); |
| | | HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null; |
| | | if ("1".equals(oneEntity.getValue() + "")) { |
| | | int cell = -1; |
| | | //李赛克线需要获取韩江plc的线路空闲状态:10000000第8位为 1表示忙碌 0表示空闲 |
| | | if (null != oneEntity.getValue() && "1".equals(oneEntity.getValue() + "")) { |
| | | cell = 930; |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | } |
| | | if (1 == 1 || null == hollowGlassOutRelationInfo && "1".equals(twoEntity.getValue() + "")) { |
| | | |
| | | ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree"); |
| | | if (null == hollowGlassOutRelationInfo && null != twoEntity.getValue() && Boolean.parseBoolean(twoEntity.getValue() + "")) { |
| | | cell = 931; |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | } |
| | | if (null == hollowGlassOutRelationInfo && "1".equals(threeEntity.getValue() + "")) { |
| | | cell = 932; |
| | | hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService |
| | | .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | } |
| | | |
| | | if (null != hollowGlassOutRelationInfo) { |
| | | //是否允许中空 |
| | | //是否有正在中空的玻璃:中空小片表筛选未出笼的玻璃信息 |
| | |
| | | .eq(HollowGlassOutRelationInfo::getCell, hollowGlassOutRelationInfo.getCell()) |
| | | .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS)); |
| | | } |
| | | // if (redisUtil.getCacheObject("hollowSwitch")) { |
| | | // List<HollowGlassOutRelationInfo> HollowGlassOutRelationInfoList = hollowGlassOutRelationInfoService |
| | | // .list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>() |
| | | // .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | // .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW)); |
| | | // for (HollowGlassOutRelationInfo e : HollowGlassOutRelationInfoList) { |
| | | // //中空优先:获取理片笼 玻璃小片 破损表 数量 判断笼内版图是否到齐 |
| | | // List<FlowCardGlassInfoDTO> flowCardGlassInfoDTO = hollowBigStorageCageDetailsService.hollowIsAll(e.getFlowCardId(), e.getTotalLayer(), Boolean.TRUE); |
| | | // if (CollectionUtil.isNotEmpty(flowCardGlassInfoDTO)) { |
| | | // //玻璃到齐包括已出片的 |
| | | // //到齐,将玻璃小片数据存入中空小片表,逻辑生成出片任务 结束 |
| | | // for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) { |
| | | // List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell); |
| | | // int finalCell = cell; |
| | | // List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> { |
| | | // HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | | // BeanUtils.copyProperties(queue, queueInfo); |
| | | // queueInfo.setState(Const.TEMPERING_NEW); |
| | | // queueInfo.setCell(finalCell); |
| | | // return queueInfo; |
| | | // }).collect(Collectors.toList()); |
| | | // |
| | | // List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell); |
| | | // int isPairCount = glassInfo.getTotalLayer() * e.getTotalLayer(); |
| | | // List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>(); |
| | | // loop: |
| | | // for (HollowBigStorageCageDetails queue : hollowBigStorageCageDetailsList) { |
| | | // HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | | // BeanUtils.copyProperties(queue, queueInfo); |
| | | // queueInfo.setState(Const.TEMPERING_NEW); |
| | | // queueInfo.setCell(cell); |
| | | // hollowQueues.add(queueInfo); |
| | | // if (queue.getIsPair() == 1){ |
| | | // isPairCount -=1; |
| | | // if (isPairCount == 0){ |
| | | // break loop; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // if (CollectionUtil.isNotEmpty(hollowQueues)) { |
| | | // hollowGlassQueueInfoService.saveBatch(hollowQueues); |
| | | // Integer isPair = hollowQueues.get(0).getIsPair(); |
| | | // hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer()); |
| | | // //将中空任务状态改为开始 |
| | | // hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | | // .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId()) |
| | | // .eq(HollowGlassOutRelationInfo::getCell, cell) |
| | | // .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)); |
| | | // Date endDate = new Date(); |
| | | // log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | // return; |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | // redisUtil.setCacheObject("dispatchHollowSwitch",true); |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | |
| | | if (isPair == 0 && isForce != 1) { |
| | | taskType = Const.BIG_STORAGE_AFTER_DISPATCH; |
| | | taskState = Const.GLASS_STATE_SCHEDULE_ING; |
| | | resultList.add(list.get(0)); |
| | | //目前调度任务totalLayer为0 出片调度任务有层号,用于区分调度方式 |
| | | // 因为出片存在调度,如果为调度,提前占用格子,更新格子剩余尺寸,避免被进片玻璃占用 |
| | | if (totalLayer != 0) { |
| | | resultList.add(list.get(0)); |
| | | HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1")); |
| | | .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .le(HollowBigStorageCage::getMinThickness, list.get(0).getThickness()) |
| | | .ge(HollowBigStorageCage::getMaxThickness, list.get(0).getThickness()) |
| | | .eq(HollowBigStorageCage::getRemainWidth, slotWidth) |
| | | .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1")); |
| | | targetSlot = storageCage.getSlot(); |
| | | hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>() |
| | | .set(HollowBigStorageCage::getRemainWidth, 0).eq(HollowBigStorageCage::getSlot, targetSlot)); |
| | | } else { |
| | | resultList = tempList; |
| | | } |
| | | totalLayer = 0; |
| | | } else { |
| | |
| | | //是否存在有格子非空的玻璃 |
| | | if (CollectionUtils.isNotEmpty(inSlotGlassList)) { |
| | | //存在 将格子内的玻璃分别进行更新 |
| | | // List<HollowBigStorageCage> hollowBigStorageCageList = hollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>() |
| | | // .lt(HollowBigStorageCage::getRemainWidth, 0).in(HollowBigStorageCage::getSlot, slotList)); |
| | | // List<Integer> resultSlotList = hollowBigStorageCageList.stream().map(HollowBigStorageCage::getSlot).collect(Collectors.toList()); |
| | | slotRemainMap = inSlotGlassList.stream() |
| | | .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getSlot, Collectors.summingDouble(item -> Math.max(item.getWidth(), item.getHeight()) + glassGap))); |
| | | slotRemainMap.forEach((e, v) -> { |
| | |
| | | } |
| | | } |
| | | |
| | | private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) { |
| | | public ReadWriteEntity generateReadWriteEntity(String identifier, Object value) { |
| | | return ReadWriteEntity.builder() |
| | | .identifier(identifier) |
| | | //Kep中是Long类型,即:Int32,Java中的int类型 |
| | | .value(value) |
| | | .build(); |
| | | } |
| | | // |
| | | // private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) { |
| | | //// if (target == 931){} |
| | | // if (taskList.get(0).get) |
| | | // return null; |
| | | // } |
| | | } |