add:接口
This commit is contained in:
@@ -106,4 +106,17 @@ public class AgvController {
|
|||||||
public ResponseEntity<JSONObject> getBlockGroup(@RequestBody JSONObject requestParam) {
|
public ResponseEntity<JSONObject> getBlockGroup(@RequestBody JSONObject requestParam) {
|
||||||
return new ResponseEntity<>(agvService.getBlockGroup(requestParam), HttpStatus.OK);
|
return new ResponseEntity<>(agvService.getBlockGroup(requestParam), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping ("/inBlockGroup")
|
||||||
|
@Log("请求进入")
|
||||||
|
@ApiOperation("请求离开")
|
||||||
|
public ResponseEntity<JSONObject> inBlockGroup(@RequestBody JSONObject requestParam) {
|
||||||
|
return new ResponseEntity<>(agvService.inBlockGroup(requestParam), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
@PostMapping ("/outBlockGroup")
|
||||||
|
@Log("请求离开")
|
||||||
|
@ApiOperation("请求离开")
|
||||||
|
public ResponseEntity<JSONObject> outBlockGroup(@RequestBody JSONObject requestParam) {
|
||||||
|
return new ResponseEntity<>(agvService.outBlockGroup(requestParam), HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ import java.text.DateFormat;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@@ -2130,9 +2129,10 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
throw new BadRequestException("请求失败,参数错误!");
|
throw new BadRequestException("请求失败,参数错误!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject inBlockGroup(JSONObject requestParam) {
|
public JSONObject inBlockGroup(JSONObject requestParam) {
|
||||||
log.info("仙工AGV请求进入互斥组区域,请求参数 - {}", requestParam);
|
log.info("仙工AGV请求进入自动门区域,请求参数 - {}", requestParam);
|
||||||
JSONObject resp = new JSONObject();
|
JSONObject resp = new JSONObject();
|
||||||
//AGV名称
|
//AGV名称
|
||||||
String robot_name = requestParam.getString("robot_name");
|
String robot_name = requestParam.getString("robot_name");
|
||||||
@@ -2141,14 +2141,15 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
if (robot_name == null || block_group_id == null) {
|
if (robot_name == null || block_group_id == null) {
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失");
|
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
block_group_id = block_group_id.toUpperCase();
|
||||||
Device device = deviceAppService.findDeviceByCode(block_group_id);
|
Device device = deviceAppService.findDeviceByCode(block_group_id);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "请求设备不存在");
|
resp.put("message", "请求设备不存在");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) {
|
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) {
|
||||||
@@ -2157,7 +2158,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
//返回AGV成功
|
//返回AGV成功
|
||||||
resp.put("code", 200);
|
resp.put("code", 200);
|
||||||
resp.put("message", "ok");
|
resp.put("message", "ok");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位允许仙工AGV请求进入自动门区域 请求结果{},此时PLC信号:g:{},a:{},m:{}", resp, grlDeviceDriver.getGDoorStatus(), grlDeviceDriver.getADoorStatus(), grlDeviceDriver.getMiddleStatus());
|
||||||
return resp;
|
return resp;
|
||||||
} else {
|
} else {
|
||||||
//到达固熔炉
|
//到达固熔炉
|
||||||
@@ -2165,7 +2166,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
//返回AGV失败
|
//返回AGV失败
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "安全门未开到位||固熔炉门未开到位||卷扬机未到达中位");
|
resp.put("message", "安全门未开到位||固熔炉门未开到位||卷扬机未到达中位");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) {
|
||||||
@@ -2173,25 +2174,25 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
if (sxlDeviceDriver.getSDoorStatus() == 1) {
|
if (sxlDeviceDriver.getSDoorStatus() == 1) {
|
||||||
resp.put("code", 200);
|
resp.put("code", 200);
|
||||||
resp.put("message", "ok");
|
resp.put("message", "ok");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位允许仙工AGV请求进入自动门区域 请求结果{},此时PLC信号:s:{}", resp, sxlDeviceDriver.getSDoorStatus());
|
||||||
return resp;
|
return resp;
|
||||||
} else {
|
} else {
|
||||||
sxlDeviceDriver.writing(1);
|
sxlDeviceDriver.writing(1);
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "时效炉门未开到位");
|
resp.put("message", "时效炉门未开到位");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "请求参数有误!");
|
resp.put("message", "请求参数有误!");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求进入自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject outBlockGroup(JSONObject requestParam) {
|
public JSONObject outBlockGroup(JSONObject requestParam) {
|
||||||
log.info("仙工AGV请求进入互斥组区域,请求参数 - {}", requestParam);
|
log.info("仙工AGV请求离开互斥组区域,请求参数 - {}", requestParam);
|
||||||
JSONObject resp = new JSONObject();
|
JSONObject resp = new JSONObject();
|
||||||
//AGV名称
|
//AGV名称
|
||||||
String robot_name = requestParam.getString("robot_name");
|
String robot_name = requestParam.getString("robot_name");
|
||||||
@@ -2200,14 +2201,15 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
if (robot_name == null || block_group_id == null) {
|
if (robot_name == null || block_group_id == null) {
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失");
|
resp.put("message", "请求参数不完整: robot_name 或 block_group_id缺失");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
block_group_id = block_group_id.toUpperCase();
|
||||||
Device device = deviceAppService.findDeviceByCode(block_group_id);
|
Device device = deviceAppService.findDeviceByCode(block_group_id);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "请求设备不存在");
|
resp.put("message", "请求设备不存在");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) {
|
if (device.getDeviceDriver() instanceof YqGRLDeviceDriver) {
|
||||||
@@ -2217,7 +2219,7 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
//返回AGV失败
|
//返回AGV失败
|
||||||
resp.put("code", 200);
|
resp.put("code", 200);
|
||||||
resp.put("message", "ok");
|
resp.put("message", "ok");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位允许仙工AGV请求离开自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) {
|
} else if (device.getDeviceDriver() instanceof YqSXLDeviceDriver) {
|
||||||
YqSXLDeviceDriver sxlDeviceDriver = (YqSXLDeviceDriver) device.getDeviceDriver();
|
YqSXLDeviceDriver sxlDeviceDriver = (YqSXLDeviceDriver) device.getDeviceDriver();
|
||||||
@@ -2225,12 +2227,12 @@ public class AgvServiceImpl implements AgvService {
|
|||||||
sxlDeviceDriver.writing(2);
|
sxlDeviceDriver.writing(2);
|
||||||
resp.put("code", 200);
|
resp.put("code", 200);
|
||||||
resp.put("message", "ok");
|
resp.put("message", "ok");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位允许仙工AGV请求离开自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
resp.put("code", 400);
|
resp.put("code", 400);
|
||||||
resp.put("message", "请求参数有误!");
|
resp.put("message", "请求参数有误!");
|
||||||
log.info("上位允许仙工AGV请求进入管制区域 请求结果{}", resp);
|
log.info("上位不允许仙工AGV请求离开自动门区域 请求结果{}", resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ spring:
|
|||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
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
|
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}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:123456}
|
password: ${DB_PWD:mysql}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
# 最小连接数
|
# 最小连接数
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ spring:
|
|||||||
freemarker:
|
freemarker:
|
||||||
check-template-location: false
|
check-template-location: false
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: prod
|
||||||
jackson:
|
jackson:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
data:
|
data:
|
||||||
|
|||||||
Reference in New Issue
Block a user