更新
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -51,67 +52,44 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyTaskToWms");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
log.info("applyTaskToWms-----请求参数{}", jo.toString());
|
||||
HttpResponse result2 = null;
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(jo), "开始请求~");
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
HttpResponse result = HttpRequest.post(url)
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(jo))
|
||||
.execute();
|
||||
System.out.println(result2);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(jo), jsonObject.getString("status"), jsonObject.getString("message"));
|
||||
return result.body();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(jo), "400", e.getMessage());
|
||||
JSONObject resp = new JSONObject();
|
||||
resp.put("status", "400");
|
||||
resp.put("message", e.getMessage());
|
||||
return JSON.toJSONString(resp);
|
||||
}
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
log.info("applyTaskToWms-----输出参数{}", result2.body());
|
||||
return result2.body();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedbackTaskStatusToWms(JSONArray data) {
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
|
||||
String task_code = "";
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject json = (JSONObject) data.get(i);
|
||||
task_code = json.getString("task_code");
|
||||
}
|
||||
TaskDto taskDto = taskService.findByCode(task_code);
|
||||
String vehicle_code = taskDto.getVehicle_code();
|
||||
|
||||
HttpResponse result2 = null;
|
||||
log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString());
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsurl + methods_url;
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(data), "开始请求~");
|
||||
HttpResponse result = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(wmsurl + methods_url)
|
||||
.header("Authorization", token).body(String.valueOf(data))
|
||||
result = HttpRequest.post(url)
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(data))
|
||||
.execute();
|
||||
System.out.println(result2);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(data), jsonObject.getString("status"), jsonObject.getString("message"));
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(data), "400", e.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
|
||||
JSONObject jo = JSONObject.parseObject(result2.body());
|
||||
log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString());
|
||||
return result2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,13 +99,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
String url = wmsurl + methods_url;
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_uuid", jsonObject.get("device_code"));
|
||||
json.put("task_code", jsonObject.get("point_status"));
|
||||
json.put("task_status", jsonObject.get("point_mode"));
|
||||
json.put("point_error", jsonObject.get("point_error"));
|
||||
log.info("feedbackPointStatusToWms----请求参数{}", json.toString());
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(json), "开始请求~");
|
||||
try {
|
||||
String result2 = HttpRequest.post(url)
|
||||
.body(String.valueOf(json))
|
||||
@@ -155,6 +132,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsurl + methods_url;
|
||||
String result = "";
|
||||
logServer.acsToLms("acsToLms", url, null, "开始请求~");
|
||||
try {
|
||||
result = HttpRequest.get(url)
|
||||
.execute().body();
|
||||
@@ -180,20 +158,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsurl + methods_url;
|
||||
HttpResponse result = null;
|
||||
log.info("requestSignalInteraction----请求参数{}", json.toString());
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(json), "开始请求~");
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(json))
|
||||
.execute();
|
||||
System.out.println(result);
|
||||
log.info("requestSignalInteraction----返回参数{}", result);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(json), jsonObject.getString("status"), jsonObject.getString("message"));
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(json), "400", e.getMessage());
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,25 +179,23 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address));
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_id", task_id);
|
||||
String result2 = null;
|
||||
String result = null;
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("requestTaskAgain");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsurl + methods_url;
|
||||
log.info("requestTaskAgain----请求参数{}", jo);
|
||||
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(jo), "开始请求~");
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
result = HttpRequest.post(url)
|
||||
.body(String.valueOf(jo))
|
||||
.execute().body();
|
||||
System.out.println(result2);
|
||||
log.info("requestTaskAgain----返回参数{}", result2);
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(jo), jsonObject.getString("status"), jsonObject.getString("message"));
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
//网络不通
|
||||
System.out.println(msg);
|
||||
logServer.acsToLms("acsToLms", url, String.valueOf(jo), "400", e.getMessage());
|
||||
return result;
|
||||
}
|
||||
return result2;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,4 +20,10 @@ public interface DeviceExecuteLogService {
|
||||
* @param message 日志信息
|
||||
*/
|
||||
void deviceExecuteLog(String device_code, String vehicle_code, String inst_code, String message);
|
||||
|
||||
void acsToLms(String title, String requestUrl, String requestParam, String responseCode, String responseMessage);
|
||||
|
||||
void acsToLms(String title,String requestUrl,String requestParam,String result);
|
||||
|
||||
void lmsToAcs(String title, String requestType, String requestParam);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.acs.log.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
@@ -36,6 +37,40 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService {
|
||||
MDC.remove("device_code_log");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acsToLms(String title, String requestUrl, String requestParam, String responseCode, String responseMessage) {
|
||||
try {
|
||||
MDC.put("device_code_log", title);
|
||||
if (!StrUtil.equals(responseCode + "", "200")) {
|
||||
log.error("日志标题:{},请求路径:{},请求参数:{},响应编码:{},响应消息:{}", title, requestUrl, requestParam, responseCode, responseMessage);
|
||||
} else {
|
||||
log.info("日志标题:{},请求路径:{},请求参数:{},响应编码:{},响应消息:{}", title, requestUrl, requestParam, responseCode, responseMessage);
|
||||
}
|
||||
} finally {
|
||||
MDC.remove("device_code_log");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acsToLms(String title, String requestUrl, String requestParam, String result) {
|
||||
try {
|
||||
MDC.put("device_code_log", title);
|
||||
log.info("日志主题:{},请求路径:{},请求参数:{},请求结果:{}", title, requestUrl, requestParam, result);
|
||||
} finally {
|
||||
MDC.remove("device_code_log");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lmsToAcs(String title, String requestType, String requestParam) {
|
||||
try {
|
||||
MDC.put("device_code_log", title);
|
||||
log.info("日志主题:{},请求类型:{},请求参数:{}", title, requestType, requestParam);
|
||||
} finally {
|
||||
MDC.remove("device_code_log");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class QueryOneZDAgvTaskStatus {
|
||||
JSONObject inst_jo = inst_rows.getJSONObject(i);
|
||||
String inst_code = inst_jo.getString("task_code");
|
||||
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||
if (ObjectUtil.isEmpty(inst)){
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
continue;
|
||||
}
|
||||
//反馈结果状态
|
||||
@@ -88,7 +88,7 @@ public class QueryOneZDAgvTaskStatus {
|
||||
String device = jo.getString("locationName");
|
||||
for (int k = 0; k < pro_rows.size(); k++) {
|
||||
JSONObject item = pro_rows.getJSONObject(k);
|
||||
if ("True".equals(item.get("value"))) {
|
||||
if ("true".equals(item.get("value"))) {
|
||||
String param = item.get("key").toString();
|
||||
//EntryRequired是否进入前等待 PauseOnStation是否离开等待 Wait在该点进行等待
|
||||
agvService.process(inst_code, param, device, operation, vehicle);
|
||||
@@ -96,7 +96,7 @@ public class QueryOneZDAgvTaskStatus {
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user