From a2c6ef700007651aac4c024778d9a9f6c4979554 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 14 May 2025 15:35:31 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/nl/acs/agv/rest/AgvController.java | 13 ++++++++ .../acs/agv/server/impl/AgvServiceImpl.java | 32 ++++++++++--------- .../resources/config/application-prod.yml | 2 +- .../src/main/resources/config/application.yml | 2 +- 4 files changed, 32 insertions(+), 17 deletions(-) diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/agv/rest/AgvController.java b/hd/nladmin-system/src/main/java/org/nl/acs/agv/rest/AgvController.java index 1473d7f..5569cb6 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/agv/rest/AgvController.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/agv/rest/AgvController.java @@ -106,4 +106,17 @@ public class AgvController { public ResponseEntity getBlockGroup(@RequestBody JSONObject requestParam) { return new ResponseEntity<>(agvService.getBlockGroup(requestParam), HttpStatus.OK); } + + @PostMapping ("/inBlockGroup") + @Log("请求进入") + @ApiOperation("请求离开") + public ResponseEntity inBlockGroup(@RequestBody JSONObject requestParam) { + return new ResponseEntity<>(agvService.inBlockGroup(requestParam), HttpStatus.OK); + } + @PostMapping ("/outBlockGroup") + @Log("请求离开") + @ApiOperation("请求离开") + public ResponseEntity outBlockGroup(@RequestBody JSONObject requestParam) { + return new ResponseEntity<>(agvService.outBlockGroup(requestParam), HttpStatus.OK); + } } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java b/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java index 14a5405..b3dff83 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java @@ -55,7 +55,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; @Slf4j @Service @@ -2130,9 +2129,10 @@ public class AgvServiceImpl implements AgvService { throw new BadRequestException("请求失败,参数错误!"); } + @Override public JSONObject inBlockGroup(JSONObject requestParam) { - log.info("仙工AGV请求进入互斥组区域,请求参数 - {}", requestParam); + log.info("仙工AGV请求进入自动门区域,请求参数 - {}", requestParam); JSONObject resp = new JSONObject(); //AGV名称 String robot_name = requestParam.getString("robot_name"); @@ -2141,14 +2141,15 @@ public class AgvServiceImpl implements AgvService { if (robot_name == null || block_group_id == null) { resp.put("code", 400); resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); return resp; } + block_group_id = block_group_id.toUpperCase(); Device device = deviceAppService.findDeviceByCode(block_group_id); if (device == null) { resp.put("code", 400); resp.put("message", "请求设备不存在"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); return resp; } if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) { @@ -2157,7 +2158,7 @@ public class AgvServiceImpl implements AgvService { //返回AGV成功 resp.put("code", 200); resp.put("message", "ok"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位允许仙工AGV请求进入自动门区域 请求结果{},此时PLC信号:g:{},a:{},m:{}", resp, grlDeviceDriver.getGDoorStatus(), grlDeviceDriver.getADoorStatus(), grlDeviceDriver.getMiddleStatus()); return resp; } else { //到达固熔炉 @@ -2165,7 +2166,7 @@ public class AgvServiceImpl implements AgvService { //返回AGV失败 resp.put("code", 400); resp.put("message", "安全门未开到位||固熔炉门未开到位||卷扬机未到达中位"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); return resp; } } else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) { @@ -2173,25 +2174,25 @@ public class AgvServiceImpl implements AgvService { if (sxlDeviceDriver.getSDoorStatus() == 1) { resp.put("code", 200); resp.put("message", "ok"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位允许仙工AGV请求进入自动门区域 请求结果{},此时PLC信号:s:{}", resp, sxlDeviceDriver.getSDoorStatus()); return resp; } else { sxlDeviceDriver.writing(1); resp.put("code", 400); resp.put("message", "时效炉门未开到位"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); return resp; } } resp.put("code", 400); resp.put("message", "请求参数有误!"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp); return resp; } @Override public JSONObject outBlockGroup(JSONObject requestParam) { - log.info("仙工AGV请求进入互斥组区域,请求参数 - {}", requestParam); + log.info("仙工AGV请求离开互斥组区域,请求参数 - {}", requestParam); JSONObject resp = new JSONObject(); //AGV名称 String robot_name = requestParam.getString("robot_name"); @@ -2200,14 +2201,15 @@ public class AgvServiceImpl implements AgvService { if (robot_name == null || block_group_id == null) { resp.put("code", 400); resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp); return resp; } + block_group_id = block_group_id.toUpperCase(); Device device = deviceAppService.findDeviceByCode(block_group_id); if (device == null) { resp.put("code", 400); resp.put("message", "请求设备不存在"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp); return resp; } if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) { @@ -2217,7 +2219,7 @@ public class AgvServiceImpl implements AgvService { //返回AGV失败 resp.put("code", 200); resp.put("message", "ok"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位允许仙工AGV请求离开自动门区域 请求结果{}", resp); return resp; } else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) { YqSXLDeviceDriver sxlDeviceDriver = (YqSXLDeviceDriver) device.getDeviceDriver(); @@ -2225,12 +2227,12 @@ public class AgvServiceImpl implements AgvService { sxlDeviceDriver.writing(2); resp.put("code", 200); resp.put("message", "ok"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位允许仙工AGV请求离开自动门区域 请求结果{}", resp); return resp; } resp.put("code", 400); resp.put("message", "请求参数有误!"); - log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp); + log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp); return resp; } diff --git a/hd/nladmin-system/src/main/resources/config/application-prod.yml b/hd/nladmin-system/src/main/resources/config/application-prod.yml index 9cc5214..97cc5ae 100644 --- a/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -10,7 +10,7 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:tg_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} - password: ${DB_PWD:123456} + password: ${DB_PWD:mysql} # 初始连接数 initial-size: 5 # 最小连接数 diff --git a/hd/nladmin-system/src/main/resources/config/application.yml b/hd/nladmin-system/src/main/resources/config/application.yml index c4330d5..6a7d663 100644 --- a/hd/nladmin-system/src/main/resources/config/application.yml +++ b/hd/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev + active: prod jackson: time-zone: GMT+8 data: