From c0454f6ae21c3faa78d8e2baed84b423c2a7173e Mon Sep 17 00:00:00 2001 From: psh Date: Mon, 25 Dec 2023 17:25:32 +0800 Subject: [PATCH] fix --- .../SiemensConveyorDeviceDriver.java | 4 ++-- .../SiemensConveyorCkkDeviceDriver.java | 4 ++-- .../StandardInspectSiteDeviceDriver.java | 7 ++----- .../fold_disc_site/FoldDiscSiteDeviceDriver.java | 9 +++------ .../nl/acs/ext/wms/service/AcsToWmsService.java | 2 +- .../ext/wms/service/impl/AcsToWmsServiceImpl.java | 15 +++++++++------ .../main/resources/config/application-prod.yml | 2 +- 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index 8e5840d..2dfc6b4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -336,8 +336,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme put("device_code", device_code); }}; - HttpResponse response = acsToWmsService.shipDeviceUpdate(param); - if (response == null || response.getStatus() == 200) { + JSONObject response = acsToWmsService.shipDeviceUpdate(param); + if (response == null || 20000 == response.getIntValue("code")) { this.requiresShipDeviceUpdate = true; } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java index b7f935e..06a7dab 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java @@ -268,8 +268,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl put("device_code", device_code); }}; - HttpResponse response = acsToWmsService.shipDeviceUpdate(param); - if (response == null || response.getStatus() == 200) { + JSONObject response = acsToWmsService.shipDeviceUpdate(param); + if (response == null || 20000 == response.getIntValue("code")) { this.requiresShipDeviceUpdate = true; } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 36fd18e..3229939 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -339,12 +339,9 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp } else { this.instruction_require_time = date; - HttpResponse response = acsToWmsService.shipDeviceUpdate(param); - if (response.getStatus() == HttpStatus.OK.value()) { - JSONObject result = JSONObject.parseObject(response.body()); - if (ObjectUtil.isNotEmpty(result) && result.getIntValue("status") == HttpStatus.OK.value()) { + JSONObject response = acsToWmsService.shipDeviceUpdate(param); + if (20000 == response.getIntValue("code")) { this.requireSucess = true; - } } } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/fold_disc_site/FoldDiscSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/fold_disc_site/FoldDiscSiteDeviceDriver.java index 4eb1410..901cdd6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/fold_disc_site/FoldDiscSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/fold_disc_site/FoldDiscSiteDeviceDriver.java @@ -211,12 +211,9 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements } else { this.instruction_require_time = date; - HttpResponse response = acsToWmsService.shipDeviceUpdate(param); - if (response.getStatus() == HttpStatus.OK.value()) { - JSONObject result = JSONObject.parseObject(response.body()); - if (ObjectUtil.isNotEmpty(result) && result.getIntValue("status") == HttpStatus.OK.value()) { - this.requireSucess = true; - } + JSONObject response = acsToWmsService.shipDeviceUpdate(param); + if (20000 == response.getIntValue("code")) { + this.requireSucess = true; } } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index c02574b..1c31e6d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -105,7 +105,7 @@ public interface AcsToWmsService { UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest updateLKTaskRequest); // 输送线有货变成无货时向lms请求 - HttpResponse shipDeviceUpdate(JSONObject param); + JSONObject shipDeviceUpdate(JSONObject param); /** * 反馈AGV取放货状态 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 fa4ce86..87e21f7 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 @@ -530,7 +530,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } @Override - public HttpResponse shipDeviceUpdate(JSONObject param) { + public JSONObject shipDeviceUpdate(JSONObject param) { try { MDC.put(log_file_type, log_type); if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { @@ -538,12 +538,15 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("shipDeviceUpdate"); String methods_url = addressDto.getMethods_url(); String url = wmsUrl + methods_url; -// log.info("feedAgvTaskStatus - 请求参数 {}", param); - return HttpRequest - .post(url) - .body(param.toString()) + log.info("shipDeviceUpdate - 请求参数 {}", param); + JSONArray ja = new JSONArray(); + ja.add(param); + HttpResponse result=HttpRequest.post(url) + .body(ja.toString()) + .basicAuth("INFOR","Aa123456@@!!") .execute(); -// log.info("feedAgvTaskStatus - 返回参数 {}", response.body()); + log.info("shipDeviceUpdate - 返回参数 {}", result.body()); + return JSONObject.parseObject(result.body()); } } catch (Throwable ignored) { diff --git a/acs/nladmin-system/src/main/resources/config/application-prod.yml b/acs/nladmin-system/src/main/resources/config/application-prod.yml index 626fb26..1145b12 100644 --- a/acs/nladmin-system/src/main/resources/config/application-prod.yml +++ b/acs/nladmin-system/src/main/resources/config/application-prod.yml @@ -11,7 +11,7 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:bjsz_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:bjszacs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} password: ${DB_PWD:123456} # 初始连接数