fix: 日志优化,任务指令异步

This commit is contained in:
2024-07-09 08:50:30 +08:00
parent da4d4c0352
commit 486a7708b1
6 changed files with 17 additions and 5 deletions

View File

@@ -171,7 +171,7 @@ public class AgvWaitUtil {
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("请求lms追加动诺宝作块失败,返回参数:" + jo.getString("body"))
.content("请求lms追加动诺宝作块失败,返回参数:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -979,7 +979,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
} else {
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(instructionDto.getCarno())
.content("二次分配请求lms,返回参数:" + jo.getString("body"))
.content("二次分配请求lms,返回参数:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -409,7 +409,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
message = "二楼到一楼输送线申请行架任务报错,返回参数:" + jo;
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo.getString("body"))
.content("二楼到一楼输送线申请行架任务,返回参数:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -430,7 +430,7 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
message = "申请贴标报错,接口返回:" + jo;
LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请贴标失败,接口返回:" + jo.getString("body"))
.content("申请贴标失败,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto2);

View File

@@ -35,6 +35,7 @@ import org.nl.system.service.param.ISysParamService;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Map;
@@ -323,6 +324,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
@Override
@Async
public HttpResponse feedTaskStatus(JSONArray data) {
//feedTaskStatus
try {

View File

@@ -66,6 +66,7 @@ import org.nl.common.utils.CodeUtil;
import org.nl.config.SpringContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@@ -74,6 +75,7 @@ import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -803,7 +805,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
//向缓存添加任务信息
this.addTaskToCache(dto);
//反馈上位系统任务状态
this.feedWmsTaskStatus(entity);
CompletableFuture.runAsync(() -> {
// 异步更新指令状态
try {
this.feedWmsTaskStatus(entity);
} catch (Exception e) {
e.printStackTrace();
}
});
}
@Override