fix: 内包间优化
This commit is contained in:
@@ -12,6 +12,7 @@ import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.enums.ActionTypeEnum;
|
||||
import org.nl.acs.task.enums.AgvActionTypeEnum;
|
||||
import org.nl.acs.task.enums.AgvSystemTypeEnum;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
@@ -129,7 +130,9 @@ public class AgvWaitUtil {
|
||||
}
|
||||
//诺宝agv调lms更新点位
|
||||
if (inst.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
|
||||
applyLmsGetOut(inst);
|
||||
if (!AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) {
|
||||
applyLmsGetOut(inst);
|
||||
}
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) {
|
||||
|
||||
@@ -11,14 +11,19 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.agv.xg_agv_car.XgAgvCarDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
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.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,6 +36,10 @@ import java.util.stream.Collectors;
|
||||
@Component("queryAGVStatus")
|
||||
public class QueryAGVStatus {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeviceAppService deviceAppService;
|
||||
|
||||
public void run() {
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
||||
@@ -64,6 +73,7 @@ public class QueryAGVStatus {
|
||||
//执行中
|
||||
String state = json.getString("state");
|
||||
String carNo = json.getString("vehicle");
|
||||
String instructionCode = json.getString("id");
|
||||
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
||||
instruction.setInstruction_status("1");
|
||||
instruction.setCarno(carNo);
|
||||
@@ -73,6 +83,15 @@ public class QueryAGVStatus {
|
||||
task.setTask_id(instruction.getTask_id());
|
||||
instructionService.update(instruction);
|
||||
taskService.update(task);
|
||||
if (StrUtil.isNotEmpty(instructionCode)){
|
||||
Device carCode = deviceAppService.findDeviceByCode(instructionCode);
|
||||
XgAgvCarDeviceDriver xgAgvCarDeviceDriver;
|
||||
if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver){
|
||||
xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver();
|
||||
xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type()));
|
||||
}
|
||||
}
|
||||
|
||||
} else if ("FINISHED".equals(state)) {
|
||||
instruction.setInstruction_status("2");
|
||||
try {
|
||||
|
||||
@@ -936,7 +936,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/" + " robotsStatus?vehicles=" + robotCode;
|
||||
agvurl = agvurl + ":" + agvport + "/" + "robotsStatus?vehicles=" + robotCode;
|
||||
log.info("根据指定机器人查询状态的请求:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
.timeout(20000)//超时,毫秒
|
||||
|
||||
@@ -180,6 +180,11 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
||||
*/
|
||||
private int unlock = 0;
|
||||
|
||||
/**
|
||||
* agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配)
|
||||
*/
|
||||
private String taskType = "";
|
||||
|
||||
|
||||
String device_code = null;
|
||||
String container;
|
||||
@@ -241,8 +246,10 @@ public class XgAgvCarDeviceDriver extends AbstractDeviceDriver implements Device
|
||||
map.put("low_battery", low_battery ? "低电量": "正常");
|
||||
map.put("suspended", suspended ? "订单被暂停,需要人工手动恢复": "正常");
|
||||
map.put("message", message);
|
||||
map.put("agv_task_type", taskType);
|
||||
map.put("unconfirmed_reloc", unconfirmed_reloc ? "未确认定位" : "正常");
|
||||
map.put("unlock", unlock == 0 ? "控制权在core手上" : unlock == 1 ? "控制权被其他人抢走" : unlock == 2 ?"控制权没有被抢占" : "未知");
|
||||
|
||||
JSONObject jo = new JSONObject(map);
|
||||
return jo;
|
||||
}
|
||||
|
||||
@@ -17,11 +17,9 @@ import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_conveyor.manipulator_cache.ManipulatorCacheDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_manipulator.trapped_manipulator.InteractionJsonDTO;
|
||||
import org.nl.acs.enums.VolumeTwoTypeEnum;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
@@ -47,7 +45,6 @@ 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;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -200,7 +197,14 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
}
|
||||
//四个点行架任务,满轴放货完成后调lms生成rgv任务
|
||||
if (action == 6 && task > 0 ){
|
||||
creatAGV();
|
||||
Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode();
|
||||
creatAGV(actionType,action);
|
||||
}
|
||||
|
||||
//空载具取货完成
|
||||
if (action == 7 && task > 0 ){
|
||||
Integer actionType = ActionTypeEnum.IN_FINISHING.getCode();
|
||||
creatAGV(actionType, action);
|
||||
}
|
||||
|
||||
} catch (Exception var17) {
|
||||
@@ -274,14 +278,14 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
last_to_type = to_type;
|
||||
}
|
||||
|
||||
private void creatAGV() {
|
||||
private void creatAGV(Integer actionType, int toCommand) {
|
||||
Instruction instruction = checkInst();
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("taskCode", instruction.getTask_code());
|
||||
param.put("actionType",ActionTypeEnum.RELEASE_FINISHING.getCode() );
|
||||
param.put("actionType",actionType );
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("满轴放货完成请求lms,参数:" + task + "--" +ActionTypeEnum.RELEASE_FINISHING.getStatus())
|
||||
.content("行架取放货完成请求lms,参数:" + task + "--" +ActionTypeEnum.RELEASE_FINISHING.getStatus())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
@@ -290,25 +294,25 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
if (jo.getInteger("status") == 200) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("满轴放货完成请求lms,参数,接口返回:" + jo)
|
||||
.content("行架取放货完成请求lms,参数,接口返回:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 6);
|
||||
map1.put("value", toCommand);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
|
||||
} else {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("满轴放货完成请求lms,返回参数:" + jo)
|
||||
.content("行架取放货完成请求lms,返回参数:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
throw new BadRequestException("满轴放货完成请求lms返回失败");
|
||||
throw new BadRequestException("行架取放货完成请求lms返回失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ public enum ActionTypeEnum {
|
||||
*/
|
||||
RELEASE_FINISHING(4, "满轴放货完成");
|
||||
|
||||
|
||||
Integer code;
|
||||
String status;
|
||||
|
||||
public static String getStatus(Integer code) {
|
||||
for (ActionTypeEnum value : values()) {
|
||||
if (value.code.equals(code)) {
|
||||
|
||||
@@ -51,6 +51,7 @@ public class AutoCleanLucenceLog {
|
||||
String endDate = DateUtil.format(calendar.getTime(), "yyyy-MM-dd HH:mm:ss.SSS");
|
||||
TermRangeQuery termRangeQuery = new TermRangeQuery("logTime", new BytesRef(startDate), new BytesRef(endDate), true, true);
|
||||
writer.deleteDocuments(termRangeQuery);
|
||||
writer.commit();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user