fix: 日志bug修改

This commit is contained in:
2024-06-24 08:56:54 +08:00
parent 420ff2fe98
commit b905eacba9
31 changed files with 197 additions and 57 deletions

View File

@@ -18,6 +18,8 @@ import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.enums.AgvSystemTypeEnum; import org.nl.acs.task.enums.AgvSystemTypeEnum;
import org.nl.common.exception.BadRequestException; import org.nl.common.exception.BadRequestException;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -41,6 +43,9 @@ public class AgvWaitUtil {
@Autowired @Autowired
private DeviceAppService deviceAppService; private DeviceAppService deviceAppService;
@Autowired
private LuceneExecuteLogService luceneExecuteLogService;
//取货前等待 //取货前等待
public JSONObject waitInGet(String startDeviceCode, Instruction inst) { public JSONObject waitInGet(String startDeviceCode, Instruction inst) {
log.info("仙工AGV请求取货设备号 - {}", startDeviceCode); log.info("仙工AGV请求取货设备号 - {}", startDeviceCode);
@@ -52,7 +57,13 @@ public class AgvWaitUtil {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(2); manipulatorAgvStationDeviceDriver.writing(2);
if(manipulatorAgvStationDeviceDriver.getAction() != 1){ if(manipulatorAgvStationDeviceDriver.getAction() != 1){
throw new BadRequestException("上位系统不允许取货"); 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("行架不允许取货");
} }
} }
@@ -60,6 +71,12 @@ 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("agv叉车对接位输送线不允许取货:" + inst.getCarno()+ "点位号"+ boxSubvolumesConveyorDeviceDriver.getDevice_code())
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
throw new BadRequestException("上位系统不允许取货"); throw new BadRequestException("上位系统不允许取货");
} }
} }
@@ -98,6 +115,12 @@ public class AgvWaitUtil {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) endDevice.getDeviceDriver();
manipulatorAgvStationDeviceDriver.writing(2); manipulatorAgvStationDeviceDriver.writing(2);
if(manipulatorAgvStationDeviceDriver.getAction() != 1){ 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); log.info("不允许仙工AGV取货,对接位有报警,设备号 - {}", endDevice);
throw new BadRequestException("上位系统不允许取货"); throw new BadRequestException("上位系统不允许取货");
} }

View File

