diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java index dd56a1c..df5cb1c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java @@ -47,7 +47,7 @@ public class SyncDeviceStatus { private void device() { - //long startTime = System.currentTimeMillis(); + long startTime = System.currentTimeMillis(); try { JSONArray tbxList1 = new JSONArray(); JSONArray tbxList2 = new JSONArray(); @@ -194,7 +194,8 @@ public class SyncDeviceStatus { // // } //redisUtils.set("agvList", agvList); - //log.trace("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime); + long startTime1 = System.currentTimeMillis(); + log.info("自动上报驱动状态,完毕耗时{}", System.currentTimeMillis() - startTime); } catch (Exception e) { log.error("自动线程开始查询AGV设备,自动上报驱动状态失败{}{}", e, e.getMessage()); } diff --git a/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index 54066ad..9dfa55c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -6,9 +6,10 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy -# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&useOldAliasMetadataBehavior=true + # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} + # password: ${DB_PWD:Root.123456} password: ${DB_PWD:123456789} # 初始连接数 initial-size: 5 @@ -70,7 +71,7 @@ spring: baseline-on-migrate: true redis: #数据库索引 - database: ${REDIS_DB:5} + database: ${REDIS_DB:2} host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} # password: ${REDIS_PWD:} @@ -164,11 +165,11 @@ sa-token: # ---- 除了以上配置项,你还需要为 Sa-Token 配置http请求处理器(文档有步骤说明) is-read-cookie: true is-print: false -# 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口 + # 未登录 StpUtil.getTokenSession() 设置值,获取值 @SaIgnore 得忽略接口 token-session-check-login: false alone-redis: # Redis数据库索引(默认为0) - database: 5 + database: 2 # Redis服务器地址 host: 127.0.0.1 # Redis服务器连接端口 diff --git a/acs/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/acs/nladmin-system/nlsso-server/src/main/resources/config/application.yml index 2d1a89c..ac11b14 100644 --- a/acs/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/acs/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: prod + active: dev jackson: time-zone: GMT+8 data: diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java index 6eb06f8..0db4494 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java @@ -4,8 +4,6 @@ import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.nl.common.utils.RedisUtils; @@ -13,7 +11,6 @@ import org.nl.wms.cockpit.service.CockpitService; import org.nl.wms.cockpit.service.dao.PointInfo; import org.nl.wms.cockpit.service.dao.TaskInfo; import org.nl.wms.cockpit.service.mapper.CockpitMapper; -import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.point.service.impl.SchBasePointServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -250,28 +247,29 @@ public class CockpitServiceImpl implements CockpitService { JSONObject jsonObject = new JSONObject(); //涂板线 CompletableFuture>> task1 = CompletableFuture.supplyAsync(() -> { - // todo 初始化点位所在排信息 - List list = schBasePoint.list(new LambdaQueryWrapper().eq(SchBasePoint::getIs_used, 1)); - List list1 = list.stream().filter(r -> "HCQ1".equals(r.getRegion_code()) || "HCQ2".equals(r.getRegion_code()) || "HCQ3".equals(r.getRegion_code()) || "HCQ4".equals(r.getRegion_code()) || "HCQ5".equals(r.getRegion_code()) || "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList()); - for (SchBasePoint r : list1) { - if (r.getRow_num() == 0) { - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() - .eq(SchBasePoint::getPoint_code, r.getPoint_code()); - String pointId = r.getPoint_code().substring(5, 9); - updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId)); - schBasePoint.update(null, updateWrapper); - } - } - List basePointList = list.stream().filter(r -> "TBX1101".equals(r.getPoint_code())).collect(Collectors.toList()); - if (ObjectUtil.isNotEmpty(basePointList)) { - if ("A1".equals(basePointList.get(0).getWorkshop_code())) { - List regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2")); - LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() - .in(SchBasePoint::getRegion_code, regionList); - updateWrapper.set(SchBasePoint::getWorkshop_code, "A2"); - schBasePoint.update(null, updateWrapper); - } - } + long startTime1 = System.currentTimeMillis(); + //初始化点位所在排信息 + // List list = schBasePoint.list(new LambdaQueryWrapper().eq(SchBasePoint::getIs_used, 1)); + // List list1 = list.stream().filter(r -> "HCQ1".equals(r.getRegion_code()) || "HCQ2".equals(r.getRegion_code()) || "HCQ3".equals(r.getRegion_code()) || "HCQ4".equals(r.getRegion_code()) || "HCQ5".equals(r.getRegion_code()) || "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList()); + // for (SchBasePoint r : list1) { + // if (r.getRow_num() == 0) { + // LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() + // .eq(SchBasePoint::getPoint_code, r.getPoint_code()); + // String pointId = r.getPoint_code().substring(5, 9); + // updateWrapper.set(SchBasePoint::getRow_num, Integer.parseInt(pointId)); + // schBasePoint.update(null, updateWrapper); + // } + // } + // List basePointList = list.stream().filter(r -> "TBX1101".equals(r.getPoint_code())).collect(Collectors.toList()); + // if (ObjectUtil.isNotEmpty(basePointList)) { + // if ("A1".equals(basePointList.get(0).getWorkshop_code())) { + // List regionList = new ArrayList<>(Arrays.asList("TBX2", "GHS2")); + // LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() + // .in(SchBasePoint::getRegion_code, regionList); + // updateWrapper.set(SchBasePoint::getWorkshop_code, "A2"); + // schBasePoint.update(null, updateWrapper); + // } + // } // todo 未对接的涂板线数据 JSONObject tbx01 = new JSONObject(); tbx01.put("mode", "0"); @@ -297,6 +295,7 @@ public class CockpitServiceImpl implements CockpitService { } else { jsonObject.put("9", new JSONArray()); } + log.info("读取涂板线设备缓存信息耗时{}", System.currentTimeMillis() - startTime1); return null; }, pool); task1.exceptionally((e) -> { @@ -304,6 +303,7 @@ public class CockpitServiceImpl implements CockpitService { return null; }); CompletableFuture>> task2 = CompletableFuture.supplyAsync(() -> { + long startTime2 = System.currentTimeMillis(); JSONArray ghs1 = (JSONArray) redisUtils.get("ghsList1"); List ghsList1 = getSortedList(ghs1); JSONArray ghs2 = (JSONArray) redisUtils.get("ghsList2"); @@ -318,6 +318,7 @@ public class CockpitServiceImpl implements CockpitService { } else { jsonObject.put("11", new JSONArray()); } + log.info("读取固化室设备缓存信息{}", System.currentTimeMillis() - startTime2); return null; }, pool); task2.exceptionally((e) -> { @@ -325,6 +326,7 @@ public class CockpitServiceImpl implements CockpitService { return null; }); CompletableFuture>> task3 = CompletableFuture.supplyAsync(() -> { + long startTime3 = System.currentTimeMillis(); JSONArray bpjList = (JSONArray) redisUtils.get("bpjList"); List bpjList1 = getSortedList(bpjList); if (ObjectUtil.isNotEmpty(bpjList1)) { @@ -336,6 +338,7 @@ public class CockpitServiceImpl implements CockpitService { JSONArray deviceA2 = (JSONArray) redisUtils.get("deviceA2"); jsonObject.put("17", deviceA1); jsonObject.put("19", deviceA2); + log.info("读取包片机设备缓存信息{}", System.currentTimeMillis() - startTime3); return null; }, pool); task3.exceptionally((e) -> { @@ -343,6 +346,7 @@ public class CockpitServiceImpl implements CockpitService { return null; }); CompletableFuture>> task4 = CompletableFuture.supplyAsync(() -> { + long startTime4 = System.currentTimeMillis(); //正极板空架回收位 JSONArray zjbKjHswList = (JSONArray) redisUtils.get("zjbKjHswList"); List zjbKjHswList1 = getSortedList(zjbKjHswList); @@ -367,6 +371,7 @@ public class CockpitServiceImpl implements CockpitService { } else { jsonObject.put("15", new JSONArray()); } + log.info("读取包片机设备缓存信息耗时{}", System.currentTimeMillis() - startTime4); return null; }, pool); task4.exceptionally((e) -> { @@ -374,68 +379,33 @@ public class CockpitServiceImpl implements CockpitService { return null; }); CompletableFuture task5 = CompletableFuture.supplyAsync(() -> { + long startTime5 = System.currentTimeMillis(); JSONArray jsonArray = cockpitMapper.getZCList(); List pointInfoList = jsonArray.stream() .map(r -> JSON.parseObject(r.toString(), PointInfo.class)) .collect(Collectors.toList()); //正极板空固化架缓存区A1 List hcq6 = pointInfoList.stream().filter(r -> "HCQ6".equals(r.getRegion_code())).sorted(Comparator.comparing(PointInfo::getRow_num)).collect(Collectors.toList()); - AtomicReference> list1 = new AtomicReference<>(); - CompletableFuture>> task01 = CompletableFuture.supplyAsync(() -> { - //边负极板缓存区 - List hcq1 = pointInfoList.stream().filter(r -> "HCQ3".equals(r.getRegion_code())).collect(Collectors.toList()); - list1.set(getPointInfoList(hcq1)); - return null; - }, pool); - AtomicReference> list2 = new AtomicReference<>(); - CompletableFuture>> task02 = CompletableFuture.supplyAsync(() -> { - //边负极板缓存区 - //负极板缓存区 - List hcq2 = pointInfoList.stream().filter(r -> "HCQ2".equals(r.getRegion_code())).collect(Collectors.toList()); - list2.set(getPointInfoList(hcq2)); - return null; - }, pool); - AtomicReference> list3 = new AtomicReference<>(); - CompletableFuture>> task03 = CompletableFuture.supplyAsync(() -> { - //负极板空架缓存区 - List hcq3 = pointInfoList.stream().filter(r -> "HCQ1".equals(r.getRegion_code())).collect(Collectors.toList()); - list3.set(getPointInfoList(hcq3)); - return null; - }, pool); - AtomicReference> list4 = new AtomicReference<>(); - CompletableFuture>> task04 = CompletableFuture.supplyAsync(() -> { - //正极板缓存区 - List hcq4 = pointInfoList.stream().filter(r -> "HCQ4".equals(r.getRegion_code())).collect(Collectors.toList()); - list4.set(getPointInfoList(hcq4)); - return null; - }, pool); - AtomicReference> list5 = new AtomicReference<>(); - CompletableFuture>> task05 = CompletableFuture.supplyAsync(() -> { - //正极板空固化架缓存区 - List hcq5 = pointInfoList.stream().filter(r -> "HCQ5".equals(r.getRegion_code())).collect(Collectors.toList()); - list5.set(getPointInfoList(hcq5)); - return null; - }, pool); - AtomicReference> list7 = new AtomicReference<>(); - CompletableFuture>> task07 = CompletableFuture.supplyAsync(() -> { - //涂板线空固化架缓存区 - List hcq7 = pointInfoList.stream().filter(r -> "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList()); - list7.set(getPointInfoList(hcq7)); - return null; - }, pool); - CompletableFuture allQuery = CompletableFuture.allOf(task01, task02, task03, task04, task05, task07); - CompletableFuture future = allQuery.thenApply((result) -> jsonObject).exceptionally((e) -> { - log.error(e.getMessage(), e); - return null; - }); - future.join(); + //边负极板缓存区 + List list1 = getPointInfoList(pointInfoList.stream().filter(r -> "HCQ3".equals(r.getRegion_code())).collect(Collectors.toList())); + //负极板缓存区 + List list2 = getPointInfoList(pointInfoList.stream().filter(r -> "HCQ2".equals(r.getRegion_code())).collect(Collectors.toList())); + //负极板空架缓存区 + List list3 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ1".equals(r.getRegion_code())).collect(Collectors.toList())); + //正极板缓存区 + List list4 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ4".equals(r.getRegion_code())).collect(Collectors.toList())); + //正极板空固化架缓存区 + List list5 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ5".equals(r.getRegion_code())).collect(Collectors.toList())); + //涂板线空固化架缓存区 + List list7 =getPointInfoList(pointInfoList.stream().filter(r -> "HCQ7".equals(r.getRegion_code())).collect(Collectors.toList())); jsonObject.put("8", hcq6); - jsonObject.put("4", list1.get()); - jsonObject.put("5", list2.get()); - jsonObject.put("6", list3.get()); - jsonObject.put("12", list4.get()); - jsonObject.put("10", list5.get()); - jsonObject.put("3", list7.get()); + jsonObject.put("4", list1); + jsonObject.put("5", list2); + jsonObject.put("6", list3); + jsonObject.put("12", list4); + jsonObject.put("10", list5); + jsonObject.put("3", list7); + log.info("读取缓冲库信息耗时: {}", System.currentTimeMillis() - startTime5); return null; }, pool); task5.exceptionally((e) -> { diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index 2261c61..e1805d0 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -6,7 +6,7 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.10.10}:${DB_PORT:3306}/${DB_NAME:cw_wms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:stand_lms}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} password: ${DB_PWD:123456789} diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml index 82f7ddd..8d089c4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-prod.yml @@ -55,7 +55,7 @@ spring: redis: #数据库索引 database: ${REDIS_DB:2} - host: ${REDIS_HOST:127.0.0.1} + host: ${REDIS_HOST:192.168.200.210} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -154,7 +154,7 @@ sa-token: # Redis数据库索引(默认为0) database: 2 # Redis服务器地址 - host: 127.0.0.1 + host: 192.168.200.210 # Redis服务器连接端口 port: 6379 # Redis服务器连接密码(默认为空) diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml index ac11b14..e6955d8 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: @@ -29,6 +29,8 @@ task: keep-alive-seconds: 60 # 队列容量 queue-capacity: 50 + # 主线程等待子线程执行时间 + awaitTerminationSeconds: 50 #七牛云 qiniu: