From 609818970fb1e7ae59b2535752a5ea063aa229b0 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期六, 06 七月 2024 15:05:52 +0800 Subject: [PATCH] 1:大理片 新增计算最大宽度:避免高度大于宽度 计算出错 2、磨边前卧式理片新增最小尺寸校验 3、下片修复下片逻辑异常,新增配置 人工下片的最大尺寸 最小尺寸 直通任务的最大尺寸 --- hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java | 92 ++++++++++++++++++++++++++++----------------- 1 files changed, 57 insertions(+), 35 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 a63c890..5aef293 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銆佸彂閫佺‘璁ゅ瓧瀹屾垚"); @@ -182,8 +188,8 @@ * @return */ public GlassInfo queryAndChangeGlass(String glassId) { - GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId) - .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); + 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, "鐜荤拑淇℃伅涓嶅瓨鍦�"); //鎸夌収鐜荤拑灏哄 LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>() @@ -272,17 +278,25 @@ 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); if (CollectionUtil.isEmpty(list)) { MPJQueryWrapper<GlassInfo> queryWrapper = new MPJQueryWrapper<GlassInfo>() - .selectAll(GlassInfo.class).eq("t.glass_id", glassId) - .inSql("t.engineer_id", "select engineer_id from engineering where state = 1"); + .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) { @@ -347,8 +361,8 @@ //todo: 鑾峰彇姝e湪鎵ц鐨勫伐绋嬩俊鎭� if (StringUtils.isNotBlank(glassId)) { GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() - .eq(GlassInfo::getGlassId, glassId) - .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); + .eq(GlassInfo::getGlassId, glassId)); +// .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); BeanUtils.copyProperties(one, resultDetails); glassList.add(resultDetails); @@ -387,7 +401,7 @@ * @param width * @param height */ - private EdgStorageCageDetails queryMinGlass(Double width, Double height, String glassId) { + private EdgStorageCageDetails queryMinGlass(double width, double height, String glassId) { //鑾峰彇琛ㄥ唴鐗堝浘id鏈�灏忕殑鐜荤拑淇℃伅 EdgStorageCageDetails glassDetails = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() .eq(EdgStorageCageDetails::getState, 100) @@ -400,8 +414,8 @@ return glassDetails; } GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() - .eq(GlassInfo::getGlassId, glassId) - .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1") + .eq(GlassInfo::getGlassId, glassId) +// .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1") ); EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); BeanUtils.copyProperties(one, resultDetails); @@ -451,7 +465,8 @@ return null; } return edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId()) - .inSql(EdgStorageCageDetails::getEngineerId, "select engineer_id from engineering where state = 1").last(" limit 1 ")); +// .inSql(EdgStorageCageDetails::getEngineerId, "select engineer_id from engineering where state = 1") + .last(" limit 1 ")); } /** @@ -466,10 +481,10 @@ */ private Integer queryLineByGlassInfo(EdgStorageCageDetails a08EdgStorageCageDetails, EdgStorageCageDetails a10EdgStorageCageDetails, EdgStorageCageDetails glassInfo, int out08Glassstate, int out10Glassstate) { - boolean b08 = a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) - && a08EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()); - boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) - && a10EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()); + boolean b08 = a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight() == glassInfo.getHeight() + && a08EdgStorageCageDetails.getWidth() == glassInfo.getWidth(); + boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight() == glassInfo.getHeight() + && a10EdgStorageCageDetails.getWidth() == glassInfo.getWidth(); //瀛樺湪鍑虹墖浠诲姟 07涓虹┖ if (b10) { return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; @@ -493,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); @@ -507,16 +526,16 @@ //鑾峰彇瀹介珮鎷嶇涓�鐨勭幓鐠冧俊鎭� EdgStorageCageDetails firstSize = list.get(0); Integer firstCount = firstSize.getCount(); - Double firstWidth = firstSize.getWidth(); - Double firstHeight = firstSize.getHeight(); + double firstWidth = firstSize.getWidth(); + double firstHeight = firstSize.getHeight(); if (list.size() == 1) { return queryMinGlass(firstWidth, firstHeight, glassId); } //鑾峰彇瀹介珮鎷嶇浜岀殑鐜荤拑淇℃伅 EdgStorageCageDetails secondSize = list.get(1); Integer secondCount = secondSize.getCount(); - Double secondWidth = secondSize.getWidth(); - Double secondHeight = secondSize.getHeight(); + double secondWidth = secondSize.getWidth(); + double secondHeight = secondSize.getHeight(); //鑾峰彇鏁伴噺鍓�2鐨勭幓鐠冩暟閲忔瘮渚� Integer mix = firstCount / secondCount; log.info("鑾峰彇鐜荤拑鏁伴噺鍓�2鐨勭幓鐠冨崰姣斾负锛歿}", mix); @@ -536,7 +555,7 @@ EdgStorageCageDetails outGlassInfo = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() .eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId())); log.info("{}绾挎湁鍑虹墖浠诲姟淇℃伅,浠诲姟淇℃伅涓簕}锛岀幓鐠冧俊鎭负{}", endcell, taskCache, outGlassInfo); - if (outGlassInfo.getWidth().equals(firstWidth) && outGlassInfo.getHeight().equals(firstHeight)) { + if (outGlassInfo.getWidth() == firstWidth && outGlassInfo.getHeight() == firstHeight) { log.info("鏁伴噺鏈�澶氱殑瀹絳}楂榹}鍜寋}绾夸换鍔$殑瀹絳}楂榹}鐩稿悓锛屽嚭鏁伴噺鎺掔浜岀殑鐜荤拑锛屽{}楂榹}", firstWidth, firstHeight, endcell, outGlassInfo.getWidth(), outGlassInfo.getHeight(), secondWidth, secondHeight); return queryMinGlass(secondWidth, secondHeight, glassId); @@ -586,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; } @@ -619,15 +638,18 @@ * 娣诲姞鐞嗙墖绗间换鍔� * * @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); } @@ -638,7 +660,7 @@ * @return */ @Scheduled(fixedDelay = 1000) - public void currentCutTerritory(){ + public void currentCutTerritory() { JSONObject jsonObject = new JSONObject(); List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); jsonObject.append("currentCutTerritory", currentCutTerritorys); @@ -666,10 +688,10 @@ * @return */ @Scheduled(fixedDelay = 1000) - public void selectEdgTask(){ + public void selectEdgTask() { JSONObject jsonObject = new JSONObject(); - List<Map<String,Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001"); - List<Map<String,Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002"); + List<Map<String, Object>> EdgTasks1 = taskCacheService.selectEdgInfo("2001"); + List<Map<String, Object>> EdgTasks2 = taskCacheService.selectEdgInfo("2002"); jsonObject.append("EdgTasks1", EdgTasks1); jsonObject.append("EdgTasks2", EdgTasks2); ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlass"); @@ -696,9 +718,9 @@ * @return */ @Scheduled(fixedDelay = 1000) - public void selectEdgStorageCage(){ + public void selectEdgStorageCage() { JSONObject jsonObject = new JSONObject(); - List<Map<String, Object>> EdgStorageCageinfos=edgStorageCageService.selectEdgStorageCages(); + List<Map<String, Object>> EdgStorageCageinfos = edgStorageCageService.selectEdgStorageCages(); jsonObject.append("EdgStorageCageinfos", EdgStorageCageinfos); ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("cacheGlass"); if (sendwServer != null) { -- Gitblit v1.8.0