rev:优化
This commit is contained in:
@@ -109,7 +109,7 @@ public class AgvController {
|
||||
|
||||
@PostMapping ("/inBlockGroup")
|
||||
@Log("请求进入")
|
||||
@ApiOperation("请求离开")
|
||||
@ApiOperation("请求进入")
|
||||
public ResponseEntity<JSONObject> inBlockGroup(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(agvService.inBlockGroup(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -215,4 +215,23 @@ public interface AgvService {
|
||||
* @return
|
||||
*/
|
||||
JSONObject outBlockGroup(JSONObject requestParam);
|
||||
|
||||
|
||||
/**
|
||||
* 仙工AGV暂停
|
||||
*
|
||||
* @param requestParam
|
||||
* @return
|
||||
*/
|
||||
HttpResponse gotoSitePause(JSONObject requestParam);
|
||||
|
||||
/**
|
||||
* 仙工AGV恢复
|
||||
*
|
||||
* @param requestParam
|
||||
* @return
|
||||
*/
|
||||
HttpResponse gotoSiteResume(JSONObject requestParam);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
@@ -2172,6 +2173,48 @@ public class AgvServiceImpl implements AgvService {
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse gotoSitePause(JSONObject requestParam) {
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/gotoSitePause";
|
||||
log.info("暂停{} agv请求:{}", requestParam, agvurl);
|
||||
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(JSON.toJSONString(requestParam))
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("暂停{} agv请求反馈:{}", requestParam, result);
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse gotoSiteResume(JSONObject requestParam) {
|
||||
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) {
|
||||
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL);
|
||||
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT);
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/gotoSiteResume";
|
||||
log.info("恢复{} agv请求:{}", requestParam, agvurl);
|
||||
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
.body(JSON.toJSONString(requestParam))
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("恢复{} agv请求反馈:{}", result, result);
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String hexToString(int i) {
|
||||
return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase();
|
||||
|
||||
@@ -26,4 +26,21 @@ public class XGToAcsController {
|
||||
public ResponseEntity<JSONObject> xgAGVQueryWlsStatus(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(XGToAcsService.xgAGVQueryWlsStatus(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping ("/api/agv/start")
|
||||
@Log("恢复AGV")
|
||||
@ApiOperation("恢复AGV")
|
||||
public ResponseEntity<JSONObject> start(@RequestBody JSONObject requestParam) {
|
||||
XGToAcsService.start(requestParam);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping ("/api/agv/stop")
|
||||
@Log("暂停AGV")
|
||||
@ApiOperation("暂停AGV")
|
||||
public ResponseEntity<JSONObject> stop(@RequestBody JSONObject requestParam) {
|
||||
XGToAcsService.stop(requestParam);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,8 @@ public interface XGToAcsService {
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public JSONObject xgAGVQueryWlsStatus(JSONObject from);
|
||||
|
||||
void start(JSONObject requestParam);
|
||||
|
||||
void stop(JSONObject requestParam);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.nl.acs.agv.server.AgvService;
|
||||
import org.nl.acs.config.server.AcsConfigService;
|
||||
import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.XGToAcsService;
|
||||
import org.nl.acs.log.service.LogServer;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -28,6 +31,10 @@ public class XGToAcsImpl implements XGToAcsService {
|
||||
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService;
|
||||
|
||||
@Autowired
|
||||
private AgvService agvService;
|
||||
|
||||
@Override
|
||||
public JSONObject xgAGVQueryWlsStatus(JSONObject from) {
|
||||
JSONArray datas = JSONArray.fromObject(from);
|
||||
@@ -51,5 +58,17 @@ public class XGToAcsImpl implements XGToAcsService {
|
||||
log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString());
|
||||
return resultJson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(JSONObject requestParam) {
|
||||
requestParam.put("vehicles", new JSONArray());
|
||||
agvService.gotoSiteResume(requestParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(JSONObject requestParam) {
|
||||
requestParam.put("vehicles", new JSONArray());
|
||||
agvService.gotoSitePause(requestParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ 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: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:3307}/${DB_NAME:yq_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:mysql}
|
||||
password: ${DB_PWD:123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
|
||||
Reference in New Issue
Block a user