From 5543d5f9fa93d0e476a8d11eff68a8acd6c348cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E4=BF=8A=E6=9D=B0?= <9463626+zhou-junjiezjj@user.noreply.gitee.com> Date: Mon, 31 Jul 2023 11:20:03 +0800 Subject: [PATCH] 1 --- .../quartz/task/QueryZDAgvTaskStatus.java | 60 ++++++++++++++++++- .../resources/config/application-prod.yml | 8 +-- .../src/main/resources/config/application.yml | 2 +- .../main/resources/log/TaskServiceImpl.xml | 33 ++++++++++ .../src/main/resources/logback-spring.xml | 2 +- acs/nladmin-ui/.env.development | 4 +- acs/nladmin-ui/.env.production | 4 +- acs/nladmin-ui/public/config.js | 14 ++--- 8 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 acs/nladmin-system/src/main/resources/log/TaskServiceImpl.xml diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java index 9bd0bd8..fb0b838 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java @@ -6,9 +6,15 @@ import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.ZheDaAgvService; +import org.nl.acs.ext.wms.service.AcsToWmsZDService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.task.service.TaskService; +import org.nl.acs.task.service.dto.TaskDto; +import org.nl.acs.task.service.impl.TaskServiceImpl; +import org.nl.modules.system.service.ParamService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -21,6 +27,14 @@ public class QueryZDAgvTaskStatus { @Autowired ZheDaAgvService agvService; + @Autowired + ParamService paramService; + + @Autowired + AcsToWmsZDService acsToWmsZDService; + + @Autowired + TaskService taskService; public void run() throws Exception { try { @@ -56,9 +70,53 @@ public class QueryZDAgvTaskStatus { //执行中 if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) { - if (inst != null) { + if (inst != null && StrUtil.equals("0",inst.getInstruction_status())) { inst.setInstruction_status("1"); instructionService.update(inst); + // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS + TaskDto entity = taskService.findByCode(inst.getTask_code()); + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + String Type1=entity.getTask_type(); + if(StrUtil.equals(Type1,"定点任务")){ + JSONObject jo = new JSONObject(); + jo.put("taskCode",entity.getTask_code()); + jo.put("carId",""); + jo.put("taskType ",entity.getTask_type()); + jo.put("feedbackStatus","taking"); + log.info("请求参数:{}",jo); + try{ + HttpResponse result= acsToWmsZDService.taskFeedback(jo); + log.info("请求ZDwcs成功,反馈取货中 请求结果{}",result.body()); + } catch (Exception e) { + e.printStackTrace(); + } +// JSONObject response=JSONObject.parseObject(result.body()); +// int responseCode= response.getInteger("responseCode"); +// if(responseCode == 0) { +// log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode); +// } + } + if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { + JSONObject jo = new JSONObject(); + jo.put("taskCode",entity.getTask_code()); + jo.put("carId",""); + jo.put("taskType ",entity.getTask_type()); + jo.put("feedbackStatus","taking"); + log.info("请求参数:{}",jo); + try{ + HttpResponse result= acsToWmsZDService.taskFeedback(jo); + log.info("请求ZDwcs成功,反馈取货中 请求结果{}",result.body()); + } catch (Exception e) { + e.printStackTrace(); + } +// JSONObject response=JSONObject.parseObject(result.body()); +// int responseCode= response.getInteger("responseCode"); +// if(responseCode == 0) { +// log.info("请求ZDwcs成功,申请取货 请求结果{}",responseCode); +// } + } + + } } else if ("FINISHED".equals(state)) { if (inst != null) { diff --git a/acs/nladmin-system/src/main/resources/config/application-prod.yml b/acs/nladmin-system/src/main/resources/config/application-prod.yml index fdcbec5..d95af4e 100644 --- a/acs/nladmin-system/src/main/resources/config/application-prod.yml +++ b/acs/nladmin-system/src/main/resources/config/application-prod.yml @@ -1,14 +1,14 @@ server: - port: 8010 + port: 8011 #配置数据源 spring: datasource: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.4.210}:${DB_PORT:3306}/${DB_NAME: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:zdlb_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} - password: ${DB_PWD:123456} + password: ${DB_PWD:root} # 初始连接数 initial-size: 5 # 最小连接数 @@ -153,5 +153,5 @@ sa-token: token-prefix: Bearer loki: - url: http://192.168.4.210:3100/loki/api/v1 + url: http://127.0.0.1:3100/loki/api/v1 systemName: acs diff --git a/acs/nladmin-system/src/main/resources/config/application.yml b/acs/nladmin-system/src/main/resources/config/application.yml index 7e3fbea..a4d00ab 100644 --- a/acs/nladmin-system/src/main/resources/config/application.yml +++ b/acs/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/acs/nladmin-system/src/main/resources/log/TaskServiceImpl.xml b/acs/nladmin-system/src/main/resources/log/TaskServiceImpl.xml new file mode 100644 index 0000000..d9ee473 --- /dev/null +++ b/acs/nladmin-system/src/main/resources/log/TaskServiceImpl.xml @@ -0,0 +1,33 @@ + + + + + + + + + ${LOG_HOME}/任务反馈/%d{yyyy-MM-dd}.%i.log + + 15 + + 200MB + + 2GB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + ${log.charset} + + + + + + + + + + + diff --git a/acs/nladmin-system/src/main/resources/logback-spring.xml b/acs/nladmin-system/src/main/resources/logback-spring.xml index 88bf906..dcf0c91 100644 --- a/acs/nladmin-system/src/main/resources/logback-spring.xml +++ b/acs/nladmin-system/src/main/resources/logback-spring.xml @@ -30,7 +30,7 @@ https://juejin.cn/post/6844903775631572999 - + diff --git a/acs/nladmin-ui/.env.development b/acs/nladmin-ui/.env.development index 809e77f..e37a9a4 100644 --- a/acs/nladmin-ui/.env.development +++ b/acs/nladmin-ui/.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/acs/nladmin-ui/.env.production b/acs/nladmin-ui/.env.production index 9be6cba..48a9dbe 100644 --- a/acs/nladmin-ui/.env.production +++ b/acs/nladmin-ui/.env.production @@ -2,6 +2,6 @@ ENV = 'production' # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http -VUE_APP_BASE_API = 'http://10.1.3.90:8011' +VUE_APP_BASE_API = 'http:// 172.18.10.14:8011' # 如果接口是 http 形式, wss 需要改为 ws -VUE_APP_WS_API = 'ws://10.1.3.90:8011' +VUE_APP_WS_API = 'ws:// 172.18.10.14:8011' diff --git a/acs/nladmin-ui/public/config.js b/acs/nladmin-ui/public/config.js index c4d32ea..6c0413a 100644 --- a/acs/nladmin-ui/public/config.js +++ b/acs/nladmin-ui/public/config.js @@ -1,10 +1,10 @@ window.g = { - dev: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' - }, - prod: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' + dev: { + VUE_APP_BASE_API: 'http://127.0.0.1:8011' + }, + prod: { + VUE_APP_BASE_API: 'http://172.18.10.14:8010' - } + } -} +} \ No newline at end of file