fix: 仙宫日志添加

This commit is contained in:
2024-06-29 15:10:35 +08:00
parent f614e469cb
commit 47613fdbbc
6 changed files with 127 additions and 42 deletions

View File

@@ -53,28 +53,29 @@ public class AgvWaitUtil {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
manipulatorAgvStationDeviceDriver.writing(2);
if (manipulatorAgvStationDeviceDriver.getAction() == 1) {
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("诺宝agv允许取货" + "点位" + startDeviceCode)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许取货!");
log.info("允许仙工AGV取货设备号 - {}", startDeviceCode);
return map;
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("agv诺宝对接位行架不允许取货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("行架不允许取货");
}
}
if (manipulatorAgvStationDeviceDriver.getAction() == 1) {
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("诺宝agv允许取货" + "点位" + startDeviceCode)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
JSONObject map = new JSONObject();
map.put("status", 200);
map.put("message", "允许取货!");
log.info("允许仙工AGV取货设备号 - {}", startDeviceCode);
return map;
} else {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("agv诺宝对接位行架不允许取货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("行架不允许取货");
}
}
//agv叉车对接位安全信号交互
@@ -103,8 +104,8 @@ public class AgvWaitUtil {
}
}
JSONObject map = new JSONObject();
map.put("status", 400);
map.put("message", "取货点位信息不对");
map.put("status", 200);
map.put("message", "允许取货!");
log.info("允许仙工AGV取货设备号 - {}", startDeviceCode);
return map;
}
@@ -187,17 +188,18 @@ public class AgvWaitUtil {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getTo_command() != 4) {
manipulatorAgvStationDeviceDriver.writing(4);
if (manipulatorAgvStationDeviceDriver.getAction() != 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("agv诺宝对接位行架不允许放货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice);
throw new BadRequestException("上位系统不允许取货");
}
}
if (manipulatorAgvStationDeviceDriver.getAction() != 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())
.content("agv诺宝对接位行架不允许放货:" + inst.getCarno() + "点位号" + manipulatorAgvStationDeviceDriver.getDevice_code())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice);
throw new BadRequestException("上位系统不允许取货");
}
}
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(inst.getCarno())

View File

