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 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 groovy.lang.Lazy;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
@ -29,7 +30,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j @Slf4j
@Service //@Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class XianGongAgvServiceImpl implements XianGongAgvService { public class XianGongAgvServiceImpl implements XianGongAgvService {
private final DeviceAppService deviceAppService; 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.AcsConfig;
import org.nl.acs.agv.server.MagicAgvService; import org.nl.acs.agv.server.MagicAgvService;
import org.nl.acs.agv.server.NDCAgvService; 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.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.DeviceService;
@ -992,11 +991,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} else { } else {
flag = true; flag = true;
} }
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3") // } else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")
&& !StrUtil.equals(entity.getSend_status(), "2")) { // && !StrUtil.equals(entity.getSend_status(), "2")) {
XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class); // XianGongAgvService xianGongAgvService = SpringContextHolder.getBean(XianGongAgvService.class);
xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code()); // xianGongAgvService.deleteXZAgvInst(entity.getInstruction_code());
flag = true; // flag = true;
} else { } else {
flag = true; 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 com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
import org.nl.acs.agv.server.XianGongAgvService;
import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.auto.initial.ApplicationAutoInitial;
import org.nl.acs.device.domain.Device; import org.nl.acs.device.domain.Device;
import org.nl.acs.device.enums.DeviceType; import org.nl.acs.device.enums.DeviceType;
@ -101,8 +100,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
TaskFeedbackService taskFeedbackService; TaskFeedbackService taskFeedbackService;
@Autowired @Autowired
ISysParamService paramService; ISysParamService paramService;
@Autowired // @Autowired
XianGongAgvService agvService; // XianGongAgvService agvService;
@Autowired @Autowired
RouteLineService routeLineService; RouteLineService routeLineService;
@Autowired @Autowired
@ -934,14 +933,14 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
} }
} }
// 如果属于先知AGV,关闭运单序列 // // 如果属于先知AGV,关闭运单序列
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { // if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
try { // try {
agvService.markComplete(entity.getTask_code()); // agvService.markComplete(entity.getTask_code());
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
} }
@Override @Override
@ -1006,11 +1005,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
entity.getRoute_plan_code()); entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType(); String type = shortPathsList.get(0).getType();
// != 0 为agv任务 // != 0 为agv任务
if (!StrUtil.equals(type, "0")) { // if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { // if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
agvService.markComplete(entity.getTask_code()); // agvService.markComplete(entity.getTask_code());
} // }
} // }
} }
@Override @Override
@ -1056,11 +1055,11 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
entity.getRoute_plan_code()); entity.getRoute_plan_code());
String type = shortPathsList.get(0).getType(); String type = shortPathsList.get(0).getType();
// != 0 为agv任务 // != 0 为agv任务
if (!StrUtil.equals(type, "0")) { // if (!StrUtil.equals(type, "0")) {
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { // if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
agvService.markComplete(entity.getTask_code()); // agvService.markComplete(entity.getTask_code());
} // }
} // }
} }
@Override @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; 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 @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
FileProperties.ElPath path = properties.getPath(); 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; //package org.nl.config.saconfig;
//
import org.springframework.core.annotation.Order; //import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
import org.springframework.web.cors.CorsConfiguration; //import org.springframework.web.cors.CorsConfiguration;
//
import javax.servlet.*; //import javax.servlet.*;
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; //import javax.servlet.http.HttpServletResponse;
import java.io.IOException; //import java.io.IOException;
//
/** ///**
* 跨域过滤器 // * 跨域过滤器
* @author kong // * @author kong
*/ // */
@Component //@Component
@Order(-200) //@Order(-200)
public class CorsFilter implements Filter { //public class CorsFilter implements Filter {
//
static final String OPTIONS = "OPTIONS"; // static final String OPTIONS = "OPTIONS";
//
@Override // @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) // public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException { // throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req; // HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res; // HttpServletResponse response = (HttpServletResponse) res;
// 允许指定域访问跨域资源 // // 允许指定域访问跨域资源
response.setHeader("Access-Control-Allow-Origin", "*"); // response.setHeader("Access-Control-Allow-Origin", "*");
// 允许所有请求方式 //// // 允许所有请求方式
response.setHeader("Access-Control-Allow-Methods", "*"); //// response.setHeader("Access-Control-Allow-Methods", "*");
// 有效时间 //// // 有效时间
response.setHeader("Access-Control-Max-Age", "3600"); //// response.setHeader("Access-Control-Max-Age", "3600");
// 允许的header参数 //// // 允许的header参数
response.setHeader("Access-Control-Allow-Headers", "*"); //// response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Allow-Credentials", "true"); // response.setHeader("Access-Control-Allow-Credentials", "true");
//
// 如果是预检请求,直接返回 // // 如果是预检请求,直接返回
if (OPTIONS.equals(request.getMethod())) { // if (OPTIONS.equals(request.getMethod())) {
System.out.println("=======================浏览器发来了OPTIONS预检请求=========="); // System.out.println("=======================浏览器发来了OPTIONS预检请求==========");
response.getWriter().print(""); // response.getWriter().print("");
return; // return;
} // }
//
// System.out.println("*********************************过滤器被使用**************************"); // // System.out.println("*********************************过滤器被使用**************************");
chain.doFilter(req, res); // chain.doFilter(req, res);
} // }
//
@Override // @Override
public void init(FilterConfig filterConfig) { // public void init(FilterConfig filterConfig) {
} // }
//
@Override // @Override
public void destroy() { // public void destroy() {
} // }
//
} //}

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://47.97.157.227:8011' VUE_APP_BASE_API = 'http://192.168.200.200:8011'
# 如果接口是 http 形式, wss 需要改为 ws # 如果接口是 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' VUE_APP_BASE_API: 'http://127.0.0.1:8011'
}, },
prod: { 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', lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false, productionSourceMap: false,
devServer: { devServer: {
allowedHosts: ['all'],
disableHostCheck: true,
port: port, port: port,
open: false, open: false,
overlay: { overlay: {

Loading…
Cancel
Save