rev:一楼桁架交互、AGV任务状态查询接口更新
This commit is contained in:
@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangjiangwei
|
* @author zhangjiangwei
|
||||||
@@ -65,6 +66,22 @@ public class AgvWaitUtil {
|
|||||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
|
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
|
||||||
manipulatorAgvStationDeviceDriver.writing(2);
|
manipulatorAgvStationDeviceDriver.writing(2);
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
|
while (true){
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
if (manipulatorAgvStationDeviceDriver.getAction() == 1){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i >= 4){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
if (manipulatorAgvStationDeviceDriver.getAction() == 1) {
|
if (manipulatorAgvStationDeviceDriver.getAction() == 1) {
|
||||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||||
.device_code(inst.getCarno())
|
.device_code(inst.getCarno())
|
||||||
@@ -76,14 +93,18 @@ public class AgvWaitUtil {
|
|||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许取货!");
|
map.put("message", "允许取货!");
|
||||||
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
.device_code(inst.getInstruction_code())
|
||||||
.content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: 桁架不允许取货! ")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
throw new BadRequestException("行架不允许取货");
|
throw new BadRequestException("行架不允许取货");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,31 +114,34 @@ public class AgvWaitUtil {
|
|||||||
if (startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
if (startDevice.getDeviceDriver() instanceof BoxSubvolumesConveyorDeviceDriver) {
|
||||||
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver();
|
boxSubvolumesConveyorDeviceDriver = (BoxSubvolumesConveyorDeviceDriver) startDevice.getDeviceDriver();
|
||||||
if (boxSubvolumesConveyorDeviceDriver.getMode() == 2) {
|
if (boxSubvolumesConveyorDeviceDriver.getMode() == 2) {
|
||||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
|
||||||
.device_code(inst.getCarno())
|
|
||||||
.content("叉车允许取货")
|
|
||||||
.build();
|
|
||||||
logDto1.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许取货!");
|
map.put("message", "允许取货!");
|
||||||
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(inst.getCarno())
|
.device_code(inst.getInstruction_code())
|
||||||
.content("agv叉车对接位输送线不允许取货:" + inst.getCarno() + "点位号" + boxSubvolumesConveyorDeviceDriver.getDevice_code())
|
.content("AGV开始响应.....,请求参数: { 请查看开始请求 }, 响应结果: 设备不满足信号, 不允许取货! ")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto1.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
throw new BadRequestException("设备不满足信号, 不允许取货");
|
||||||
throw new BadRequestException("上位系统不允许取货");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许取货!");
|
map.put("message", "允许取货!");
|
||||||
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
log.info("允许仙工AGV取货,设备号 - {}", startDeviceCode);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,21 +169,41 @@ public class AgvWaitUtil {
|
|||||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) {
|
if (manipulatorAgvStationDeviceDriver.getTo_command() != 3) {
|
||||||
manipulatorAgvStationDeviceDriver.writing(3);
|
manipulatorAgvStationDeviceDriver.writing(3);
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
|
while (true){
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||||
|
if (manipulatorAgvStationDeviceDriver.getAction() == 0 && manipulatorAgvStationDeviceDriver.getMode() == 2){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i >= 4){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||||
if (manipulatorAgvStationDeviceDriver.getAction() == 0 && manipulatorAgvStationDeviceDriver.getMode() == 2) {
|
if (manipulatorAgvStationDeviceDriver.getAction() == 0 && manipulatorAgvStationDeviceDriver.getMode() == 2) {
|
||||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.isSendLms).getValue(), CommonFinalParam.ONE)){
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.isSendLms).getValue(), CommonFinalParam.ONE)) {
|
||||||
if (!AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) {
|
if (!AgvActionTypeEnum.ORDINARY.getCode().equals(inst.getAgv_action_type())) {
|
||||||
applyLmsGetOut(inst);
|
applyLmsGetOut(inst);
|
||||||
|
} else {
|
||||||
|
boolean ignore_pickup_check = Optional.ofNullable(startDevice.getExtraValue().get("ignore_pickup_check")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
|
||||||
|
if (ignore_pickup_check) {
|
||||||
|
applyLmsGetOut(inst);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
.device_code(inst.getInstruction_code())
|
||||||
.content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0")
|
.content("AGV开始响应.....,请求参数: { 请查看开始请求 }, 响应结果: 桁架信号不满足条件, 不允许AGV取货完成离开! ")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
throw new BadRequestException("桁架信号不满足条件,不允许AGV取货完成离开");
|
||||||
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", startDeviceCode);
|
|
||||||
throw new BadRequestException("上位系统不允许agv离开");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,6 +213,11 @@ public class AgvWaitUtil {
|
|||||||
map.put("message", "允许离开!");
|
map.put("message", "允许离开!");
|
||||||
log.info("允许仙工AGV取货完成后请求离开,返回参数 - {}", map);
|
log.info("允许仙工AGV取货完成后请求离开,返回参数 - {}", map);
|
||||||
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
log.info("允许仙工AGV取货完成后请求离开,设备号 - {}", startDeviceCode);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +240,11 @@ public class AgvWaitUtil {
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: 请求LMS追加动诺宝作块, LMS返回成功")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(inst.getCarno())
|
.device_code(inst.getCarno())
|
||||||
@@ -198,6 +252,11 @@ public class AgvWaitUtil {
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: 请求LMS追加动诺宝作块, LMS返回失败")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
throw new BadRequestException("追加动诺宝作块返回失败");
|
throw new BadRequestException("追加动诺宝作块返回失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,15 +271,31 @@ public class AgvWaitUtil {
|
|||||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 4) {
|
if (manipulatorAgvStationDeviceDriver.getTo_command() != 4) {
|
||||||
manipulatorAgvStationDeviceDriver.writing(4);
|
manipulatorAgvStationDeviceDriver.writing(4);
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
|
while (true){
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver();
|
||||||
|
if (manipulatorAgvStationDeviceDriver.getAction() == 1){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i >= 4){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver();
|
||||||
if (manipulatorAgvStationDeviceDriver.getAction() != 1) {
|
if (manipulatorAgvStationDeviceDriver.getAction() != 1) {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
.device_code(inst.getInstruction_code())
|
||||||
.content("未给agv进入信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为1")
|
.content("AGV开始响应.....,请求参数: { 请查看开始请求 }, 响应结果: 桁架信号不满足条件, 不允许AGV放货! ")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice);
|
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice);
|
||||||
throw new BadRequestException("上位系统不允许取货");
|
throw new BadRequestException("桁架信号不满足条件, 不允许AGV放货");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -234,6 +309,11 @@ public class AgvWaitUtil {
|
|||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许放货!");
|
map.put("message", "允许放货!");
|
||||||
log.info("允许仙工AGV放货,设备号 - {}", endDeviceCode);
|
log.info("允许仙工AGV放货,设备号 - {}", endDeviceCode);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,15 +328,31 @@ public class AgvWaitUtil {
|
|||||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 5) {
|
if (manipulatorAgvStationDeviceDriver.getTo_command() != 5) {
|
||||||
manipulatorAgvStationDeviceDriver.writing(5);
|
manipulatorAgvStationDeviceDriver.writing(5);
|
||||||
}
|
}
|
||||||
|
int i = 0;
|
||||||
|
while (true){
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
|
if (manipulatorAgvStationDeviceDriver.getAction() == 0){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i >= 4){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) nextDevice.getDeviceDriver();
|
||||||
if (manipulatorAgvStationDeviceDriver.getAction() != 0) {
|
if (manipulatorAgvStationDeviceDriver.getAction() != 0) {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
.device_code(inst.getInstruction_code())
|
||||||
.content("未给agv离开信号原因是:" + manipulatorAgvStationDeviceDriver.getDevice_code() + "动作信号不为0")
|
.content("AGV开始响应.....,请求参数: { 请查看开始请求 }, 响应结果: 桁架信号不满足条件, 不允许AGV放货完成离开! ")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDeviceCode);
|
log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDeviceCode);
|
||||||
throw new BadRequestException("上位系统不允许agv离开");
|
throw new BadRequestException("桁架信号不满足条件, 不允许AGV放货完成离开!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,6 +364,11 @@ public class AgvWaitUtil {
|
|||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许离开!");
|
map.put("message", "允许离开!");
|
||||||
log.info("允许仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
log.info("允许仙工AGV放货完成后请求离开,设备号 - {}", endDeviceCode);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: {查看开始请求}, 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,17 @@
|
|||||||
package org.nl.acs.agv;
|
package org.nl.acs.agv;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.acs.AcsConfig;
|
import org.nl.acs.agv.server.XianGongAgvService;
|
||||||
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.domain.Instruction;
|
||||||
import org.nl.acs.instruction.service.InstructionService;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时查询AGV状态
|
* 定时查询AGV状态
|
||||||
@@ -38,79 +22,53 @@ public class QueryAGVStatus {
|
|||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceAppService deviceAppService;
|
private XianGongAgvService agvService;
|
||||||
|
@Autowired
|
||||||
|
private InstructionService instructionService;
|
||||||
|
|
||||||
public void run() {
|
public void run() throws Exception {
|
||||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
|
||||||
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
|
||||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
|
||||||
List<Instruction> allInstFromCache = instructionService.findAllInstFromCache();
|
|
||||||
List<Instruction> agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList());
|
|
||||||
if (CollUtil.isEmpty(agvInstruction) || agvInstruction.size() < 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (Instruction instruction : agvInstruction) {
|
|
||||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
|
||||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
|
||||||
JSONObject param = new JSONObject();
|
|
||||||
agvurl = agvurl + ":" + agvport + "/orderDetails/" + instruction.getInstruction_code();
|
|
||||||
log.info("根据运单号查询运单状态的请求:{}", agvurl);
|
|
||||||
HttpResponse result = HttpRequest.get(agvurl)
|
|
||||||
.timeout(20000)//超时,毫秒
|
|
||||||
.execute();
|
|
||||||
log.info("根据运单号查询运单状态的请求反馈:{}", result);
|
|
||||||
String body = result.body();
|
|
||||||
JSONObject json = JSONObject.parseObject(body);
|
|
||||||
if (result.getStatus() == 200 && json.getString("id").equals(instruction.getInstruction_code())) {
|
|
||||||
// 已创建=CREATED,
|
|
||||||
// 待分配=TOBEDISPATCHED,
|
|
||||||
// 正在执行=RUNNING,
|
|
||||||
// 完成=FINISHED,
|
|
||||||
// 失败=FAILED(主动失败),
|
|
||||||
// 终止=STOPPED(被人为终止),
|
|
||||||
// 无法执行=Error(参数错误),
|
|
||||||
// 等待=WAITING
|
|
||||||
//执行中
|
|
||||||
String state = json.getString("state");
|
|
||||||
String carNo = json.getString("vehicle");
|
|
||||||
String instructionCode = json.getString("id");
|
|
||||||
if ("RUNNING".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
|
||||||
TaskDto task = taskService.findById(instruction.getTask_id());
|
|
||||||
if ("0".equals(instruction.getInstruction_status())&&"1".equals(task.getTask_status())) {
|
|
||||||
instruction.setCarno(carNo);
|
|
||||||
instruction.setInstruction_status("1");
|
|
||||||
instructionService.update(instruction);
|
|
||||||
task.setCarno(carNo);
|
|
||||||
task.setTask_id(instruction.getTask_id());
|
|
||||||
instructionService.update(instruction);
|
|
||||||
taskService.update(task);
|
|
||||||
if (StrUtil.isNotEmpty(instructionCode)) {
|
|
||||||
Device carCode = deviceAppService.findDeviceByCode(instructionCode);
|
|
||||||
XgAgvCarDeviceDriver xgAgvCarDeviceDriver;
|
|
||||||
if (null != carCode) {
|
|
||||||
if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
|
|
||||||
xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver();
|
|
||||||
xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if ("FINISHED".equals(state)) {
|
HttpResponse response = agvService.queryXZAgvInstStatus();
|
||||||
if (!"2".equals(instruction.getInstruction_status())) {
|
JSONObject jo = JSONArray.parseObject(response.body());
|
||||||
instruction.setInstruction_status("2");
|
|
||||||
try {
|
JSONArray ja = JSONArray.parseArray(jo.getString("list"));
|
||||||
instructionService.finish(instruction);
|
for (int i = 0; i < ja.size(); i++) {
|
||||||
} catch (Exception e) {
|
JSONObject one = (JSONObject) ja.get(i);
|
||||||
log.error("执行完成,但无法更新状态,可能由于参数错误导致的异常");
|
String inst_code = one.getString("id");
|
||||||
e.printStackTrace();
|
Instruction inst = instructionService.findByCodeFromCache(inst_code);
|
||||||
}
|
if (ObjectUtil.isEmpty(inst))
|
||||||
}
|
continue;
|
||||||
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
|
||||||
if (!"1".equals(instruction.getInstruction_status())) {
|
String state = one.getString("state");
|
||||||
instruction.setInstruction_status("1");
|
if (!StrUtil.isEmpty(one.getString("vehicle"))) {
|
||||||
instructionService.update(instruction);
|
String carno = one.getString("vehicle");
|
||||||
}
|
inst.setCarno(carno);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 已创建=CREATED,
|
||||||
|
// 待分配=TOBEDISPATCHED,
|
||||||
|
// 正在执行=RUNNING,
|
||||||
|
// 完成=FINISHED,
|
||||||
|
// 失败=FAILED(主动失败),
|
||||||
|
// 终止=STOPPED(被人为终止),
|
||||||
|
// 无法执行=Error(参数错误),
|
||||||
|
// 等待=WAITING
|
||||||
|
|
||||||
|
//执行中
|
||||||
|
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
||||||
|
if (inst != null && "0".equals(inst.getInstruction_status())) {
|
||||||
|
inst.setInstruction_status("1");
|
||||||
|
instructionService.update(inst);
|
||||||
|
}
|
||||||
|
} else if ("FINISHED".equals(state)) {
|
||||||
|
if (inst != null) {
|
||||||
|
inst.setInstruction_status("2");
|
||||||
|
instructionService.finish(inst);
|
||||||
|
}
|
||||||
|
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
||||||
|
if (inst != null) {
|
||||||
|
//inst.setInstruction_status("1");
|
||||||
|
//instructionService.update(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ public interface XianGongAgvService {
|
|||||||
*/
|
*/
|
||||||
public HttpResponse queryXZAgvInstStatus(String instCode);
|
public HttpResponse queryXZAgvInstStatus(String instCode);
|
||||||
|
|
||||||
|
public HttpResponse queryXZAgvInstStatus();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除先知任务
|
* 删除先知任务
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -238,6 +238,25 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResponse queryXZAgvInstStatus() {
|
||||||
|
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
|
||||||
|
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||||
|
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||||
|
|
||||||
|
agvurl = agvurl + ":" + agvport + "/orders?page=1&size=50&orderBy=createTime&orderMethod=descending";
|
||||||
|
|
||||||
|
HttpResponse result = HttpRequest.get(agvurl)
|
||||||
|
.timeout(20000)//超时,毫秒
|
||||||
|
.execute();
|
||||||
|
log.info("queryXZAgvInstStatus----查询agv指令数据:{}" + result.body());
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResponse deleteXZAgvInst(String instCode) {
|
public HttpResponse deleteXZAgvInst(String instCode) {
|
||||||
@@ -741,25 +760,29 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) {
|
public JSONObject xgAGVWaitPointRequest(JSONObject requestParam) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始请求.....,请求参数:" + JSON.toJSONString(requestParam))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
log.info("仙工AGV请求取放货,请求参数 - {}", requestParam);
|
log.info("仙工AGV请求取放货,请求参数 - {}", requestParam);
|
||||||
String inst_code = requestParam.getString("task_code");
|
String inst_code = requestParam.getString("task_code");
|
||||||
Instruction instructionDto = instructionService.findByCodeFromCache(inst_code);
|
Instruction instructionDto = instructionService.findByCodeFromCache(inst_code);
|
||||||
if (ObjectUtil.isEmpty(instructionDto)) {
|
if (ObjectUtil.isEmpty(instructionDto)) {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.content("请求失败,未找到指令!" + inst_code)
|
.device_code(requestParam.getString("task_code"))
|
||||||
.build();
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: 指令号不存在!")
|
||||||
logDto.setLog_level(4);
|
.log_level(4)
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
.build());
|
||||||
throw new BadRequestException("请求失败,未找到指令!");
|
throw new BadRequestException("请求失败,未找到指令!");
|
||||||
}
|
}
|
||||||
String address = requestParam.getString("address");
|
String address = requestParam.getString("address");
|
||||||
if (StrUtil.isBlank(address)) {
|
if (StrUtil.isBlank(address)) {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(instructionDto.getCarno())
|
.device_code(requestParam.getString("task_code"))
|
||||||
.content("请求失败,地址为空!" )
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: 请求地址为空!")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
throw new BadRequestException("请求失败,地址为空!");
|
throw new BadRequestException("请求失败,地址为空!");
|
||||||
}
|
}
|
||||||
if (address.contains("IN") || address.contains("WAIT")) {
|
if (address.contains("IN") || address.contains("WAIT")) {
|
||||||
@@ -771,17 +794,15 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
deviceCodeNow = address.substring(0, address.length() - 5);
|
deviceCodeNow = address.substring(0, address.length() - 5);
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(instructionDto.getCarno())
|
.device_code(requestParam.getString("task_code"))
|
||||||
.content("设备号 " + deviceCodeNow + " 不存在!")
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: 设备号: " + deviceCodeNow + "不存在! ")
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
|
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
|
||||||
}
|
}
|
||||||
//一楼诺宝agv
|
//一楼诺宝agv
|
||||||
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
|
if (instructionDto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
|
||||||
|
|
||||||
if (address.contains("GET")) {
|
if (address.contains("GET")) {
|
||||||
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
|
return agvWaitUtil.waitInGet(deviceCodeNow, instructionDto);
|
||||||
} else if (address.contains("PUT")) {
|
} else if (address.contains("PUT")) {
|
||||||
@@ -795,6 +816,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "取货二次分配追加诺宝成功!");
|
map.put("message", "取货二次分配追加诺宝成功!");
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
//如果是放货二次分配,取放货二次分配需要重新追加动作块
|
//如果是放货二次分配,取放货二次分配需要重新追加动作块
|
||||||
@@ -806,6 +832,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
JSONObject map = new JSONObject();
|
JSONObject map = new JSONObject();
|
||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "放货二次分配追加诺宝成功!");
|
map.put("message", "放货二次分配追加诺宝成功!");
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: " + JSON.toJSONString(map))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -823,12 +854,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
map.put("status", 200);
|
map.put("status", 200);
|
||||||
map.put("message", "允许叉车放货!" + "点位" + newPointCode);
|
map.put("message", "允许叉车放货!" + "点位" + newPointCode);
|
||||||
log.info("允许仙工AGV放货,设备号 - {}", newPointCode);
|
log.info("允许仙工AGV放货,设备号 - {}", newPointCode);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
.device_code(instructionDto.getCarno())
|
.device_code(requestParam.getString("task_code"))
|
||||||
.content("叉车允许放货" + "新点位:" + newPointCode + map )
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: " + JSON.toJSONString(map))
|
||||||
.build();
|
.log_level(4)
|
||||||
logDto.setLog_level(4);
|
.build());
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
//放货前等待
|
//放货前等待
|
||||||
@@ -841,6 +871,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
if (address.contains("OUT")) {
|
if (address.contains("OUT")) {
|
||||||
String deviceCodeNow = address.substring(0, address.length() - 6);
|
String deviceCodeNow = address.substring(0, address.length() - 6);
|
||||||
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
if (ObjectUtil.isEmpty(deviceAppService.findDeviceByCode(deviceCodeNow))) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果:设备号 " + deviceCodeNow + "不存在! ")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
|
throw new BadRequestException("设备号 " + deviceCodeNow + " 不存在!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,6 +884,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
|
JSONObject jsonObject = agvWaitUtil.waitOutGet(deviceCodeNow, instructionDto);
|
||||||
if (StringUtil.equals("200", jsonObject.getString("status"))) {
|
if (StringUtil.equals("200", jsonObject.getString("status"))) {
|
||||||
log.info("仙工AGV取货完成后离开,设备号 - {}", deviceCodeNow);
|
log.info("仙工AGV取货完成后离开,设备号 - {}", deviceCodeNow);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: " + JSON.toJSONString(jsonObject))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
} else if (address.contains("PUT")) {
|
} else if (address.contains("PUT")) {
|
||||||
@@ -856,48 +896,62 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
|
JSONObject jsonObject = agvWaitUtil.waitOutPut(deviceCodeNow, instructionDto);
|
||||||
if (StringUtil.equals("200", jsonObject.getString("status"))) {
|
if (StringUtil.equals("200", jsonObject.getString("status"))) {
|
||||||
log.info("仙工AGV放货完成后离开,设备号 - {}", deviceCodeNow);
|
log.info("仙工AGV放货完成后离开,设备号 - {}", deviceCodeNow);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: " + JSON.toJSONString(jsonObject))
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(requestParam.getString("task_code"))
|
||||||
|
.content("AGV开始响应.....,请求参数:" + JSON.toJSONString(requestParam) + ", 响应结果: IN OUT 站点错误!")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
throw new BadRequestException("请求失败,IN OUT 站点错误!");
|
||||||
}
|
}
|
||||||
|
|
||||||
private String applyCCAgvTask(String task_code, Instruction instructionDto) {
|
private String applyCCAgvTask(String task_code, Instruction instructionDto) {
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("task_code", task_code);
|
param.put("task_code", task_code);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
|
.device_code(instructionDto.getCarno())
|
||||||
|
.content("叉车二次分配请求lms,参数:" + task_code)
|
||||||
|
.build();
|
||||||
|
logDto.setLog_level(4);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
|
String response = acsToWmsService.applySendOutTwo(param);
|
||||||
|
JSONObject jo = JSON.parseObject(response);
|
||||||
|
if (jo.getInteger("status") == 200) {
|
||||||
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(instructionDto.getCarno())
|
.device_code(instructionDto.getCarno())
|
||||||
.content("叉车二次分配请求lms,参数:" + task_code)
|
.content("叉车二次分配请求lms,参数,接口返回:" + jo)
|
||||||
.build();
|
.build();
|
||||||
logDto.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
String response = acsToWmsService.applySendOutTwo(param);
|
//二次分配更新点位
|
||||||
JSONObject jo = JSON.parseObject(response);
|
updataTask(instructionDto, jo.getString("data"));
|
||||||
if (jo.getInteger("status") == 200) {
|
//请求成功调用叉车追加动作块
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
sendAddSequencesToCCAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto);
|
||||||
.device_code(instructionDto.getCarno())
|
return jo.getString("data");
|
||||||
.content("叉车二次分配请求lms,参数,接口返回:" + jo)
|
|
||||||
.build();
|
|
||||||
logDto2.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
|
||||||
//二次分配更新点位
|
|
||||||
updataTask(instructionDto, jo.getString("data"));
|
|
||||||
//请求成功调用叉车追加动作块
|
|
||||||
sendAddSequencesToCCAgv(instructionDto.getInstruction_code(), jo.getString("data"), instructionDto);
|
|
||||||
return jo.getString("data");
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(instructionDto.getCarno())
|
.device_code(instructionDto.getCarno())
|
||||||
.content("叉车二次分配请求lms失败,返回参数:" + jo.getString("message"))
|
.content("叉车二次分配请求lms失败,返回参数:" + jo.getString("message"))
|
||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
throw new BadRequestException("叉车二次分配请求lms返回失败");
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
}
|
.device_code(instructionDto.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: { 请查看请求参数 }, 响应结果: 二次分配请求LMS, LMS返回失败 ")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
|
throw new BadRequestException("叉车二次分配请求lms返回失败");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) {
|
private void sendAddSequencesToCCAgv(String instructionCode, String nextPoint, Instruction instructionDto) {
|
||||||
@@ -1009,6 +1063,11 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(instructionDto.getInstruction_code())
|
||||||
|
.content("AGV开始响应.....,请求参数: { 请查看请求参数 }, 响应结果: 二次分配请求LMS, LMS返回失败 ")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
throw new BadRequestException("二次分配请求lms返回失败");
|
throw new BadRequestException("二次分配请求lms返回失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,7 +1144,6 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 追加动作块
|
* 追加动作块
|
||||||
*
|
*
|
||||||
@@ -1437,7 +1495,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
|
|||||||
jo10.put("binTask", "OutForkHeight");
|
jo10.put("binTask", "OutForkHeight");
|
||||||
ja.add(jo10);
|
ja.add(jo10);
|
||||||
|
|
||||||
} else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
} else if (AgvActionTypeEnum.IN_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
||||||
|
|
||||||
} else if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
} else if (AgvActionTypeEnum.OUT_STOCK.getCode().equals(inst.getAgv_action_type())) {
|
||||||
// to do
|
// to do
|
||||||
|
|||||||
@@ -273,27 +273,36 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateInstrction() {
|
private void updateInstrction() {
|
||||||
|
//更改指令状态
|
||||||
|
if (task > 0) {
|
||||||
|
Instruction inst = checkInst();
|
||||||
|
if (inst != null) {
|
||||||
|
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
||||||
|
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||||
|
inst.setExecute_device_code(this.device_code);
|
||||||
|
instructionService.update(inst);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("装箱桁架: 桁架任务更新为执行中")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.instruction_update_time = date;
|
this.instruction_update_time = date;
|
||||||
//更改指令状态
|
|
||||||
if (task > 0) {
|
|
||||||
Instruction inst = checkInst();
|
|
||||||
if (inst != null) {
|
|
||||||
if (StrUtil.equals(inst.getInstruction_status(), "0")) {
|
|
||||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
|
||||||
inst.setExecute_device_code(this.device_code);
|
|
||||||
instructionService.update(inst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//放货完成
|
//放货完成
|
||||||
if ( action == 4 && move == 0) {
|
if ( action == 4 && move == 0) {
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("装箱桁架: 桁架任务放货完成")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
try {
|
try {
|
||||||
logServer.deviceExecuteLog(this.device_code,"","","放货完成");
|
logServer.deviceExecuteLog(this.device_code,"","","放货完成");
|
||||||
finish_instruction(inst);
|
finish_instruction(inst);
|
||||||
@@ -541,6 +550,11 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(task)
|
||||||
|
.content("装箱桁架: 下发桁架任务")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void packageData(Instruction instdto, String route_plan_code, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code) {
|
private void packageData(Instruction instdto, String route_plan_code, String taskid, String taskcode, String start_device_code, String next_device_code, String start_point_code, String next_point_code) {
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
|
|
||||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
|
||||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);;
|
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||||
|
;
|
||||||
|
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
|
|
||||||
@@ -195,18 +196,28 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
// 更新指令状态
|
// 更新指令状态
|
||||||
if (mode == 3 && task > 0) {
|
if (mode == 3 && task > 0) {
|
||||||
updateInstructionStatus();
|
updateInstructionStatus();
|
||||||
if (null!=inst) {
|
if (null != inst) {
|
||||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//四个点行架任务,满轴放货完成后调lms生成rgv任务
|
//四个点行架任务,满轴放货完成后调lms生成rgv任务
|
||||||
if (action == 6 && task > 0 && !actionRequireSucess ){
|
if (action == 6 && task > 0 && !actionRequireSucess) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(String.valueOf(this.task))
|
||||||
|
.content("子卷下线桁架: 桁架任务满轴放货完成")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode();
|
Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode();
|
||||||
creatAGV(actionType,action);
|
creatAGV(actionType, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
//空载具取货完成
|
//空载具取货完成
|
||||||
if (action == 7 && task > 0 && !actionRequireSucess ){
|
if (action == 7 && task > 0 && !actionRequireSucess) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(String.valueOf(this.task))
|
||||||
|
.content("子卷下线桁架: 桁架任务空载具取货完成")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
Integer actionType = ActionTypeEnum.IN_FINISHING.getCode();
|
Integer actionType = ActionTypeEnum.IN_FINISHING.getCode();
|
||||||
creatAGV(actionType, action);
|
creatAGV(actionType, action);
|
||||||
}
|
}
|
||||||
@@ -291,22 +302,27 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
|
|
||||||
private void creatAGV(Integer actionType, int toCommand) {
|
private void creatAGV(Integer actionType, int toCommand) {
|
||||||
Instruction instruction = checkInst();
|
Instruction instruction = checkInst();
|
||||||
if(ObjectUtil.isEmpty(instruction)){
|
if (ObjectUtil.isEmpty(instruction)) {
|
||||||
log.info("指令不存在");
|
log.info("指令不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("taskCode", instruction.getTask_code());
|
param.put("taskCode", instruction.getTask_code());
|
||||||
param.put("actionType",actionType );
|
param.put("actionType", actionType);
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||||
.device_code(device_code)
|
.device_code(device_code)
|
||||||
.content("行架取放货完成请求lms,参数:" + task + "--" +ActionTypeEnum.getStatus(actionType))
|
.content("行架取放货完成请求lms,参数:" + task + "--" + ActionTypeEnum.getStatus(actionType))
|
||||||
.build();
|
.build();
|
||||||
logDto.setLog_level(4);
|
logDto.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||||
String response = acsToWmsService.secondaryAllocationPoint(param);
|
String response = acsToWmsService.secondaryAllocationPoint(param);
|
||||||
JSONObject jo = JSON.parseObject(response);
|
JSONObject jo = JSON.parseObject(response);
|
||||||
if (jo.getInteger("status") == 200) {
|
if (jo.getInteger("status") == 200) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(instruction.getInstruction_code())
|
||||||
|
.content("子卷下线桁架: 桁架任务" + ActionTypeEnum.getStatus(actionType) + "完成请求LMS, LMS反馈成功")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||||
.device_code(device_code)
|
.device_code(device_code)
|
||||||
.content("行架取放货完成请求lms,参数,接口返回:" + jo)
|
.content("行架取放货完成请求lms,参数,接口返回:" + jo)
|
||||||
@@ -327,6 +343,11 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
.build();
|
.build();
|
||||||
logDto2.setLog_level(4);
|
logDto2.setLog_level(4);
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(instruction.getInstruction_code())
|
||||||
|
.content("子卷下线桁架: 桁架任务" + ActionTypeEnum.getStatus(actionType) + "完成请求LMS, LMS反馈失败")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
throw new BadRequestException("行架取放货完成请求lms返回失败");
|
throw new BadRequestException("行架取放货完成请求lms返回失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,6 +363,11 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
inst.setExecute_device_code(this.device_code);
|
inst.setExecute_device_code(this.device_code);
|
||||||
instructionService.update(inst);
|
instructionService.update(inst);
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "修改指令状态为执行中");
|
logServer.deviceExecuteLog(this.device_code, "", "", "修改指令状态为执行中");
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("子卷下线桁架: 桁架任务更新为执行中")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,6 +379,11 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
//放货完成
|
//放货完成
|
||||||
if (action == 4 && move == 0) {
|
if (action == 4 && move == 0) {
|
||||||
if (inst != null) {
|
if (inst != null) {
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(inst.getInstruction_code())
|
||||||
|
.content("子卷下线桁架: 桁架任务放货完成")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
try {
|
try {
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "放货完成");
|
logServer.deviceExecuteLog(this.device_code, "", "", "放货完成");
|
||||||
finish_instruction(inst);
|
finish_instruction(inst);
|
||||||
@@ -603,6 +634,11 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
list.add(map7);
|
list.add(map7);
|
||||||
|
|
||||||
this.writing(list);
|
this.writing(list);
|
||||||
|
luceneExecuteLogService.deviceExecuteLog(LuceneLogDto.builder()
|
||||||
|
.device_code(task)
|
||||||
|
.content("子卷下线桁架: 下发桁架任务")
|
||||||
|
.log_level(4)
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -706,7 +742,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
|||||||
jo.put("isError", this.getIserror());
|
jo.put("isError", this.getIserror());
|
||||||
jo.put("message", LangProcess.msg(message));
|
jo.put("message", LangProcess.msg(message));
|
||||||
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
jo.put("notCreateTaskMessage", notCreateTaskMessage);
|
||||||
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
|
||||||
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
jo.put("feedMessage", LangProcess.msg(feedMessage));
|
||||||
jo.put("driver_type", "siemens_conveyor");
|
jo.put("driver_type", "siemens_conveyor");
|
||||||
jo.put("is_click", true);
|
jo.put("is_click", true);
|
||||||
|
|||||||
@@ -853,7 +853,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void update(TaskDto dto) {
|
public void update(TaskDto dto) {
|
||||||
TaskDto entity = this.findById(dto.getTask_id());
|
TaskDto entity = this.findById(dto.getTask_id());
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user