Browse Source

京东接口自测优化

master
psh 1 year ago
parent
commit
8028a9d4e0
  1. 2
      acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 4
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  3. 12
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/JDCreateTaskResponse.java
  4. 2
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/JDToAcsController.java
  5. 3
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/JDToAcsService.java
  6. 88
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/JDToAcsServiceImpl.java
  7. 8
      acs/nladmin-system/src/main/resources/config/application-dev.yml
  8. 2
      acs/nladmin-system/src/main/resources/config/application-prod.yml
  9. 2
      acs/nladmin-system/src/main/resources/config/application.yml

2
acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -173,7 +173,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
if (resp.getInteger("code") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms任务执行申请成功,wms允许agv任务执行,已反馈agv任务执行", inst.getInstruction_code());
} else {

4
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -222,7 +222,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
if (resp.getInteger("code") == 200) {
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
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);
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
JSONObject resp = JSONObject.parseObject(httpResponse.body());
if (resp.getInteger("status") == 200) {
if (resp.getInteger("code") == 200) {
// if (resp.getJSONObject("payload").getInteger("status") == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
log.info("指令号:{},acs请求wms放货完成申请成功,wms允许agv放货完成,已反馈agv放货完成", inst.getInstruction_code());

12
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/JDCreateTaskResponse.java

@ -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="操作成功";
}

2
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/JDToAcsController.java

@ -40,7 +40,7 @@ public class JDToAcsController {
@Log(value = "ACS接收WMS任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS)
@ApiOperation("接收WMS任务")
@SaIgnore
public ResponseEntity<Object> createFromWms(@RequestBody List<JDCreateTaskRequest> reqs) {
public ResponseEntity<Object> createFromWms(@RequestBody JDCreateTaskRequest reqs) {
return new ResponseEntity<>(jDtoacsService.crateTask(reqs), HttpStatus.OK);
}

3
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/JDToAcsService.java

@ -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.CreateTaskResponse;
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 java.util.List;
@ -19,7 +20,7 @@ public interface JDToAcsService {
* @param reqs
* @return
*/
CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs);
JDCreateTaskResponse crateTask(JDCreateTaskRequest reqs);
/**

88
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/JDToAcsServiceImpl.java

@ -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.CreateTaskResponse;
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.PutActionRequest;
import org.nl.acs.ext.wms.data.PutActionResponse;
@ -456,19 +457,17 @@ public class JDToAcsServiceImpl implements JDToAcsService {
@Override
public CreateTaskResponse crateTask(List<JDCreateTaskRequest> reqs) {
public JDCreateTaskResponse crateTask(JDCreateTaskRequest reqs) {
try {
MDC.put(log_file_type, log_type);
log.info("crateTask-----输入参数{}", reqs);
CreateTaskResponse response = new CreateTaskResponse();
JDCreateTaskResponse response = new JDCreateTaskResponse();
JSONArray errArr = new JSONArray();
for (int i = 0; i < reqs.size(); i++) {
JDCreateTaskRequest req = reqs.get(i);
String task_code = req.getTaskNo();
String start_device_code = req.getCarryTask().getFromPoint();
String next_device_code = req.getCarryTask().getToTurnPoint();
String priority = req.getPriority();
String vehicle_code = req.getDeviceNo();
String task_code = reqs.getTaskNo();
String start_device_code = reqs.getCarryTask().getFromPoint();
String next_device_code = reqs.getCarryTask().getToPoint();
String priority = reqs.getPriority();
String vehicle_code = reqs.getDeviceNo();
// String vehicle_type = req.getVehicle_type();
String task_type = "1";
// String remark = req.getRemark();
@ -477,25 +476,16 @@ public class JDToAcsServiceImpl implements JDToAcsService {
String start_point_code = "";
String next_point_code = "";
if (StrUtil.isEmpty(task_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", "任务号不能为空");
errArr.add(json);
continue;
response.setMessage("任务号不能为空");
return response;
}
if (StrUtil.isEmpty(start_device_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", "起点不能为空");
errArr.add(json);
continue;
response.setMessage("起点不能为空");
return response;
}
if (StrUtil.isEmpty(next_device_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", "终点不能为空");
errArr.add(json);
continue;
response.setMessage("终点不能为空");
return response;
}
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) {
@ -526,36 +516,24 @@ public class JDToAcsServiceImpl implements JDToAcsService {
}
TaskDto taskDto = taskService.findByCodeFromCache(task_code);
if (taskDto != null) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", "不能存在相同的任务号");
errArr.add(json);
continue;
response.setMessage("不能存在相同的任务号");
return response;
}
if (!StrUtil.isEmpty(vehicle_code)) {
TaskDto vehicle_dto = taskService.findByContainer(vehicle_code);
if (vehicle_dto != null) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", "不能存在相同的托盘号");
errArr.add(json);
continue;
response.setMessage("不能存在相同的托盘号");
return response;
}
}
if (StrUtil.isEmpty(start_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", req.getCarryTask().getFromPoint() + " 该设备号未找到对应点位");
errArr.add(json);
continue;
response.setMessage(reqs.getCarryTask().getFromPoint() + " 该设备号未找到对应点位");
return response;
}
if (StrUtil.isEmpty(next_point_code)) {
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", req.getCarryTask().getToPoint() + " 该设备号未找到对应点位");
errArr.add(json);
continue;
response.setMessage(reqs.getCarryTask().getToPoint() + " 该设备号未找到对应点位");
return response;
}
JSONObject jo = new JSONObject();
@ -579,25 +557,15 @@ public class JDToAcsServiceImpl implements JDToAcsService {
try {
taskService.create(task_dto);
} catch (Exception e) {
// e.printStackTrace();
JSONObject json = new JSONObject();
json.put("task_code", task_code);
json.put("message", e.getMessage());
errArr.add(json);
continue;
log.error("操作失败{}",e,e.getMessage());
response.setMessage("操作失败");
return response;
}
}
if (ObjectUtil.isEmpty(errArr)) {
response.setStatus(200);
response.setMessage("success");
response.setCode(200);
response.setMessage("操作成功");
} else {
response.setStatus(400);
if (ObjectUtil.isNotEmpty(errArr)) {
response.setMessage(errArr.getJSONObject(0).getString("message"));
} else {
response.setMessage("false");
}
response.setErrArr(errArr);
response.setMessage("操作失败");
}
log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response));
return response;

8
acs/nladmin-system/src/main/resources/config/application-dev.yml

@ -12,12 +12,12 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
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: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: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: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
username: ${DB_USER:root}
# password: ${DB_PWD:P@ssw0rd}
# password: ${DB_PWD:Root.123456}
password: ${DB_PWD:password}
password: ${DB_PWD:Root.123456}
# password: ${DB_PWD:password}
# 初始连接数
initial-size: 5

2
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: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}
password: ${DB_PWD:123456}
# 初始连接数

2
acs/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:

Loading…
Cancel
Save