diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index 52accec..73e5caf 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/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; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 32d0498..fa85b8d 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/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 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 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 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 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 diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/ConfigurerAdapter.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/ConfigurerAdapter.java index d9aa6eb..7bb4cb3 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/ConfigurerAdapter.java +++ b/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(); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/saconfig/CorsFilter.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/saconfig/CorsFilter.java index cc2e734..bf456a6 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/config/saconfig/CorsFilter.java +++ b/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() { +// } +// +//} diff --git a/acs/nladmin-ui/.env.production b/acs/nladmin-ui/.env.production index 25a073f..d1a7df8 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://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' diff --git a/acs/nladmin-ui/public/config.js b/acs/nladmin-ui/public/config.js index ce71425..d1a0402 100644 --- a/acs/nladmin-ui/public/config.js +++ b/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' } } diff --git a/acs/nladmin-ui/vue.config.js b/acs/nladmin-ui/vue.config.js index a881ad5..a319591 100644 --- a/acs/nladmin-ui/vue.config.js +++ b/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: {