From f481c5fe4fc2aa80c77a760f4161e4ab3912cb45 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期六, 06 七月 2024 15:07:01 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 111 ++++++++++++++++++++----------------------------------- 1 files changed, 41 insertions(+), 70 deletions(-) diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java index 62186a5..77dfa52 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java +++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java @@ -66,11 +66,17 @@ @Value("${mes.sequence.order}") private boolean sequenceOrder; - @Value("${mes.firstLength}") + @Value("${mes.max.firstLength}") private String firstLength; - @Value("${mes.secondLength}") + @Value("${mes.max.secondLength}") private String secondLength; + + @Value("${mes.min.firstLength}") + private String minFirstLength; + + @Value("${mes.min.secondLength}") + private String minSecondLength; @Scheduled(fixedDelay = 1000) public void plcHomeEdgTask() { @@ -93,7 +99,7 @@ return; } log.info("2銆佽幏鍙栧埌鐨勮姹傚瓧涓�0锛屽皢纭瀛楁敼涓�0"); - S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 0); + S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 0); return; } if (!"0".equals(confirmationWrodValue)) { @@ -169,7 +175,7 @@ boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); log.info("5銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃鏄惁瀹屾垚锛歿}", taskCache); - S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1); + S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1); log.info("6銆佸彂閫佺‘璁ゅ瓧瀹屾垚"); @@ -272,6 +278,10 @@ 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 <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); + } 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 >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") "); } wrapper.last("order by count(t.glass_id) desc limit 2"); List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); @@ -280,9 +290,13 @@ .selectAll(GlassInfo.class).eq("t.glass_id", glassId); // .inSql("t.engineer_id", "select engineer_id from engineering where state = 1"); if (endcell == Const.A10_OUT_TARGET_POSITION) { - queryWrapper.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 glass_info) t1 " + + 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 <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); + } 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 >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") "); } GlassInfo one = glassInfoService.getOne(queryWrapper); if (one != null) { @@ -494,10 +508,14 @@ wrapper.select("count(t.glass_id) as count, t.width, t.height") .eq("t.state", Const.GLASS_STATE_IN) .groupBy("t.width, t.height"); - if (endcell == Const.A09_OUT_TARGET_POSITION) { + 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 <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); + } 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 >=" + minFirstLength + " and t1.second_length>=" + minSecondLength + ") "); } wrapper.last("order by count(t.glass_id) desc limit 2"); List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); @@ -587,9 +605,9 @@ boolean taskCacheStatus = saveTaskCache(glassInfo.getGlassId(), glassInfo.getSlot(), endcell, Const.GLASS_CACHE_TYPE_OUT); log.info("6銆佹坊鍔犲嚭鐗囦换鍔℃槸鍚﹀畬鎴愶細{}", taskCacheStatus); } - boolean glassSizeStatus = saveGlassSize(glassInfo); + boolean glassSizeStatus = saveGlassSize(glassInfo, endcell); log.info("7銆佹坊鍔犲嚭鐗囩幓鐠冨昂瀵镐俊鎭埌纾ㄨ竟鍓嶇幓鐠冭〃鏄惁瀹屾垚锛歿}", glassSizeStatus); - S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1); + S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, 1); log.info("8銆佸彂閫佺‘璁ゅ瓧宸插畬鎴�"); return Boolean.TRUE; } @@ -620,59 +638,39 @@ * 娣诲姞鐞嗙墖绗间换鍔� * * @param glassInfo + * @param endcell * @return */ - private boolean saveGlassSize(EdgStorageCageDetails glassInfo) { + private boolean saveGlassSize(EdgStorageCageDetails glassInfo, int endcell) { EdgGlassTaskInfo edgGlassTaskInfo = new EdgGlassTaskInfo(); BeanUtils.copyProperties(glassInfo, edgGlassTaskInfo); edgGlassTaskInfo.setHeight((int) (glassInfo.getHeight() * ratio)); edgGlassTaskInfo.setWidth((int) (glassInfo.getWidth() * ratio)); edgGlassTaskInfo.setThickness((int) (glassInfo.getThickness() * ratio)); edgGlassTaskInfo.setStatus(Const.EDG_GLASS_BEFORE); + edgGlassTaskInfo.setLine(endcell); + edgGlassTaskInfo.setTime(new Date()); return edgGlassTaskInfoService.save(edgGlassTaskInfo); } - /** - * 褰撳墠鍒囧壊鐗堝浘淇℃伅 - * - * @param - * @return - */ + + @Scheduled(fixedDelay = 1000) - public void currentCutTerritory() { + public void CacheGlassTasks() { JSONObject jsonObject = new JSONObject(); + //璇嗗埆鎽嗙墖 List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); jsonObject.append("currentCutTerritory", currentCutTerritorys); - ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlass"); - if (sendwServer != null) { - for (WebSocketServer webserver : sendwServer) { - if (webserver != null) { - webserver.sendMessage(jsonObject.toString()); - List<String> messages = webserver.getMessages(); - if (!messages.isEmpty()) { - // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛� - webserver.clearMessages(); - } - } else { - log.info("Home is closed"); - } - } - } - } - - /** - * 纾ㄨ竟浠诲姟 - * - * @param - * @return - */ - @Scheduled(fixedDelay = 1000) - public void selectEdgTask() { - JSONObject jsonObject = new JSONObject(); + //纾ㄨ竟淇℃伅 List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001"); List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002"); jsonObject.append("EdgTasks1", EdgTasks1); jsonObject.append("EdgTasks2", EdgTasks2); + + //鍗у缂撳瓨绗煎唴淇℃伅 + List<Map<String, Object>> EdgStorageCageinfos = edgStorageCageService.selectEdgStorageCages(); + jsonObject.append("EdgStorageCageinfos", EdgStorageCageinfos); + ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlass"); if (sendwServer != null) { for (WebSocketServer webserver : sendwServer) { @@ -690,33 +688,6 @@ } } - /** - * 纾ㄨ竟鍓� 缂撳瓨鍐呬俊鎭� - * - * @param - * @return - */ - @Scheduled(fixedDelay = 1000) - public void selectEdgStorageCage() { - JSONObject jsonObject = new JSONObject(); - List<Map<String, Object>> EdgStorageCageinfos = edgStorageCageService.selectEdgStorageCages(); - jsonObject.append("EdgStorageCageinfos", EdgStorageCageinfos); - ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlass"); - if (sendwServer != null) { - for (WebSocketServer webserver : sendwServer) { - if (webserver != null) { - webserver.sendMessage(jsonObject.toString()); - List<String> messages = webserver.getMessages(); - if (!messages.isEmpty()) { - // // 灏嗘渶鍚庝竴涓秷鎭浆鎹负鏁存暟绫诲瀷鐨勫垪琛� - webserver.clearMessages(); - } - } else { - log.info("Home is closed"); - } - } - } - } } -- Gitblit v1.8.0