From 6a21976711a8b3b97b880a0d6e3fc8bffe1fe3b7 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Fri, 5 Aug 2022 12:15:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/service/impl/AcsToWmsServiceImpl.java | 120 ++++++++++-------- .../main/resources/config/application-dev.yml | 12 +- .../resources/config/application-prod.yml | 8 +- .../src/main/resources/logback-spring.xml | 2 +- mes/qd/.env.development | 4 +- wcs/hd/logPath_IS_UNDEFINED/2022-07-13.0.log | 0 .../log/service/impl/RootLogServiceImpl.java | 21 ++- .../main/resources/config/application-dev.yml | 12 +- .../src/main/resources/config/application.yml | 2 +- wcs/qd/src/views/acs/monitor/device/index.vue | 2 +- wcs/qd/src/views/log/deviceLog/index.vue | 1 - 11 files changed, 105 insertions(+), 79 deletions(-) delete mode 100644 wcs/hd/logPath_IS_UNDEFINED/2022-07-13.0.log diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 8c915cdc..6e3857d3 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -131,58 +131,70 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public Map orderFinish(String string) { - JSONObject orderJson = JSONObject.parseObject(string); - String ext_order_id = orderJson.getString("ext_order_id"); - // JSONArray array = JSONArray.parseArray(string); - String now = DateUtil.now(); - WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder"); - JSONObject map = new JSONObject(); - map.put("produceorder_id", ext_order_id); - map.put("order_status", "04"); - map.put("update_optid", 1001001); - map.put("device_id", ""); - map.put("update_optname", "acs"); - map.put("update_time", now); - map.put("realproduceend_date", now); - wo.update(map, "produceorder_id = '" + ext_order_id + "'"); JSONObject result = new JSONObject(); + try { + JSONObject orderJson = JSONObject.parseObject(string); + String ext_order_id = orderJson.getString("ext_order_id"); + // JSONArray array = JSONArray.parseArray(string); + String now = DateUtil.now(); + WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder"); + JSONObject map = new JSONObject(); + map.put("produceorder_id", ext_order_id); + map.put("order_status", "04"); + map.put("update_optid", 1001001); + map.put("device_id", ""); + map.put("update_optname", "acs"); + map.put("update_time", now); + map.put("realproduceend_date", now); + wo.update(map, "produceorder_id = '" + ext_order_id + "'"); + } catch (Exception e){ + result.put("status", 400); + result.put("message", e.getMessage()); + return result; + } result.put("status", HttpStatus.OK.value()); - result.put("message", "任务状态反馈成功!"); + result.put("message", "订单完成状态反馈成功!"); return result; } @Override public Map feedDeviceStatusType(String string) { - JSONObject param = JSONObject.parseObject(string); - String device_code = param.getString("device_code"); - String status_type = param.getString("status_type"); - String start_time = param.getString("start_time"); - Integer error_code = Integer.parseInt(param.getString("error_code")); - WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); - JSONObject device_json = wo.query("is_delete = '0' and is_active = '1' and device_code = '" + device_code + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(device_json)) { - String device_id = device_json.getString("device_id"); - WQLObject wo_status = WQLObject.getWQLObject("PDM_BI_DeviceRunStatusRecord"); - JSONObject status_json = wo_status.query("device_id = '" + device_id + "' and (end_time is null or end_time = '' )").uniqueResult(0); - if (ObjectUtil.isNotEmpty(status_json)) { - status_json.put("end_time", start_time); - wo_status.update(status_json); - log.warn("上一次设备状态结束时间修改成功:{}",device_code); - } - JSONObject map = new JSONObject(); - map.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); - map.put("device_id", device_id); - map.put("status_type", status_type); - map.put("start_time", start_time); - if (error_code > 0) { - map.put("err_status_id", error_code); - } else { - map.put("err_status_id", null); - } - wo_status.insert(map); - log.warn("设备状态新增成功{}",device_code); - } JSONObject result = new JSONObject(); + try { + JSONObject param = JSONObject.parseObject(string); + String device_code = param.getString("device_code"); + String status_type = param.getString("status_type"); + String start_time = param.getString("start_time"); + Integer error_code = Integer.parseInt(param.getString("error_code")); + WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); + JSONObject device_json = wo.query("is_delete = '0' and is_active = '1' and device_code = '" + device_code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(device_json)) { + String device_id = device_json.getString("device_id"); + WQLObject wo_status = WQLObject.getWQLObject("PDM_BI_DeviceRunStatusRecord"); + JSONObject status_json = wo_status.query("device_id = '" + device_id + "' and (end_time is null or end_time = '' )").uniqueResult(0); + if (ObjectUtil.isNotEmpty(status_json)) { + status_json.put("end_time", start_time); + wo_status.update(status_json); + log.warn("上一次设备状态结束时间修改成功:{}",device_code); + } + JSONObject map = new JSONObject(); + map.put("record_id", IdUtil.getSnowflake(1, 1).nextId()); + map.put("device_id", device_id); + map.put("status_type", status_type); + map.put("start_time", start_time); + if (error_code > 0) { + map.put("err_status_id", error_code); + } else { + map.put("err_status_id", null); + } + wo_status.insert(map); + log.warn("设备状态新增成功{}",device_code); + } + } catch (Exception e){ + result.put("status", 400); + result.put("message", e.getMessage()); + return result; + } result.put("status", HttpStatus.OK.value()); result.put("message", "设备状态反馈成功"); return result; @@ -190,14 +202,20 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public Map feedOrderRealQty(String string) { - JSONObject param = JSONObject.parseObject(string); - String order_code = param.getString("order"); - String real_qty = param.getString("real_qty"); - WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); - JSONObject map = new JSONObject(); - map.put("real_qty", real_qty); - wo.update(map, "produceorder_code = '" + order_code + "' and order_status != '04'"); JSONObject result = new JSONObject(); + + try { + JSONObject param = JSONObject.parseObject(string); + String order_code = param.getString("order"); + String real_qty = param.getString("real_qty"); + WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder"); + JSONObject map = new JSONObject(); + map.put("real_qty", real_qty); + wo.update(map, "produceorder_code = '" + order_code + "' and order_status != '04'"); + } catch (Exception e){ + result.put("status", 400); + result.put("message", e.getMessage()); + } result.put("status", HttpStatus.OK.value()); result.put("message", "设备状态反馈成功"); return result; diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml b/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml index 155cdf15..bb6caeb9 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8010 + port: 8011 #海亮sqlserver erp: sqlserver: @@ -18,11 +18,11 @@ spring: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy #url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false username: ${DB_USER:root} #password: ${DB_PWD:P@ssw0rd} #password: ${DB_PWD:root} - password: ${DB_PWD:Root.123456} + password: ${DB_PWD:password} # 初始连接数 initial-size: 5 # 最小连接数 @@ -68,14 +68,14 @@ spring: multi-statement-alagvslow: true data: mongodb: - host: 47.111.78.178 + host: 127.0.0.1 port: 27017 database: nlwms redis: #数据库索引 database: ${REDIS_DB:1} - host: ${REDIS_HOST:47.111.78.178} + host: ${REDIS_HOST:127.0.0.1} # host: ${REDIS_HOST:localhost} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -173,5 +173,5 @@ jetcache: maxIdle: 200 maxTotal: 1000 uri: - - redis://47.111.78.178:6379 + - redis://127.0.0.1:6379 diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml b/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml index 59ed99d8..ee130584 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -8,7 +8,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.46.225}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false + url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.5}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false username: ${DB_USER:root} password: ${DB_PWD:123456} #password: ${DB_PWD:Root.123456} @@ -57,14 +57,14 @@ spring: multi-statement-alagvslow: true data: mongodb: - host: 192.168.46.225 + host: 192.168.46.5 port: 27017 database: nlacs redis: #数据库索引 database: ${REDIS_DB:6} - host: ${REDIS_HOST:192.168.46.225} + host: ${REDIS_HOST:192.168.46.5} #host: ${REDIS_HOST:localhost} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} @@ -162,5 +162,5 @@ jetcache: maxIdle: 200 maxTotal: 1000 uri: - - redis://localhost:6379 + - redis://192.168.46.5:6379 diff --git a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml index 72d9e4c2..e9a3d0a9 100644 --- a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -123,7 +123,7 @@ https://juejin.cn/post/6844903775631572999 - + diff --git a/mes/qd/.env.development b/mes/qd/.env.development index 809e77ff..e37a9a4f 100644 --- a/mes/qd/.env.development +++ b/mes/qd/.env.development @@ -1,8 +1,8 @@ ENV = 'development' # 接口地址 -VUE_APP_BASE_API = 'http://localhost:8010' -VUE_APP_WS_API = 'ws://localhost:8010' +VUE_APP_BASE_API = 'http://localhost:8011' +VUE_APP_WS_API = 'ws://localhost:8011' # 是否启用 babel-plugin-dynamic-import-node插件 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/wcs/hd/logPath_IS_UNDEFINED/2022-07-13.0.log b/wcs/hd/logPath_IS_UNDEFINED/2022-07-13.0.log deleted file mode 100644 index e69de29b..00000000 diff --git a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/service/impl/RootLogServiceImpl.java b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/service/impl/RootLogServiceImpl.java index f174168b..2da6c0d2 100644 --- a/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/service/impl/RootLogServiceImpl.java +++ b/wcs/hd/nladmin-system/src/main/java/org/nl/modules/log/service/impl/RootLogServiceImpl.java @@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device.service.DeviceService; import org.nl.modules.log.service.RootLogService; +import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.MongoTemplate; @@ -93,17 +94,25 @@ public class RootLogServiceImpl implements RootLogService { .lte(end_time)); } - //根据条件得到的总条数 + + Pageable pageable = PageRequest.of(page.getPageNumber(), page.getPageSize()); + long totalCount = mongoTemplate.count(query,device_code); + + List result = mongoTemplate.find(query.with(pageable), Map.class, device_code); + + long totalPage = totalCount % page.getPageSize() == 0 ? totalCount / page.getPageSize() : totalCount / page.getPageSize() + 1; +/* //根据条件得到的总条数 long totalSize = mongoTemplate.count(query, Map.class, device_code); //处理分页 query.skip(page.getPageNumber()).limit(page.getPageSize()); - List list = mongoTemplate.find(query,Map.class, device_code); + + List list = mongoTemplate.find(query,Map.class, device_code);*/ //封装前端分页查询结果 - JSONObject result = new JSONObject(); - result.put("content", list); - result.put("totalElements", totalSize); - return result; + JSONObject jo = new JSONObject(); + jo.put("content", result); + jo.put("totalElements", totalCount); + return jo; } @Override diff --git a/wcs/hd/nladmin-system/src/main/resources/config/application-dev.yml b/wcs/hd/nladmin-system/src/main/resources/config/application-dev.yml index f110a815..8147711b 100644 --- a/wcs/hd/nladmin-system/src/main/resources/config/application-dev.yml +++ b/wcs/hd/nladmin-system/src/main/resources/config/application-dev.yml @@ -8,12 +8,12 @@ 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:hl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:hl_acs_one}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_acs_one}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} # password: ${DB_PWD:123456} - password: ${DB_PWD:Root.123456} - #password: ${DB_PWD:password} + #password: ${DB_PWD:Root.123456} + password: ${DB_PWD:password} # 初始连接数 initial-size: 5 # 最小连接数 @@ -59,13 +59,13 @@ spring: multi-statement-alagvslow: true data: mongodb: - host: 47.111.78.178 + host: 127.0.0.1 port: 27017 database: nlacs redis: #数据库索引 database: ${REDIS_DB:10} - host: ${REDIS_HOST:47.111.78.178} + host: ${REDIS_HOST:127.0.0.1} port: ${REDIS_PORT:6379} password: ${REDIS_PWD:} #连接超时时间 @@ -162,5 +162,5 @@ jetcache: maxIdle: 200 maxTotal: 1000 uri: - - redis://47.111.78.178:6379 + - redis://127.0.0.1:6379 diff --git a/wcs/hd/nladmin-system/src/main/resources/config/application.yml b/wcs/hd/nladmin-system/src/main/resources/config/application.yml index fd94b205..4eba8310 100644 --- a/wcs/hd/nladmin-system/src/main/resources/config/application.yml +++ b/wcs/hd/nladmin-system/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: diff --git a/wcs/qd/src/views/acs/monitor/device/index.vue b/wcs/qd/src/views/acs/monitor/device/index.vue index b9483971..29d3ba80 100644 --- a/wcs/qd/src/views/acs/monitor/device/index.vue +++ b/wcs/qd/src/views/acs/monitor/device/index.vue @@ -184,7 +184,7 @@ - + diff --git a/wcs/qd/src/views/log/deviceLog/index.vue b/wcs/qd/src/views/log/deviceLog/index.vue index 12f72c13..705db8f2 100644 --- a/wcs/qd/src/views/log/deviceLog/index.vue +++ b/wcs/qd/src/views/log/deviceLog/index.vue @@ -29,7 +29,6 @@