京东接口自测优化
This commit is contained in:
@@ -173,7 +173,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
|||||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||||
if (resp.getInteger("status") == 200) {
|
if (resp.getInteger("code") == 200) {
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
log.info("指令号:{},acs请求wms任务执行申请成功,wms允许agv任务执行,已反馈agv任务执行", inst.getInstruction_code());
|
log.info("指令号:{},acs请求wms任务执行申请成功,wms允许agv任务执行,已反馈agv任务执行", inst.getInstruction_code());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||||
if (resp.getInteger("status") == 200) {
|
if (resp.getInteger("code") == 200) {
|
||||||
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
|
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
log.info("指令号:{},acs反馈wms取货完成离开成功,wms允许agv取货完成离开,已反馈agv取货完成离开", inst.getInstruction_code());
|
log.info("指令号:{},acs反馈wms取货完成离开成功,wms允许agv取货完成离开,已反馈agv取货完成离开", inst.getInstruction_code());
|
||||||
@@ -320,7 +320,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
|
||||||
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
|
||||||
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
JSONObject resp = JSONObject.parseObject(httpResponse.body());
|
||||||
if (resp.getInteger("status") == 200) {
|
if (resp.getInteger("code") == 200) {
|
||||||
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
|
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
|
||||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||||
log.info("指令号:{},acs请求wms放货完成申请成功,wms允许agv放货完成,已反馈agv放货完成", inst.getInstruction_code());
|
log.info("指令号:{},acs请求wms放货完成申请成功,wms允许agv放货完成,已反馈agv放货完成", inst.getInstruction_code());
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package org.nl.acs.ext.wms.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class JDCreateTaskResponse {
|
||||||
|
|
||||||
|
private Integer code = 400;
|
||||||
|
private String result="false";
|
||||||
|
private String message="操作成功";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ public class JDToAcsController {
|
|||||||
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
|
||||||
@ApiOperation("接收WMS任务")
|
@ApiOperation("接收WMS任务")
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
public ResponseEntity<Object> createFromWms(@RequestBody List<JDCreateTaskRequest> reqs) {
|
public ResponseEntity<Object> createFromWms(@RequestBody JDCreateTaskRequest reqs) {
|
||||||
return new ResponseEntity<>(jDtoacsService.crateTask(reqs), HttpStatus.OK);
|
return new ResponseEntity<>(jDtoacsService.crateTask(reqs), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.nl.acs.ext.wms.data.CancelTaskResponse;
|
|||||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||||
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||||
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.JDCreateTaskResponse;
|
||||||
import org.nl.acs.ext.wms.data.PutActionResponse;
|
import org.nl.acs.ext.wms.data.PutActionResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -19,7 +20,7 @@ public interface JDToAcsService {
|
|||||||
* @param reqs
|
* @param reqs
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs);
|
JDCreateTaskResponse crateTask(JDCreateTaskRequest reqs);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import org.nl.acs.ext.wms.data.CancelTaskResponse;
|
|||||||
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
import org.nl.acs.ext.wms.data.CreateTaskRequest;
|
||||||
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
import org.nl.acs.ext.wms.data.CreateTaskResponse;
|
||||||
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
import org.nl.acs.ext.wms.data.JDCreateTaskRequest;
|
||||||
|
import org.nl.acs.ext.wms.data.JDCreateTaskResponse;
|
||||||
import org.nl.acs.ext.wms.data.JsonUtl;
|
import org.nl.acs.ext.wms.data.JsonUtl;
|
||||||
import org.nl.acs.ext.wms.data.PutActionRequest;
|
import org.nl.acs.ext.wms.data.PutActionRequest;
|
||||||
import org.nl.acs.ext.wms.data.PutActionResponse;
|
import org.nl.acs.ext.wms.data.PutActionResponse;
|
||||||
@@ -456,19 +457,17 @@ public class JDToAcsServiceImpl implements JDToAcsService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs) {
|
public JDCreateTaskResponse crateTask(JDCreateTaskRequest reqs) {
|
||||||
try {
|
try {
|
||||||
MDC.put(log_file_type, log_type);
|
MDC.put(log_file_type, log_type);
|
||||||
log.info("crateTask-----输入参数{}", reqs);
|
log.info("crateTask-----输入参数{}", reqs);
|
||||||
CreateTaskResponse response = new CreateTaskResponse();
|
JDCreateTaskResponse response = new JDCreateTaskResponse();
|
||||||
JSONArray errArr = new JSONArray();
|
JSONArray errArr = new JSONArray();
|
||||||
for (int i = 0; i < reqs.size(); i++) {
|
String task_code = reqs.getTaskNo();
|
||||||
JDCreateTaskRequest req = reqs.get(i);
|
String start_device_code = reqs.getCarryTask().getFromPoint();
|
||||||
String task_code = req.getTaskNo();
|
String next_device_code = reqs.getCarryTask().getToPoint();
|
||||||
String start_device_code = req.getCarryTask().getFromPoint();
|
String priority = reqs.getPriority();
|
||||||
String next_device_code = req.getCarryTask().getToTurnPoint();
|
String vehicle_code = reqs.getDeviceNo();
|
||||||
String priority = req.getPriority();
|
|
||||||
String vehicle_code = req.getDeviceNo();
|
|
||||||
// String vehicle_type = req.getVehicle_type();
|
// String vehicle_type = req.getVehicle_type();
|
||||||
String task_type = "1";
|
String task_type = "1";
|
||||||
// String remark = req.getRemark();
|
// String remark = req.getRemark();
|
||||||
@@ -477,25 +476,16 @@ public class JDToAcsServiceImpl implements JDToAcsService {
|
|||||||
String start_point_code = "";
|
String start_point_code = "";
|
||||||
String next_point_code = "";
|
String next_point_code = "";
|
||||||
if (StrUtil.isEmpty(task_code)) {
|
if (StrUtil.isEmpty(task_code)) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage("任务号不能为空");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", "任务号不能为空");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(start_device_code)) {
|
if (StrUtil.isEmpty(start_device_code)) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage("起点不能为空");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", "起点不能为空");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(next_device_code)) {
|
if (StrUtil.isEmpty(next_device_code)) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage("终点不能为空");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", "终点不能为空");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
|
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
|
||||||
if (!ObjectUtil.isEmpty(start_device_json)) {
|
if (!ObjectUtil.isEmpty(start_device_json)) {
|
||||||
@@ -526,36 +516,24 @@ public class JDToAcsServiceImpl implements JDToAcsService {
|
|||||||
}
|
}
|
||||||
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
|
||||||
if (taskDto != null) {
|
if (taskDto != null) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage("不能存在相同的任务号");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", "不能存在相同的任务号");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (!StrUtil.isEmpty(vehicle_code)) {
|
if (!StrUtil.isEmpty(vehicle_code)) {
|
||||||
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
|
||||||
if (vehicle_dto != null) {
|
if (vehicle_dto != null) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage("不能存在相同的托盘号");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", "不能存在相同的托盘号");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isEmpty(start_point_code)) {
|
if (StrUtil.isEmpty(start_point_code)) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage(reqs.getCarryTask().getFromPoint() + " 该设备号未找到对应点位");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", req.getCarryTask().getFromPoint() + " 该设备号未找到对应点位");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isEmpty(next_point_code)) {
|
if (StrUtil.isEmpty(next_point_code)) {
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage(reqs.getCarryTask().getToPoint() + " 该设备号未找到对应点位");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", req.getCarryTask().getToPoint() + " 该设备号未找到对应点位");
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JSONObject jo = new JSONObject();
|
JSONObject jo = new JSONObject();
|
||||||
@@ -579,25 +557,15 @@ public class JDToAcsServiceImpl implements JDToAcsService {
|
|||||||
try {
|
try {
|
||||||
taskService.create(task_dto);
|
taskService.create(task_dto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
log.error("操作失败{}",e,e.getMessage());
|
||||||
JSONObject json = new JSONObject();
|
response.setMessage("操作失败");
|
||||||
json.put("task_code", task_code);
|
return response;
|
||||||
json.put("message", e.getMessage());
|
|
||||||
errArr.add(json);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (ObjectUtil.isEmpty(errArr)) {
|
if (ObjectUtil.isEmpty(errArr)) {
|
||||||
response.setStatus(200);
|
response.setCode(200);
|
||||||
response.setMessage("success");
|
response.setMessage("操作成功");
|
||||||
} else {
|
} else {
|
||||||
response.setStatus(400);
|
response.setMessage("操作失败");
|
||||||
if (ObjectUtil.isNotEmpty(errArr)) {
|
|
||||||
response.setMessage(errArr.getJSONObject(0).getString("message"));
|
|
||||||
} else {
|
|
||||||
response.setMessage("false");
|
|
||||||
}
|
|
||||||
response.setErrArr(errArr);
|
|
||||||
}
|
}
|
||||||
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ spring:
|
|||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
# url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:shiyaozhongchen_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:wzgj_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:wzgj_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
# password: ${DB_PWD:P@ssw0rd}
|
# password: ${DB_PWD:P@ssw0rd}
|
||||||
# password: ${DB_PWD:Root.123456}
|
password: ${DB_PWD:Root.123456}
|
||||||
password: ${DB_PWD:password}
|
# password: ${DB_PWD:password}
|
||||||
|
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||||
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:wzgj_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:syzc_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||||
username: ${DB_USER:root}
|
username: ${DB_USER:root}
|
||||||
password: ${DB_PWD:123456}
|
password: ${DB_PWD:123456}
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
|
|||||||
@@ -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