| | |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | | public void inBigStorageTask() { |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | log.info("进片任务开始{}", s7DataDLPOne); |
| | | Boolean inkageEntity = s7DataDLPOne.getMesControl(); |
| | |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | | } |
| | | //是否允许钢化 |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | |
| | | Integer temperingOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_TEMPERING_OUT_TARGET_POSITION); |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingLayoutId).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfoByVirtualSlot(unFinishTemperingGlassInfoList, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | BigStorageCageDetails details = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1")); |
| | | if (details != null) { |
| | | TemperingGlassInfo temperingGlassInfo = new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(details, temperingGlassInfo); |
| | | temperingGlassInfo.setState(-1); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | computeOutGlassInfoByVirtualSlot(Arrays.asList(temperingGlassInfo), "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | return; |
| | | } |
| | | |
| | | if (redisUtil.getCacheObject("temperingSwitch")) { |
| | | //钢化优先:获取理片笼 玻璃小片 破损表 数量 判断笼内版图是否到齐 |
| | | List<TemperingLayoutDTO> temperingLayoutDTOList = bigStorageCageDetailsService.temperingIsAll(); |
| | | if (CollectionUtil.isNotEmpty(temperingLayoutDTOList)) { |
| | | //玻璃到齐包括已出片的 |
| | | //到齐,将玻璃小片数据存入钢化小片表,逻辑生成出片任务 结束 |
| | | for (TemperingLayoutDTO item : temperingLayoutDTOList) { |
| | | // if (item.getEngineerId().equals(redisUtil.getCacheObject("temperingengineerId"))) { |
| | | //是否允许钢化 |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingLayoutId).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfoByVirtualSlot(unFinishTemperingGlassInfoList, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | |
| | | BigStorageCageDetails details = bigStorageCageDetailsService.getOne(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL).last("limit 1")); |
| | | if (details != null) { |
| | | TemperingGlassInfo temperingGlassInfo = new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(details, temperingGlassInfo); |
| | | temperingGlassInfo.setState(-1); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | computeOutGlassInfoByVirtualSlot(Arrays.asList(temperingGlassInfo), "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | | return; |
| | | } |
| | | String temperingEngineerId = redisUtil.getCacheObject("temperingEngineerId"); |
| | | if (StringUtils.isNotBlank(temperingEngineerId)) { |
| | | TemperingGlassInfo temperingGlassInfo = temperingGlassInfoService.getOne(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getEngineerId, temperingEngineerId) |
| | | .orderByDesc(TemperingGlassInfo::getTemperingLayoutId).last("limit 1")); |
| | | int temperingLayoutId = 1; |
| | | if (temperingGlassInfo != null) { |
| | | temperingLayoutId = temperingGlassInfo.getTemperingLayoutId() + 1; |
| | | } |
| | | List<GlassInfo> glassInfos = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getEngineerId, temperingEngineerId).eq(GlassInfo::getTemperingLayoutId, temperingLayoutId)); |
| | | if (CollectionUtil.isEmpty(glassInfos)) { |
| | | //指定钢化工程执行完成,移除工程号 |
| | | redisUtil.deleteObject("temperingEngineerId"); |
| | | return; |
| | | } |
| | | List<TemperingLayoutDTO> temperingLayoutDTOS = bigStorageCageDetailsService.temperingIsAllByTemperingLayoutId(temperingEngineerId, temperingLayoutId); |
| | | if (CollectionUtil.isNotEmpty(temperingLayoutDTOS)) { |
| | | List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class) |
| | | .select("-1 as state,t.filmsid as films_id,t.glass_id,t.flow_card_id,t.glass_type,t.width,t.height" + |
| | | ",t.thickness,t.ishorizontal,t.tempering_layout_id,t.tempering_feed_sequence,t.x_coordinate,t.y_coordinate," + |
| | | "t.angle,t1.slot,t.engineer_id") |
| | | .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId) |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId()) |
| | | .eq(GlassInfo::getEngineerId, item.getEngineerId()) |
| | | .eq(GlassInfo::getTemperingLayoutId, temperingLayoutId) |
| | | .eq(GlassInfo::getEngineerId, temperingEngineerId) |
| | | .orderByAsc(GlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //是否有人工下片任务 有直接出 |
| | | Integer artificialOutTargetPosition = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_ARTIFICIAL_OUT_TARGET_POSITION); |
| | | Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.VERTICAL_OUT_CAR_SIZE); |
| | |
| | | } |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | | if (redisUtil.getCacheObject("dispatchSwitch")) { |
| | | //获取进片协议内容,在进片有请求/进片任务执行中不执行调度任务 |
| | | S7DataDLPOne s7DataDLPOne = s7SerializerDLPOne.read(S7DataDLPOne.class); |
| | | String requestInEntity = s7DataDLPOne.getRequestMes().toString(); |
| | | if ("1".equals(requestInEntity)) { |
| | | log.info("当前收到进片请求,结束调度任务"); |
| | | return; |
| | | } |
| | | String mesReplyInEntity = s7DataDLPOne.getMesReply().toString(); |
| | | if ("1".equals(mesReplyInEntity)) { |
| | | log.info("有正在执行的进片任务,结束调度任务"); |
| | | return; |
| | | } |
| | | //todo:获取笼内单格已经到齐的玻璃格子信息 |
| | | List<BigStorageRelationDTO> virtualList = bigStorageCageDetailsService.queryIsAllNeedDispatchVirtualSlot(); |
| | | if (CollectionUtil.isEmpty(virtualList)) { |