diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index e80392e3c..b067a5911 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -236,6 +236,13 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe this.setApplySucess(false); message = null; } + JSONObject param = new JSONObject(); + param.put("device_code", this.device_code); + param.put("mode", Math.min(mode, 3)); + param.put("device_name", this.getDevice().getDevice_name()); + param.put("device_type", "1"); + param.put("product_area", paramService.findByCode("productArea").getValue()); + acsToWmsService.sendDeviceStatus(param); } if (move != last_move) { if (move == 0) { @@ -254,6 +261,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); deviceErrorLogService.create(dto); } + JSONObject param = new JSONObject(); + param.put("device_code", this.device_code); + param.put("error", error); + param.put("error_msg", error == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error))); + param.put("device_name", this.getDevice().getDevice_name()); + param.put("device_type", "1"); + param.put("product_area", paramService.findByCode("productArea").getValue()); + acsToWmsService.sendDeviceStatus(param); + logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); } if (plcbarcode_length != last_plcbarcode_length) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index e0659ac70..69a717c7f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -549,12 +549,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("sendDeviceStatus"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; -// log.info("sendDeviceStatus - 请求参数 {}", param); - HttpRequest + log.info("sendDeviceStatus - 请求参数 {}", param); + HttpResponse response = HttpRequest .post(url) .body(param.toString()) .execute(); -// log.info("sendDeviceStatus - 返回参数 {}", response.body()); + log.info("sendDeviceStatus - 返回参数 {}", response.body()); } } catch (Throwable ignored) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index 3e62a2568..3083c1366 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -4,9 +4,11 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.udw.UnifiedDataAccessor; import org.nl.acs.udw.UnifiedDataAccessorFactory; import org.nl.acs.udw.UnifiedDataAppService; +import org.nl.modules.wql.util.SpringContextHolder; import org.openscada.opc.lib.da.*; import java.util.*; @@ -25,6 +27,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC private int all_null; private Map itemSearchCache; + public DeviceOpcProtocolRunable() { this.error_num = 0; this.all_null = 0; @@ -80,6 +83,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC private void runOld() { + OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerService .class); while (true) { start: try { @@ -93,9 +97,10 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC log.trace("清理server..."); } - this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); - this.server.addStateListener(this); - group = this.server.addGroup(); + group =opcServerService.getServer(this.getOpcServer().getOpc_code()); +// this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); +// this.server.addStateListener(this); +// group = this.server.addGroup(); List itemsString = new ArrayList(); Iterator var3 = this.protocols.iterator(); diff --git a/acs/nladmin-ui/.env.development b/acs/nladmin-ui/.env.development index 809e77ff1..e37a9a4f0 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 9be6cbabb..2c75e4bb6 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://10.1.3.94:8011' # 如果接口是 http 形式, wss 需要改为 ws -VUE_APP_WS_API = 'ws://10.1.3.90:8011' +VUE_APP_WS_API = 'ws://10.1.3.94:8011' diff --git a/acs/nladmin-ui/public/config.js b/acs/nladmin-ui/public/config.js index c4d32ea74..21bbded15 100644 --- a/acs/nladmin-ui/public/config.js +++ b/acs/nladmin-ui/public/config.js @@ -1,9 +1,9 @@ window.g = { dev: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' + VUE_APP_BASE_API: 'http://127.0.0.1:8011' }, prod: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' + VUE_APP_BASE_API: 'http://127.0.0.1:8011' }