@@ -13,7 +13,10 @@ import lombok.extern.slf4j.Slf4j;
import org.nl.acs.AcsConfig; import org.nl.acs.AcsConfig;
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.task.domain.Task;
import org.nl.acs.task.enums.AgvSystemTypeEnum; 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.config.SpringContextHolder;
import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.ISysParamService;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -30,6 +33,7 @@ public class QueryAGVStatus {
public void run() { public void run() {
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
List<Instruction> allInstFromCache = instructionService.findAllInstFromCache(); 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()); 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());
@@ -59,9 +63,16 @@ public class QueryAGVStatus {
// 等待=WAITING // 等待=WAITING
//执行中 //执行中
String state = json.getString("state"); String state = json.getString("state");
String carNo = json.getString("vehicle");
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) { if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
instruction.setInstruction_status("1"); instruction.setInstruction_status("1");
instruction.setCarno(carNo);
TaskDto task = new TaskDto();
instructionService.update(instruction); instructionService.update(instruction);
task.setCarno(carNo);
task.setTask_id(instruction.getTask_id());
instructionService.update(instruction);
taskService.update(task);
} else if ("FINISHED".equals(state)) { } else if ("FINISHED".equals(state)) {
instruction.setInstruction_status("2"); instruction.setInstruction_status("2");
try { try {

View File

@@ -745,7 +745,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
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("追加动叉车作块:") .device_code(instructionDto.getCarno())
.content("追加动叉车作块,参数:" + task_code ) .content("追加动叉车作块,参数:" + task_code )
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
@@ -754,7 +754,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
JSONObject jo = JSON.parseObject(response); JSONObject jo = JSON.parseObject(response);
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code("追加动叉车作块:") .device_code(instructionDto.getCarno())
.content("追加动叉车作块,参数,接口返回:" + jo) .content("追加动叉车作块,参数,接口返回:" + jo)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
@@ -765,7 +765,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
} else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code("追加动叉车作块:") .device_code(instructionDto.getCarno())
.content("追加动叉车作块失败,返回参数:" + jo.getString("body")) .content("追加动叉车作块失败,返回参数:" + jo.getString("body"))
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
@@ -859,7 +859,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
param.put("taskCode", task_code); param.put("taskCode", task_code);
param.put("actionType", actionType.toString()); param.put("actionType", actionType.toString());
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code("追加动诺宝作块:") .device_code(instructionDto.getCarno())
.content("追加动诺宝作块,参数:" + task_code + "--" + actionType) .content("追加动诺宝作块,参数:" + task_code + "--" + actionType)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
@@ -868,7 +868,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
JSONObject jo = JSON.parseObject(response); JSONObject jo = JSON.parseObject(response);
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code("追加动诺宝作块:") .device_code(instructionDto.getCarno())
.content("追加动诺宝作块,参数,接口返回:" + jo) .content("追加动诺宝作块,参数,接口返回:" + jo)
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
@@ -881,7 +881,7 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
} else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code("追加动诺宝作块:") .device_code(instructionDto.getCarno())
.content("追加动诺宝作块失败,返回参数:" + jo.getString("body")) .content("追加动诺宝作块失败,返回参数:" + jo.getString("body"))
.build(); .build();
logDto2.setLog_level(4); logDto2.setLog_level(4);
@@ -1343,16 +1343,16 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
JSONObject jo9 = new JSONObject(); JSONObject jo9 = new JSONObject();
jo9.put("blockId", IdUtil.simpleUUID()); jo9.put("blockId", IdUtil.simpleUUID());
jo9.put("location", inst.getNext_device_code() + "INPUT"); jo9.put("location", inst.getNext_device_code());
jo9.put("operation", "script"); jo9.put("operation", "script");
jo9.put("id", inst.getNext_device_code() + "INPUT"); jo9.put("id", inst.getNext_device_code());
jo9.put("script_name", "userpy/interact.py"); jo9.put("script_name", "userpy/interact.py");
JSONObject script_args5 = new JSONObject(); JSONObject script_args5 = new JSONObject();
script_args5.put("addr", addr); script_args5.put("addr", addr);
JSONObject data3 = new JSONObject(); JSONObject data3 = new JSONObject();
JSONObject reach3 = new JSONObject(); JSONObject reach3 = new JSONObject();
reach3.put("task_code", inst.getInstruction_code()); reach3.put("task_code", inst.getInstruction_code());
reach3.put("address", inst.getNext_device_code() + "INPUT"); reach3.put("address", inst.getNext_device_code());
data3.put("reach", reach3); data3.put("reach", reach3);
script_args5.put("data", data3); script_args5.put("data", data3);
script_args5.put("protocol", "HTTP"); script_args5.put("protocol", "HTTP");

View File

@@ -240,7 +240,7 @@ public class BoxManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver impl
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();
feedMessage = var17.getMessage(); // feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }

View File

@@ -209,6 +209,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
JSONObject led_message = null; JSONObject led_message = null;
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;
@@ -237,12 +238,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
to_container_no = this.itemProtocol.getContainer_direction(); to_container_no = this.itemProtocol.getContainer_direction();
if (move != last_move && move == 0 && last_move == 1) { if (move != last_move) {
requireSucess = false; requireSucess = false;
clearWrite(); clearWrite();
} }
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
CompletableFuture.runAsync(() -> { CompletableFuture.runAsync(() -> {
// 异步更新指令状态 // 异步更新指令状态
try { try {
@@ -826,6 +828,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
jo.put("requireSucess", requireSucess); jo.put("requireSucess", requireSucess);
jo.put("hand_barcode", hand_barcode); jo.put("hand_barcode", hand_barcode);
jo.put("materiel", material_barcode); jo.put("materiel", material_barcode);
jo.put("inst_message", this.inst_message);
jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage)); jo.put("notCreateInstMessage", LangProcess.msg(notCreateInstMessage));
return jo; return jo;
} }

View File

@@ -229,7 +229,7 @@
// //
// } catch (Exception var17) { // } catch (Exception var17) {
// var17.printStackTrace(); // var17.printStackTrace();
// feedMessage = var17.getMessage(); // // feedMessage = var17.getMessage();
// logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol)); // logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol));
// //
// } // }

View File

@@ -228,7 +228,7 @@
// //
// } catch (Exception var17) { // } catch (Exception var17) {
// var17.printStackTrace(); // var17.printStackTrace();
// feedMessage = var17.getMessage(); // // feedMessage = var17.getMessage();
// logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol)); // logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol));
// //
// } // }

View File

@@ -234,7 +234,7 @@
// //
// } catch (Exception var17) { // } catch (Exception var17) {
// var17.printStackTrace(); // var17.printStackTrace();
// feedMessage = var17.getMessage(); // // feedMessage = var17.getMessage();
// logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol)); // logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.standardItemProtocol));
// //
// } // }

View File

@@ -167,6 +167,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
String vehicle_code; String vehicle_code;
String last_vehicle_code; String last_vehicle_code;
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;
@@ -199,6 +200,7 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
} }
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
update_instruction_status(); update_instruction_status();
} }
} catch (Exception var17) { } catch (Exception var17) {

View File

@@ -196,7 +196,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
} }
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
update_instruction_status(); update_instruction_status();
} }
} catch (Exception var17) { } catch (Exception var17) {
@@ -737,7 +737,6 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
this.instruction_update_time = date; this.instruction_update_time = date;
inst = checkInst(); inst = checkInst();
if (inst != null) { if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
vehicle_code = inst.getVehicle_code(); vehicle_code = inst.getVehicle_code();
task_code = inst.getTask_code(); task_code = inst.getTask_code();
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {

View File

@@ -199,7 +199,6 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
if (move != 0 && task > 0) { if (move != 0 && task > 0) {
update_instruction_status(); update_instruction_status();
} }

View File

@@ -680,6 +680,7 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
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("inst_message", this.inst_message);
jo.put("driver_type", "siemens_conveyor"); jo.put("driver_type", "siemens_conveyor");
jo.put("is_click", true); jo.put("is_click", true);
return jo; return jo;

View File

@@ -1026,6 +1026,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "conveyor_with_scanner_weight"); jo.put("driver_type", "conveyor_with_scanner_weight");
jo.put("is_click", true); jo.put("is_click", true);
jo.put("inst_message", this.inst_message);
return jo; return jo;
} }

