From 4f966da6047cdcd9c53e254c1f1c7bdd70af0b34 Mon Sep 17 00:00:00 2001 From: zhoushihao <zsh19950802@163.com> Date: 星期一, 21 四月 2025 10:08:18 +0800 Subject: [PATCH] 1、卧式理片笼配置参数由配置yml文件改为数据库配置表获取 2、磨边后参数改造,解决plc查询数据异常问题 3、大理片笼配置参数由配置yml文件改为数据库配置表获取 4、钢化配置参数由配置yml文件改为数据库配置表获取 5、配置参数常量类配置修改,提供获取配置参数的方法 --- hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java | 78 +++++++++++++++++--------------------- 1 files changed, 35 insertions(+), 43 deletions(-) diff --git a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java index ee90fdb..0f83952 100644 --- a/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java +++ b/hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java @@ -8,6 +8,7 @@ import com.kangaroohy.milo.model.ReadWriteEntity; import com.kangaroohy.milo.service.MiloService; import com.mes.common.config.Const; +import com.mes.common.config.ConstSysConfig; import com.mes.damage.service.DamageService; import com.mes.edgglasstask.entity.EdgGlassTaskInfo; import com.mes.edgglasstask.service.EdgGlassTaskInfoService; @@ -21,11 +22,11 @@ import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; import com.mes.opctask.service.EdgStorageDeviceTaskHistoryService; import com.mes.opctask.service.EdgStorageDeviceTaskService; +import com.mes.sysconfig.service.SysConfigService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -64,35 +65,35 @@ EdgStorageDeviceTaskHistoryService edgStorageDeviceTaskHistoryService; @Resource DamageService damageService; + @Resource + SysConfigService sysConfigService; - @Value("${mes.glassGap}") - private int glassGap; - @Value("${mes.threshold}") + // @Value("${mes.threshold}") private int threshold; - @Value("${mes.cellLength}") + // @Value("${mes.cellLength}") private int cellLength; - @Value("${mes.ratio}") + // @Value("${mes.ratio}") private int ratio; - @Value("${mes.min.one.firstLength}") + // @Value("${mes.min.one.firstLength}") private int minOneFirstLength; - - @Value("${mes.min.one.secondLength}") + // +// @Value("${mes.min.one.secondLength}") private int minOneSecondLength; - - @Value("${mes.min.two.firstLength}") + // +// @Value("${mes.min.two.firstLength}") private int minTwoFirstLength; - - @Value("${mes.min.two.secondLength}") + // +// @Value("${mes.min.two.secondLength}") private int minTwoSecondLength; - - @Value("${mes.max.firstLength}") + // +// @Value("${mes.max.firstLength}") private int maxTwoFirstLength; - - @Value("${mes.max.secondLength}") + // +// @Value("${mes.max.secondLength}") private int maxTwoSecondLength; - - @Value("${mes.maxThickness}") + // +// @Value("${mes.maxThickness}") private int maxThickness; private String glassInIdOne = ""; @@ -124,6 +125,17 @@ } private void startOneOpcTaskChild(String tableName, int device, int cellFlag) throws Exception { + threshold = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_THRESHOLD); + cellLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_CELL_LENGTH); + ratio = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_RATIO); + minOneFirstLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MIN_ONE_FIRST_LENGTH); + minOneSecondLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MIN_ONE_SECOND_LENGTH); + minTwoFirstLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MIN_TWO_FIRST_LENGTH); + minTwoSecondLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MIN_TWO_SECOND_LENGTH); + maxTwoFirstLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MAX_FIRST_LENGTH); + maxTwoSecondLength = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MAX_SECOND_LENGTH); + maxThickness = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_MAX_THICKNESS); + EdgStorageDeviceTask task = edgStorageDeviceTaskService.queryTaskMessage(tableName); if (task == null) { log.info("浠诲姟琛ㄥ熀纭�鏁版嵁褰曞叆澶辫触锛岃妫�鏌ユ暟鎹槸鍚﹀綍鍏ユ垚鍔�"); @@ -200,6 +212,7 @@ } private void edgTaskChild(String glassId, int cell) throws Exception { + ratio = sysConfigService.queryConfigValue(ConstSysConfig.CACHE_RATIO); GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId).last("limit 1")); if (glassInfo == null) { log.info("瀵瑰垪琛ㄤ腑鐨勭幓鐠僫d閿欒锛岃妫�鏌ユ暟鎹紝鐜荤拑id锛歿}", glassId); @@ -210,11 +223,11 @@ // list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".mesControl", true)); list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".glassId", Integer.parseInt(toEndingId))); list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".toEdingId", Integer.parseInt(toEndingId))); - list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".width", (int) Math.max(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10))); - list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".height", (int) Math.min(glassInfo.getWidth() * 10, glassInfo.getHeight() * 10))); + list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".width", (int) Math.max(glassInfo.getWidth() * ratio, glassInfo.getHeight() * ratio))); + list.add(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".height", (int) Math.min(glassInfo.getWidth() * ratio, glassInfo.getHeight() * ratio))); miloService.writeToOpcUa(list); - miloService.writeToOpcWord(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".thickness", (int) glassInfo.getThickness() * 10)); + miloService.writeToOpcWord(generateReadWriteEntity("MB" + cell + ".MB" + cell + ".thickness", (int) glassInfo.getThickness() * ratio)); //淇敼纾ㄨ竟瀵瑰垪涓殑纾ㄨ竟绾胯矾鍙婄姸鎬� edgGlassTaskInfoService.update(new LambdaUpdateWrapper<EdgGlassTaskInfo>() .set(EdgGlassTaskInfo::getLine, cell) @@ -715,27 +728,6 @@ taskHistory.setTaskState(Const.RAW_GLASS_TASK_NEW); taskHistory.setDeviceId(deviceId); edgStorageDeviceTaskHistoryService.save(taskHistory); - return Boolean.TRUE; - } - - public boolean updateCellRemainWidth(int slot, int device, EdgStorageDeviceTaskHistory taskHistory) { - List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getSlot, slot) - .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); - int remainWidth = cellLength; - if (CollectionUtil.isNotEmpty(list)) { - if (2 == taskHistory.getTaskType()) { - remainWidth = 0; - } else { - for (EdgStorageCageDetails item : list) { - remainWidth = remainWidth - glassGap - (int) Math.max(item.getWidth(), item.getHeight()); - } - if (remainWidth <= 0) { - remainWidth = 0; - } - } - } - edgStorageCageService.update(new LambdaUpdateWrapper<EdgStorageCage>(). - set(EdgStorageCage::getRemainWidth, remainWidth).eq(EdgStorageCage::getSlot, slot).eq(EdgStorageCage::getDeviceId, device)); return Boolean.TRUE; } -- Gitblit v1.8.0