@@ -8,6 +8,7 @@ import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import jodd.util.StringUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig;
@@ -18,7 +19,6 @@ import org.nl.acs.agv.server.dto.AgvDto;
import org.nl.acs.angle.service.IAcsPointAngleService;
import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.instruction.domain.Instruction;
@@ -29,8 +29,9 @@ import org.nl.acs.device.enums.DeviceType;
import org.nl.acs.task.enums.ActionTypeEnum;
import org.nl.acs.task.enums.AgvActionTypeEnum;
import org.nl.acs.task.enums.AgvSystemTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
@@ -59,6 +60,9 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
@Autowired
private InstructionService instructionService;
@Autowired
private TaskService taskserver;
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
@Autowired
@@ -401,7 +405,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
private void inspectInStocckSet( String pointCode, JSONObject jo1) {
private void inspectInStocckSet(String pointCode, JSONObject jo1) {
Device device = deviceAppservice.findDeviceByCode(pointCode);
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@@ -765,14 +769,14 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
Integer actionType = ActionTypeEnum.IN_STOCK.getCode();
String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto);
return agvWaitUtil.waitInGet(newPointCode, instructionDto);
log.info("取货二次分配追加诺宝成功,新点位 - {}", newPointCode);
}
//如果是放货二次分配,取放货二次分配需要重新追加动作块
if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type()) || AgvActionTypeEnum.IN_OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
Integer actionType = ActionTypeEnum.OUT_STOCK.getCode();
String newPointCode = applyXGAgvTask(task_code, actionType, instructionDto);
// sendAddSequencesToNBAgv(instructionDto.getInstruction_code(), deviceCodeNow, instructionDto);
return agvWaitUtil.waitInPut(newPointCode, instructionDto);
log.info("放货二次分配追加诺宝成功,新点位 - {}", newPointCode);
}
}
//一楼叉车
@@ -810,10 +814,19 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
if (address.contains("GET")) {
//取货完成
return agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
if (StringUtil.equals("200",jsonObject.getString("status"))){
log.info("允许仙工AGV取货完成后请求离开设备号 - {}", deviceCodeNow);
return jsonObject;
}
} else if (address.contains("PUT")) {
//放货完成
return agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
if (StringUtil.equals("200",jsonObject.getString("status"))){
log.info("允许仙工AGV取货完成后请求离开设备号 - {}", deviceCodeNow);
return jsonObject;
}
}
}
@@ -953,6 +966,8 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
.content("二次分配请求lms,参数,接口返回:" + jo)
.build();
logDto2.setLog_level(4);
//二次分配更新点位
updataTask(instructionDto, jo.getString("data"));
luceneExecuteLogService.deviceExecuteLog(logDto2);
if (!ActionTypeEnum.IN_FINISHING.getCode().equals(actionType)) {
//请求成功调用诺宝追加动作块
@@ -976,6 +991,26 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
return null;
}
private void updataTask(Instruction instructionDto, String newPoint) {
TaskDto taskUpdate = new TaskDto();
if (AgvActionTypeEnum.IN_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
instructionDto.setStart_point_code(newPoint);
taskUpdate.setStart_point_code(newPoint);
instructionDto.setStart_device_code(newPoint);
taskUpdate.setStart_device_code(newPoint);
}
if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(instructionDto.getAgv_action_type())) {
instructionDto.setNext_point_code(newPoint);
taskUpdate.setNext_point_code(newPoint);
instructionDto.setNext_device_code(newPoint);
taskUpdate.setNext_device_code(newPoint);
}
taskUpdate.setTask_id(instructionDto.getTask_id());
instructionService.update(instructionDto);
taskserver.update(taskUpdate);
}
@Override
public HttpResponse sendOrderSequencesToForklift(Instruction inst, InteractionJsonDTO interactionJsonDTO) {
@@ -1087,6 +1122,25 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
private void sendEndDeviceOrder3(JSONArray ja, String nextDeviceCode, String instructionCode, Instruction instructionDto) {
JSONObject jo3 = new JSONObject();
jo3.put("blockId", IdUtil.simpleUUID());
jo3.put("location", nextDeviceCode + "INPUT");
jo3.put("operation", "script");
jo3.put("id", nextDeviceCode + "INPUT");
jo3.put("script_name", "userpy/interact.py");
JSONObject script_args3 = new JSONObject();
script_args3.put("addr", addr);
JSONObject data3 = new JSONObject();
JSONObject reach3 = new JSONObject();
reach3.put("task_code", instructionCode);
reach3.put("address", nextDeviceCode + "INPUT");
data3.put("reach", reach3);
script_args3.put("data", data3);
script_args3.put("protocol", "HTTP");
jo3.put("script_args", script_args3);
ja.add(jo3);
//将货物放下
com.alibaba.fastjson.JSONObject jo4 = new com.alibaba.fastjson.JSONObject();
jo4.put("blockId", IdUtil.simpleUUID());
@@ -1119,7 +1173,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
JSONArray ja = new JSONArray();
String nextDeviceCode = instructionDto.getNext_device_code();
//起点2
sendStartDeviceOrder2(ja, startPoint, instructionCode);
sendStartDeviceOrder2(ja, startPoint, instructionCode, instructionDto);
//终点2
sendEndDeviceOrder2(ja, nextDeviceCode, instructionCode, instructionDto);
return ja;
@@ -1173,7 +1227,32 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
}
}
private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode) {
private void sendStartDeviceOrder2(JSONArray ja, String startPoint, String instructionCode, Instruction instructionDto) {
//取货前等待
JSONObject jo = new JSONObject();
//动作块id
jo.put("blockId", IdUtil.simpleUUID());
//目的地名称
jo.put("location", startPoint + "INGET");
//执行脚本
jo.put("operation", "script");
jo.put("id", startPoint + "INGET");
//通信脚本,动作前后与现场设备交互的场景
jo.put("script_name", "userpy/interact.py");
JSONObject script_args = new JSONObject();
//更改为现场设备IP及PORT
script_args.put("addr", addr);
JSONObject data = new JSONObject();
JSONObject reach = new JSONObject();
reach.put("task_code", instructionCode);
reach.put("address", startPoint + "INGET");
data.put("reach", reach);
script_args.put("data", data);
script_args.put("protocol", "HTTP");
jo.put("script_args", script_args);
ja.add(jo);
//将货物顶起来,机器识别提升高度
JSONObject jo1 = new JSONObject();
jo1.put("blockId", IdUtil.simpleUUID());

View File

@@ -7,6 +7,7 @@ export default {
'Task_status': 'Task Status',
'Origin_or_destination': 'Origin Or Destination',
'Task_type': 'Task Type',
'Action_type': 'Action Type',
'Warehouse_task_type': 'Warehouse Task Type',
'AGV_system': 'AGV System',
'Routing_scheme': 'Routing Scheme',

View File

@@ -7,6 +7,7 @@ export default {
'Task_status': 'Status Tugas',
'Origin_or_destination': 'Asal Atau Tujuan',
'Task_type': 'Jenis Tugas',
'Action_type': 'Tipe tugas sekunder',
'Warehouse_task_type': 'Jenis Tugas Gudang',
'AGV_system': 'Sistem AGV',
'Routing_scheme': 'Skema Routing',

View File

@@ -7,6 +7,7 @@ export default {
'Task_status': '任务状态',
'Origin_or_destination': '输入起点或终点',
'Task_type': '任务类型',
'Action_type': '二次分配类型',
'Warehouse_task_type': '立库任务类型',
'AGV_system': 'agv系统',
'Routing_scheme': '路由方案',

View File

@@ -505,6 +505,7 @@
<el-table-column type="selection" width="25" />
<el-table-column v-if="false" prop="task_id" label="任务标识" />
<el-table-column prop="task_code" :label="$t('task.txt_box.Task_code')" :min-width="flexWidth('task_code',crud.data,$t('task.txt_box.Task_code'))" />
<el-table-column prop="action_type" :label="$t('task.txt_box.Action_type')" :min-width="flexWidth('action_type',crud.data,$t('task.txt_box.Action_type'))">
<el-table-column prop="task_type" :label="$t('task.txt_box.Task_type')" :min-width="flexWidth('task_type',crud.data,$t('task.txt_box.Task_type'))">
<template slot-scope="scope">
{{ dict.label.task_type[scope.row.task_type] }}