View File

@@ -43,6 +43,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 装箱智能行架 * 装箱智能行架
@@ -86,6 +87,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
// y坐标 // y坐标
float y = 0.0f; float y = 0.0f;
float last_y = 0.0f; float last_y = 0.0f;
String inst_message;
int heartbeat = 0; int heartbeat = 0;
int last_heartbeat = 0; int last_heartbeat = 0;
@@ -188,6 +190,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
// 更新指令状态 // 更新指令状态
if (mode == 3 && task > 0) { if (mode == 3 && task > 0) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
updateInstrction(); updateInstrction();
} }
@@ -336,8 +339,9 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
//先查指令 //先查指令
List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (CollUtil.isNotEmpty(taskDtoInstruction)){ List<TaskDto> taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
TaskDto taskDtoIns = taskDtoInstruction.get(0); if (CollUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDtoIns = taskDtoStream.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code());
String interactionJson = taskDtoIns.getInteraction_json(); String interactionJson = taskDtoIns.getInteraction_json();
@@ -644,6 +648,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("is_click", true); jo.put("is_click", true);
jo.put("x", x); jo.put("x", x);
jo.put("y", y); jo.put("y", y);
jo.put("inst_message", this.inst_message);
return jo; return jo;
} }

View File

@@ -46,6 +46,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 木箱入库行架 * 木箱入库行架
@@ -106,6 +107,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int branchProtocol = 0; int branchProtocol = 0;
private String error_type = "hxhj_error_type"; private String error_type = "hxhj_error_type";
String inst_message;
//暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域
int flag; int flag;
@@ -158,6 +160,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} }
// 更新指令状态 // 更新指令状态
if (mode == 3 && task > 0 && !requireActionSucess) { if (mode == 3 && task > 0 && !requireActionSucess) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
updateInstructionStatus(); updateInstructionStatus();
} }
@@ -302,8 +305,9 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
//先查指令 //先查指令
List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (CollUtil.isNotEmpty(taskDtoInstruction)) { List<TaskDto> taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
TaskDto taskDtoIns = taskDtoInstruction.get(0); if (CollUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDtoIns = taskDtoStream.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code());
String interactionJson = taskDtoIns.getInteraction_json(); String interactionJson = taskDtoIns.getInteraction_json();
@@ -596,6 +600,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
jo.put("feedMessage", LangProcess.msg(feedMessage)); jo.put("feedMessage", LangProcess.msg(feedMessage));
jo.put("driver_type", "box_storage_manipulator"); jo.put("driver_type", "box_storage_manipulator");
jo.put("is_click", true); jo.put("is_click", true);
jo.put("inst_message", this.inst_message);
return jo; return jo;
} }

