| | |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | @Value("${mes.min.two.secondLength}") |
| | | private String minTwoSecondLength; |
| | | |
| | | public static String engineerId=""; |
| | | public static String engineerId = ""; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | |
| | | Date endDate = new Date(); |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingIsRun(){ |
| | | public void temperingIsRun() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<TaskCache>taskCaches=taskCacheService.selectTaskCacheIsRun(); |
| | | List<TaskCache> taskCaches = taskCacheService.selectTaskCacheIsRun(); |
| | | jsonObject.append("taskCaches", taskCaches); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun"); |
| | | if (sendwServer != null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 进片任务 |
| | | * |
| | |
| | | |
| | | //查询玻璃并进行交换 |
| | | GlassInfo glassInfo = queryAndChangeGlass(glassId); |
| | | log.info("3、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | if (glassInfo == null) { |
| | | return; |
| | | } |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | EdgStorageCageDetails details = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(Const.GLASS_STATE_IN); |
| | | details.setSlot(nearestEmpty.getSlot()); |
| | | details.setDeviceId(nearestEmpty.getDeviceId()); |
| | | edgStorageCageDetailsService.save(details); |
| | | log.info("4、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | //添加进片任务 |
| | | boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | log.info("5、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | log.info("6、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | |
| | | S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1); |
| | | log.info("6、发送确认字完成"); |
| | | log.info("7、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | // .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); |
| | | Assert.isFalse(null == glassInfo, "玻璃信息不存在"); |
| | | if ((glassInfo.getWidth() < Double.parseDouble(minTwoFirstLength) && glassInfo.getHeight() < Double.parseDouble(minTwoSecondLength)) || (glassInfo.getWidth() < Double.parseDouble(minTwoSecondLength) && glassInfo.getHeight() < Double.parseDouble(minTwoFirstLength))) { |
| | | log.info("3、玻璃信息不符合进入理片笼最小尺寸,玻璃信息为{}", glassInfo); |
| | | return null; |
| | | } |
| | | //按照玻璃尺寸 |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getWidth, glassInfo.getWidth()) |
| | |
| | | BeanUtils.copyProperties(one, resultDetails); |
| | | glassInfo = resultDetails; |
| | | } else { |
| | | log.info("获取笼内玻璃和带进片玻璃为空或者不符合磨边尺寸"); |
| | | log.info("获取笼内玻璃和待进片玻璃为空或者不符合磨边尺寸"); |
| | | } |
| | | } else { |
| | | glassInfo = queryMinGlass(list.get(0).getWidth(), list.get(0).getHeight(), glassId); |
| | |
| | | if (endcell == Const.A10_OUT_TARGET_POSITION) { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >= " + minOneFirstLength + " and t1.second_length >= " + minOneSecondLength); |
| | | } else { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >=" + minOneFirstLength + " and t1.second_length>=" + minOneSecondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void CacheGlassTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<Map<String, Object>> currentCutTerritorys= edgStorageCageDetailsService.selectCutTerritory(); |
| | | List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); |
| | | // List<Map<String, Object>> currentCutTerritorys=new ArrayList<>(); |
| | | // if(engineerId==null||engineerId.isEmpty()){ |
| | | // //识别摆片 当前版图数据 |
| | |
| | | jsonObject.append("currentCutTerritory", currentCutTerritorys); |
| | | //log.info("本次识别版图{},++++{}",engineerId,currentCutTerritorys); |
| | | //磨边信息 |
| | | List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001"); |
| | | List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002"); |
| | | List<Map<String, Object>> EdgTasks1 = edgGlassTaskInfoService.selectEdgInfo("2001"); |
| | | List<Map<String, Object>> EdgTasks2 = edgGlassTaskInfoService.selectEdgInfo("2002"); |
| | | jsonObject.append("EdgTasks1", EdgTasks1); |
| | | jsonObject.append("EdgTasks2", EdgTasks2); |
| | | |