This commit is contained in:
USER-20220102CG\noblelift
2023-09-10 17:31:42 +08:00
parent a8874188cb
commit c593bd74f0
6 changed files with 127 additions and 42 deletions

View File

@@ -771,7 +771,6 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName());
request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName()));
request.setWeight(String.valueOf(weight));
request.setVehicle_code(String.valueOf(barcode));
ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class);
message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS...";
lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request)));

View File

@@ -51,6 +51,8 @@ import org.nl.acs.route.service.dto.RouteLineDto;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.lucene.service.LuceneExecuteLogService;
import org.nl.modules.lucene.service.dto.LuceneLogDto;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.core.bean.WQLObject;
@@ -68,6 +70,7 @@ import java.util.Map;
@Slf4j
public class WmsToAcsServiceImpl implements WmsToAcsService {
private final LuceneExecuteLogService lucene;
private final InstructionService InstructionService;
private final TaskService TaskService;
private final DeviceService DeviceService;
@@ -85,7 +88,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
CreateTaskRequest tasks = JSON.toJavaObject(req, CreateTaskRequest.class);
JSONObject resultJson = new JSONObject();
CreateTaskResponse resp = new CreateTaskResponse();
log.info("createFromWms - 请求参数 {}", tasks.toString());
log.info("createFromWms - 请求参数 {}", JSON.toJSON(resp));
String request_no = tasks.getRequestNo();
JSONArray errArr = new JSONArray();
try {
@@ -272,6 +275,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
resp.setResponseDate(AgvUtil.getDate());
resp.setMessage("请求成功");
log.info("createFromWms - 返回参数 {}", JSON.toJSON(resp));
// LuceneLogDto logDto = LuceneLogDto.builder()
// .device_code("LMSTOACS")
// .requestparam(JSON.toJSON(resp).toString())
// .responseparam(JSON.toJSON(resp).toString())
// .status_code(String.valueOf(resp.getCode()))
// .method(tasks.getRequest_medthod_code())
// .build();
// lucene.interfaceExecuteLog(logDto);
return (JSONObject) JSON.toJSON(resp);
} finally {
MDC.remove(log_file_type);

View File

@@ -52,6 +52,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author ldjun
@@ -86,7 +87,38 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
this.reload();
// this.reload();
// HashMap<String, String> map = new HashMap<>();
// map.put("flag", "1");
// String code = (String) whereJson.get("code");
// String vehicle_code = (String) whereJson.get("vehicle_code");
// String material_type = (String) whereJson.get("material_type");
// String status = (String) whereJson.get("status");
// String point_code = (String) whereJson.get("point_code");
// String is_over = (String) whereJson.get("is_over");
// if (!StrUtil.isEmpty(code)) {
// map.put("code", code);
// }
// if (!StrUtil.isEmpty(vehicle_code)) {
// map.put("vehicle_code", vehicle_code);
// }
// if (!StrUtil.isEmpty(material_type)) {
// map.put("material_type", material_type);
// }
// if (!StrUtil.isEmpty(status)) {
// map.put("status", status);
// }
// if (!StrUtil.isEmpty(point_code)) {
// map.put("point_code", point_code);
// }
// if (!StrUtil.isEmpty(is_over)) {
// map.put("is_over", is_over);
// }
//
//
// final JSONObject jo = WQL.getWO("QINST_QUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "");
// return jo;
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
String code = (String) whereJson.get("code");
@@ -95,6 +127,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
String status = (String) whereJson.get("status");
String point_code = (String) whereJson.get("point_code");
String is_over = (String) whereJson.get("is_over");
String instruction_type = (String) whereJson.get("instruction_type");
if (!StrUtil.isEmpty(code)) {
map.put("code", code);
}
@@ -110,13 +143,24 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu
if (!StrUtil.isEmpty(point_code)) {
map.put("point_code", point_code);
}
if (!StrUtil.isEmpty(is_over)) {
map.put("is_over", is_over);
}
map.put("instruction_type", instruction_type);
final JSONObject jo = WQL.getWO("QINST_QUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "");
Integer currentPageNumber = page.getPageNumber() + 1;
Integer pageMaxSize = page.getPageSize();
final JSONObject jo =
WQL.getWO("QINST_QUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "");
JSONArray jsonArray = jo.getJSONArray("content");
List<Instruction> instructions = jsonArray.toJavaList(Instruction.class);
List<Instruction> instDtoList =
instructions.stream()
.skip((currentPageNumber - 1) * pageMaxSize)
.limit(pageMaxSize)
.collect(Collectors.toList());
jo.put("content", instDtoList);
jo.put("totalElements", jsonArray.size());
return jo;
}
@Override

View File

@@ -27,7 +27,7 @@ public interface LuceneExecuteLogService {
*
* @param luceneLogDto 日志结果对象
*/
void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException;
void interfaceExecuteLog(LuceneLogDto luceneLogDto);
/**
* 设备执行日志,会保留历史记录

View File

@@ -43,12 +43,12 @@ public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
}
@Override
public void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException {
public void interfaceExecuteLog(LuceneLogDto luceneLogDto) {
luceneLogDto.setLogType(LogTypeEnum.INTERFACE_LOG.getDesc());
addIndex(luceneLogDto);
}
private void addIndex(LuceneLogDto luceneLogDto) throws IOException {
private void addIndex(LuceneLogDto luceneLogDto) {
IndexWriter indexWriter = LuceneIndexWriter.getIndexWriter();
//创建一个Document对象
Document document = new Document();