View File

@@ -47,6 +47,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 退货入库行架 * 退货入库行架
@@ -141,6 +142,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
List<String> getDeviceCodeList = null; List<String> getDeviceCodeList = null;
List<String> putDeviceCodeList = null; List<String> putDeviceCodeList = null;
String inst_message;
@Override @Override
@@ -171,6 +173,8 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
// 更新指令状态 // 更新指令状态
if (mode == 3 && task > 0) { if (mode == 3 && task > 0) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
updateInstructionStatus(); updateInstructionStatus();
} }
@@ -319,8 +323,9 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
//先查指令 //先查指令
List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (CollUtil.isNotEmpty(taskDtoInstruction)) { List<TaskDto> taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
TaskDto taskDtoIns = taskDtoInstruction.get(0); if (CollUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDtoIns = taskDtoStream.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code());
String interactionJson = taskDtoIns.getInteraction_json(); String interactionJson = taskDtoIns.getInteraction_json();
@@ -610,6 +615,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
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);
jo.put("inst_message", this.inst_message);
return jo; return jo;
} }

View File

@@ -42,6 +42,8 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* 捆扎智能行架 * 捆扎智能行架
@@ -130,6 +132,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
String notCreateTaskMessage = ""; String notCreateTaskMessage = "";
String notCreateInstMessage = ""; String notCreateInstMessage = "";
String feedMessage = ""; String feedMessage = "";
String inst_message;
List<String> getDeviceCodeList = null; List<String> getDeviceCodeList = null;
@@ -165,12 +168,14 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
} }
// 更新指令状态 // 更新指令状态
if (mode == 3 && task > 0) { if (mode == 3 && task > 0) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
updateInstructionStatus(); updateInstructionStatus();
} }
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();
feedMessage = var17.getMessage(); // feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }
@@ -311,8 +316,9 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
//先查指令 //先查指令
List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (CollUtil.isNotEmpty(taskDtoInstruction)) { List<TaskDto> taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
TaskDto taskDtoIns = taskDtoInstruction.get(0); if (CollUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDtoIns = taskDtoStream.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code());
String interactionJson = taskDtoIns.getInteraction_json(); String interactionJson = taskDtoIns.getInteraction_json();
@@ -353,8 +359,19 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
return true; return true;
} }
} else { } else {
TaskDto taskDto = taskserver.findByStartCodeAndReady(startDeviceCode); List<TaskDto> taskDtos = taskserver.findByTrappedManipulatorReady();
if (ObjectUtil.isNotEmpty(taskDto) && TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) { List<TaskDto> taskDtosReady = new ArrayList<>();
TaskDto taskDto = new TaskDto();
for (TaskDto taskDto1 : taskDtos) {
if (getDeviceCodeList.contains(taskDto1.getStart_device_code())){
taskDtosReady.add(taskDto1);
}
}
if (CollUtil.isNotEmpty(taskDtosReady)) {
List<TaskDto> taskDtoList = taskDtosReady.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
taskDto = taskDtoList.get(0);
}
if (ObjectUtil.isNotEmpty(taskDto)) {
String interactionJson = taskDto.getInteraction_json(); String interactionJson = taskDto.getInteraction_json();
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class); InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
String start_device_code = taskDto.getStart_device_code(); String start_device_code = taskDto.getStart_device_code();
@@ -624,6 +641,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
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);
jo.put("inst_message", this.inst_message);
return jo; return jo;
} }

View File

