周俊杰 1 year ago
parent
commit
5543d5f9fa
  1. 60
      acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryZDAgvTaskStatus.java
  2. 8
      acs/nladmin-system/src/main/resources/config/application-prod.yml
  3. 2
      acs/nladmin-system/src/main/resources/config/application.yml
  4. 33
      acs/nladmin-system/src/main/resources/log/TaskServiceImpl.xml
  5. 2
      acs/nladmin-system/src/main/resources/logback-spring.xml
  6. 4
      acs/nladmin-ui/.env.development
  7. 4
      acs/nladmin-ui/.env.production
  8. 4
      acs/nladmin-ui/public/config.js

60
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.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.ZheDaAgvService; 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.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -21,6 +27,14 @@ public class QueryZDAgvTaskStatus {
@Autowired @Autowired
ZheDaAgvService agvService; ZheDaAgvService agvService;
@Autowired
ParamService paramService;
@Autowired
AcsToWmsZDService acsToWmsZDService;
@Autowired
TaskService taskService;
public void run() throws Exception { public void run() throws Exception {
try { try {
@ -56,9 +70,53 @@ public class QueryZDAgvTaskStatus {
//执行中 //执行中
if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) { if ("BEING_PROCESSED".equals(state) || "ACTIVE".equals(state)) {
if (inst != null) { if (inst != null && StrUtil.equals("0",inst.getInstruction_status())) {
inst.setInstruction_status("1"); inst.setInstruction_status("1");
instructionService.update(inst); 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)) { } else if ("FINISHED".equals(state)) {
if (inst != null) { if (inst != null) {

8
acs/nladmin-system/src/main/resources/config/application-prod.yml

@ -1,14 +1,14 @@
server: server:
port: 8010 port: 8011
#配置数据源 #配置数据源
spring: spring:
datasource: datasource:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy 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} username: ${DB_USER:root}
password: ${DB_PWD:123456} password: ${DB_PWD:root}
# 初始连接数 # 初始连接数
initial-size: 5 initial-size: 5
# 最小连接数 # 最小连接数
@ -153,5 +153,5 @@ sa-token:
token-prefix: Bearer token-prefix: Bearer
loki: loki:
url: http://192.168.4.210:3100/loki/api/v1 url: http://127.0.0.1:3100/loki/api/v1
systemName: acs systemName: acs

2
acs/nladmin-system/src/main/resources/config/application.yml

@ -2,7 +2,7 @@ spring:
freemarker: freemarker:
check-template-location: false check-template-location: false
profiles: profiles:
active: dev active: prod
jackson: jackson:
time-zone: GMT+8 time-zone: GMT+8
data: data:

33
acs/nladmin-system/src/main/resources/log/TaskServiceImpl.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE13" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/任务反馈/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>200MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>2GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${log.charset}</charset>
</encoder>
</appender>
<!-- <logger name="org.nl.start.Init" level="info" additivity="false">
<appender-ref ref="FILE3"/>
</logger>-->
<!-- 打印sql -->
<logger name="org.nl.acs.task.service.impl.TaskServiceImpl.java" level="info" additivity="false">
<appender-ref ref="FILE13"/>
</logger>
</included>

2
acs/nladmin-system/src/main/resources/logback-spring.xml

@ -30,7 +30,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/ZheDaAgv.xml"/> <include resource="log/ZheDaAgv.xml"/>
<include resource="log/AcsToZDWms.xml"/> <include resource="log/AcsToZDWms.xml"/>
<include resource="log/ZDToAcsWms.xml"/> <include resource="log/ZDToAcsWms.xml"/>
<include resource="log/TaskServiceImpl.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>

4
acs/nladmin-ui/.env.development

@ -1,8 +1,8 @@
ENV = 'development' ENV = 'development'
# 接口地址 # 接口地址
VUE_APP_BASE_API = 'http://localhost:8010' VUE_APP_BASE_API = 'http://localhost:8011'
VUE_APP_WS_API = 'ws://localhost:8010' VUE_APP_WS_API = 'ws://localhost:8011'
# 是否启用 babel-plugin-dynamic-import-node插件 # 是否启用 babel-plugin-dynamic-import-node插件
VUE_CLI_BABEL_TRANSPILE_MODULES = true VUE_CLI_BABEL_TRANSPILE_MODULES = true

4
acs/nladmin-ui/.env.production

@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http # 接口地址,注意协议,如果你没有配置 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 # 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://10.1.3.90:8011' VUE_APP_WS_API = 'ws:// 172.18.10.14:8011'

4
acs/nladmin-ui/public/config.js

@ -1,9 +1,9 @@
window.g = { window.g = {
dev: { dev: {
VUE_APP_BASE_API: 'http://127.0.0.1:8010' VUE_APP_BASE_API: 'http://127.0.0.1:8011'
}, },
prod: { prod: {
VUE_APP_BASE_API: 'http://127.0.0.1:8010' VUE_APP_BASE_API: 'http://172.18.10.14:8010'
} }

Loading…
Cancel
Save