Browse Source

现场fix

master
psh 1 year ago
parent
commit
61bb0c42ed
  1. 3
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java
  2. 11
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  3. 41
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java
  4. 11
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/ConfigurerAdapter.java
  5. 112
      acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/saconfig/CorsFilter.java
  6. 4
      acs/nladmin-ui/.env.production
  7. 2
      acs/nladmin-ui/public/config.js
  8. 2
      acs/nladmin-ui/vue.config.js

3
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java

@ -6,6 +6,7 @@ import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import groovy.lang.Lazy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
@ -29,7 +30,7 @@ import java.util.List;
import java.util.Map;
@Slf4j
@Service
//@Service
@RequiredArgsConstructor
public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService;

11
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -17,7 +17,6 @@ import org.apache.commons.lang3.ObjectUtils;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.MagicAgvService;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
@ -992,11 +991,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else {
flag = true;
}
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
&& !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
flag = true;
// } else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
// && !StrUtil.equals(entity.getSend_status(), "2")) {
// XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
// xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
// flag = true;
} else {
flag = true;
}

41
acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java

@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType;
@ -101,8 +100,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
TaskFeedbackService taskFeedbackService;
@Autowired
ISysParamService paramService;
@Autowired
XianGongAgvService agvService;
// @Autowired
// XianGongAgvService agvService;
@Autowired
RouteLineService routeLineService;
@Autowired
@ -934,14 +933,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
}
}
// 如果属于先知AGV,关闭运单序列
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
try {
agvService.markComplete(entity.getTask_code());
} catch (Exception e) {
e.printStackTrace();
}
}
// // 如果属于先知AGV,关闭运单序列
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
// try {
// agvService.markComplete(entity.getTask_code());
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
@Override
@ -1006,11 +1005,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType();
// != 0 为agv任务
if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
agvService.markComplete(entity.getTask_code());
}
}
// if (!StrUtil.equals(type, "0")) {
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
// agvService.markComplete(entity.getTask_code());
// }
// }
}
@Override
@ -1056,11 +1055,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType();
// != 0 为agv任务
if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
agvService.markComplete(entity.getTask_code());
}
}
// if (!StrUtil.equals(type, "0")) {
// if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
// agvService.markComplete(entity.getTask_code());
// }
// }
}
@Override

11
acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/ConfigurerAdapter.java

@ -40,6 +40,17 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
this.properties = properties;
}
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/**", config);
return new CorsFilter(source);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
FileProperties.ElPath path = properties.getPath();

112
acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/saconfig/CorsFilter.java

@ -1,56 +1,56 @@
package org.nl.config.saconfig;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.cors.CorsConfiguration;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 跨域过滤器
* @author kong
*/
@Component
@Order(-200)
public class CorsFilter implements Filter {
static final String OPTIONS = "OPTIONS";
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
// 允许指定域访问跨域资源
response.setHeader("Access-Control-Allow-Origin", "*");
// 允许所有请求方式
response.setHeader("Access-Control-Allow-Methods", "*");
// 有效时间
response.setHeader("Access-Control-Max-Age", "3600");
// 允许的header参数
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
// 如果是预检请求,直接返回
if (OPTIONS.equals(request.getMethod())) {
System.out.println("=======================浏览器发来了OPTIONS预检请求==========");
response.getWriter().print("");
return;
}
// System.out.println("*********************************过滤器被使用**************************");
chain.doFilter(req, res);
}
@Override
public void init(FilterConfig filterConfig) {
}
@Override
public void destroy() {
}
}
//package org.nl.config.saconfig;
//
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//import org.springframework.web.cors.CorsConfiguration;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * 跨域过滤器
// * @author kong
// */
//@Component
//@Order(-200)
//public class CorsFilter implements Filter {
//
// static final String OPTIONS = "OPTIONS";
//
// @Override
// public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
// throws IOException, ServletException {
// HttpServletRequest request = (HttpServletRequest) req;
// HttpServletResponse response = (HttpServletResponse) res;
// // 允许指定域访问跨域资源
// response.setHeader("Access-Control-Allow-Origin", "*");
//// // 允许所有请求方式
//// response.setHeader("Access-Control-Allow-Methods", "*");
//// // 有效时间
//// response.setHeader("Access-Control-Max-Age", "3600");
//// // 允许的header参数
//// response.setHeader("Access-Control-Allow-Headers", "*");
// response.setHeader("Access-Control-Allow-Credentials", "true");
//
// // 如果是预检请求,直接返回
// if (OPTIONS.equals(request.getMethod())) {
// System.out.println("=======================浏览器发来了OPTIONS预检请求==========");
// response.getWriter().print("");
// return;
// }
//
// // System.out.println("*********************************过滤器被使用**************************");
// chain.doFilter(req, res);
// }
//
// @Override
// public void init(FilterConfig filterConfig) {
// }
//
// @Override
// public void destroy() {
// }
//
//}

4
acs/nladmin-ui/.env.production

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

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

@ -3,7 +3,7 @@ window.g = {
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
},
prod: {
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
VUE_APP_BASE_API: 'http://192.168.200.200:8011'
}
}

2
acs/nladmin-ui/vue.config.js

@ -19,6 +19,8 @@ module.exports = {
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false,
devServer: {
allowedHosts: ['all'],
disableHostCheck: true,
port: port,
open: false,
overlay: {

Loading…
Cancel
Save