@@ -46,6 +46,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto; import org.nl.config.lucene.service.dto.LuceneLogDto;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 捆扎智能行架 * 捆扎智能行架
@@ -151,6 +152,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
List<String> getDeviceCodeList = null; List<String> getDeviceCodeList = null;
List<String> putDeviceCodeList = null; List<String> putDeviceCodeList = null;
String inst_message;
@Override @Override
@@ -185,6 +187,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
} }
// 更新指令状态 // 更新指令状态
if (mode == 3 && task > 0) { if (mode == 3 && task > 0) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() ;
updateInstructionStatus(); updateInstructionStatus();
} }
@@ -335,8 +339,9 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
String startDeviceCode = getDeviceCodeList.get(i); String startDeviceCode = getDeviceCodeList.get(i);
//先查指令 //先查指令
List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode); List<TaskDto> taskDtoInstruction = taskserver.queryTaskByDeviceCodeAndStatus2(startDeviceCode);
if (CollUtil.isNotEmpty(taskDtoInstruction)) { List<TaskDto> taskDtoStream = taskDtoInstruction.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
TaskDto taskDtoIns = taskDtoInstruction.get(0); if (CollUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDtoIns = taskDtoStream.get(0);
if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) { if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDtoIns.getTask_type())) {
Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code()); Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDtoIns.getTask_code());
String start_device_code = taskDtoIns.getStart_device_code(); String start_device_code = taskDtoIns.getStart_device_code();
@@ -641,6 +646,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
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);
jo.put("inst_message", this.inst_message);
return jo; return jo;
} }

View File

@@ -343,7 +343,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else { } else {
this.instruction_update_time = date; this.instruction_update_time = date;
//更改指令状态 //更改指令状态
if (task > 0) { if (task > 0 && !Objects.equals(command, last_command)) {
Instruction inst = checkInst(); Instruction inst = checkInst();
if (inst != null) { if (inst != null) {
if (StrUtil.equals(inst.getInstruction_status(), "0")) { if (StrUtil.equals(inst.getInstruction_status(), "0")) {
@@ -363,29 +363,28 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
//不同任务限制清零 //不同任务限制清零
if (!Objects.equals(task, last_task)) { if (!Objects.equals(task, last_task)) {
this.isonline=true;
count = 0; count = 0;
} }
if (mode == 0) { if (mode == 0) {
this.setIsonline(false); this.setIsonline(false);
message = "universal_off"; message = "universal_off";
} else if (error != 0) { }else {
this.setIsonline(true);
}
if (error != 0) {
this.setIserror(true); this.setIserror(true);
message = "universal_message3"; message = "universal_message3";
} else {
this.setIserror(false);
} }
if (mode != 3 || requireSucess) { if (mode != 3 || requireSucess) {
message = "one_message7"; message = "one_message7";
} else { } else {
if (error != 0) { if (error != 0) {
Date date = new Date();
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
} else {
//满入空出或者浅货位阻挡
erroBlock(); erroBlock();
} }
}
List list = new ArrayList(); List list = new ArrayList();
switch (command) { switch (command) {
case 0: case 0:
@@ -402,6 +401,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
message = "universal_delivery"; message = "universal_delivery";
if (updateCommand("1")) break; if (updateCommand("1")) break;
break; break;
case 2: case 2:
@@ -592,6 +592,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} }
instruction0.setExecute_message(string); instruction0.setExecute_message(string);
instructionService.update(instruction0); instructionService.update(instruction0);
} }
private static void packageDevicePoint(Device nextDevice, List list) { private static void packageDevicePoint(Device nextDevice, List list) {
@@ -690,7 +691,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out);
return; return;
} else { } else {
Instruction instruction = instructionService.findByCode(String.valueOf(task)); Instruction instruction = instructionService.findByDeviceCodeRunFromCache(String.valueOf(task));
if (ObjectUtil.isEmpty(instruction)) { if (ObjectUtil.isEmpty(instruction)) {
message = "one_message9"; message = "one_message9";
return; return;
@@ -699,6 +700,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
param.put("task_code", instruction.getTask_code()); param.put("task_code", instruction.getTask_code());
param.put("task_id", instruction.getTask_id()); param.put("task_id", instruction.getTask_id());
param.put("type", type); param.put("type", type);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(device_code)
.content("申请更新点位,参数:" + param)
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
String response = acsToWmsService.applyUpdatePointCode(param); String response = acsToWmsService.applyUpdatePointCode(param);
JSONObject jo = JSON.parseObject(response); JSONObject jo = JSON.parseObject(response);
if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) { if (StrUtil.isNotEmpty(jo.getString("body")) || jo.getInteger("status") == 200) {

View File

@@ -198,7 +198,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();
feedMessage = var17.getMessage(); // feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }

View File

@@ -249,7 +249,7 @@ public class PullHeadManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();
feedMessage = var17.getMessage(); // feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }

View File

@@ -274,7 +274,7 @@ public class PullTailManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
} catch (Exception var17) { } catch (Exception var17) {
var17.printStackTrace(); var17.printStackTrace();
feedMessage = var17.getMessage(); // feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
} }

View File

@@ -601,7 +601,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public String getBoxInfo(JSONObject param) { public String getBoxInfo(JSONObject param) {
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
log.info("applyTaskToWms-----输入参数{}", param); log.info("getBoxInfo-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("getBoxInfo"); AddressDto addressDto = addressService.findByCode("getBoxInfo");
String url = wmsurl + addressDto.getMethods_url(); String url = wmsurl + addressDto.getMethods_url();
@@ -766,7 +766,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
public String applyUpdatePointCode(JSONObject param) { public String applyUpdatePointCode(JSONObject param) {
try { try {
MDC.put(log_file_type, log_type); MDC.put(log_file_type, log_type);
log.info("deviceApplyExceptional-----输入参数{}", param); log.info("applyUpdatePointCode-----输入参数{}", param);
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
AddressDto addressDto = addressService.findByCode("deviceApplyExceptional"); AddressDto addressDto = addressService.findByCode("deviceApplyExceptional");
String url = wmsurl + addressDto.getMethods_url(); String url = wmsurl + addressDto.getMethods_url();
@@ -778,11 +778,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
.execute(); .execute();
} catch (Exception e) { } catch (Exception e) {
String msg = e.getMessage(); String msg = e.getMessage();
log.info("deviceApplyExceptional-----输出参数{}", msg); log.info("applyUpdatePointCode-----输出参数{}", msg);
//网络不通 //网络不通
} }
if (ObjectUtil.isEmpty(result2)) { if (ObjectUtil.isEmpty(result2)) {
log.info("deviceApplyExceptional-----输出参数{}", "返回结果为空"); log.info("applyUpdatePointCode-----输出参数{}", "返回结果为空");
return null; return null;
} }
String type = ""; String type = "";
@@ -791,8 +791,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
} else { } else {
type = "error"; type = "error";
} }
log.info("deviceApplyExceptional-----输出参数{}", result2.body()); log.info("applyUpdatePointCode-----输出参数{}", result2.body());
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"deviceApplyExceptional", String.valueOf(result2.getStatus()), LuceneLogDto luceneLogDto = new LuceneLogDto(4,"applyUpdatePointCode", String.valueOf(result2.getStatus()),
JSON.toJSONString(param), String.valueOf(result2.body()), "申请更新点位"); JSON.toJSONString(param), String.valueOf(result2.body()), "申请更新点位");
luceneLogService.interfaceExecuteLog(luceneLogDto); luceneLogService.interfaceExecuteLog(luceneLogDto);
return result2.body(); return result2.body();

View File

@@ -342,6 +342,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
*/ */
Instruction findByStartCodeAndReady(String device_code); Instruction findByStartCodeAndReady(String device_code);
/**
* 根据起点设备编号查询当前是否有运行的指令
*
* @param device_code
* @return
*/
Instruction findByDeviceCodeRunFromCache(String device_code);
/** /**
* 根据终点设备编号查询当前是否有就绪指令 * 根据终点设备编号查询当前是否有就绪指令
* *

View File

@@ -1536,6 +1536,30 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
} }
@Override
public Instruction findByDeviceCodeRunFromCache(String devicecode) {
List<Instruction> instructionList = instructions;
ListUtil.sort(
instructionList,
new Comparator<Instruction>() {
@Override
public int compare(Instruction o1, Instruction o2) {
return o1.getCreate_time().compareTo(o2.getCreate_time());
}
});
Iterator<Instruction> it = instructions.iterator();
while (it.hasNext()) {
Instruction inst = it.next();
if (StrUtil.equals(devicecode, inst.getStart_device_code())
&& inst.getInstruction_status().equals(InstructionStatusEnum.BUSY.getIndex())) {
return inst;
}
}
return null;
}
@Override @Override
public Instruction findByNextDeviceCodeFromCache(String devicecode) { public Instruction findByNextDeviceCodeFromCache(String devicecode) {
List<Instruction> instructionList = instructions; List<Instruction> instructionList = instructions;

View File

@@ -19,7 +19,7 @@ public enum AgvActionTypeEnum {
/** /**
* 防货二次分配 * 防货二次分配
*/ */
OUT_STOCK(3, "货二次分配"), OUT_STOCK(3, "货二次分配"),
/** /**
* 取放货二次分配 * 取放货二次分配
*/ */

View File

@@ -390,6 +390,13 @@ public interface TaskService extends CommonService<Task> {
TaskDto findByStartCodeAndReady(String device_code); TaskDto findByStartCodeAndReady(String device_code);
/**
* 查找符合条件的堆叠行架任务
* @return
*/
List<TaskDto> findByTrappedManipulatorReady();
/** /**
* 根据起载具号查询就绪任务 * 根据起载具号查询就绪任务
* *

View File

@@ -1107,6 +1107,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return optionalTask.orElse(null); return optionalTask.orElse(null);
} }
@Override
public List<TaskDto> findByTrappedManipulatorReady() {
//根据时间升序取第一个
List<TaskDto> taskDtoList = tasks.stream()
.filter(task -> StrUtil.equals(task.getTask_type(), TaskTypeEnum.Truss_Task.getIndex())
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())).collect(Collectors.toList());
return taskDtoList;
}
@Override @Override
public TaskDto findByVehicleCodeCodeAndReady(String vehicleCode) { public TaskDto findByVehicleCodeCodeAndReady(String vehicleCode) {
Optional<TaskDto> optionalTask = tasks.stream() Optional<TaskDto> optionalTask = tasks.stream()

View File

@@ -82,7 +82,6 @@ public class StageController {
} }
@PostMapping("/getNewStageDataByCode") @PostMapping("/getNewStageDataByCode")
@Log("根据stage_code获取舞台数据")
public ResponseEntity<Object> getNewStageDataByCode(@RequestBody String code) { public ResponseEntity<Object> getNewStageDataByCode(@RequestBody String code) {
Stage one = stageService.getOne(new LambdaQueryWrapper<Stage>().eq(Stage::getStage_code, code)); Stage one = stageService.getOne(new LambdaQueryWrapper<Stage>().eq(Stage::getStage_code, code));
return new ResponseEntity<>(one, HttpStatus.CREATED); return new ResponseEntity<>(one, HttpStatus.CREATED);

View File

@@ -57,10 +57,10 @@ public class CreateDDJInst {
String next_device_code = taskDto.getNext_device_code(); String next_device_code = taskDto.getNext_device_code();
Device nextDevice = appService.findDeviceByCode(next_device_code); Device nextDevice = appService.findDeviceByCode(next_device_code);
//判断有无出入库任务是相同路线 //判断有无出入库任务是相同路线
TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code); // TaskDto dto = taskserver.findByCodeAndExcute(next_device_code, start_device_code);
if (ObjectUtil.isNotEmpty(dto)) { // if (ObjectUtil.isNotEmpty(dto)) {
continue; // continue;
} // }
if (startDevice.getDevice_type().equals(DeviceType.storage.name()) && if (startDevice.getDevice_type().equals(DeviceType.storage.name()) &&
(nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) { (nextDevice.getDevice_type().equals(DeviceType.conveyor.name()) || nextDevice.getDevice_type().equals(DeviceType.storage.name()))) {
taskDtoList.add(taskDto); taskDtoList.add(taskDto);
@@ -316,6 +316,12 @@ public class CreateDDJInst {
String count = deviceByCode.getExtraValue().get("count").toString(); String count = deviceByCode.getExtraValue().get("count").toString();
if (StrUtil.isNotEmpty(count)) { if (StrUtil.isNotEmpty(count)) {
if (max <= Integer.parseInt(count)) { if (max <= Integer.parseInt(count)) {
//判断有没有DDJ对接位出入库的指令
List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)){
((StandardStackerDeviceDriver) deviceByCode.getDeviceDriver()).setNotCreateInstMessage("有DDJ对接位出入库的指令");
continue;
}
instdto.setInstruction_type(task_type); instdto.setInstruction_type(task_type);
instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setInstruction_id(IdUtil.simpleUUID());
instdto.setRoute_plan_code(route_plan_code); instdto.setRoute_plan_code(route_plan_code);

View File

@@ -22,6 +22,7 @@ https://juejin.cn/post/6844903775631572999
<include resource="log/LMSToACS.xml"/> <include resource="log/LMSToACS.xml"/>
<include resource="log/TwoNDCSocketConnectionAutoRun.xml"/> <include resource="log/TwoNDCSocketConnectionAutoRun.xml"/>
<include resource="log/NDCAgvServiceImpl.xml"/> <include resource="log/NDCAgvServiceImpl.xml"/>
<include resource="log/XgAgvDeviceDriver.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--withJansi 参数改为true--> <!--withJansi 参数改为true-->