opt: 一期分切行架下发指令优化,二期设备驱动优化

This commit is contained in:
yanps
2025-01-18 13:23:10 +08:00
parent 98d9dfd024
commit ddf73d75e8
9 changed files with 64 additions and 21 deletions

View File

@@ -678,6 +678,13 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
}
if (!ObjectUtil.isEmpty(taskDto)) {
if (taskDto.getStart_device_code().endsWith("X")) {
Boolean result = this.checkIsSafe(taskDto.getStart_device_code(), taskDto);
if (!result) {
notCreateInstMessage = "该设备存在上工位任务,此任务无法执行!";
return false;
}
}
flag = this.executeReadyBusiness(taskDto, getDeviceCodeList, backGetDeviceCodeList);
if (flag) {
notCreateInstMessage = "";

View File

@@ -245,10 +245,13 @@ public class XianGongAgvServiceImpl implements XianGongAgvService {
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
agvurl = agvurl + ":" + agvport + "/api/route/transportOrders/" + instCode + "/withdrawal";
agvurl = agvurl + ":" + agvport + "/terminate";
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", instCode);
jsonObject.put("disableVehicle", false);
log.info("删除agv指令请求agvurl:{}", agvurl);
HttpResponse result = HttpRequest.post(agvurl)
//超时,毫秒
.body(jsonObject.toJSONString())
.timeout(20000)
.execute();
log.info("删除agv指令请求反馈:{}", result);

View File

@@ -40,6 +40,7 @@ import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.utils.DeviceErrorUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
@@ -144,8 +145,8 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
/**
* 下发命令
*/
int to_command = 0;
int last_to_command = 0;
String to_command = null;
String last_to_command = null;
/**
* 下发目标站
*/
@@ -335,13 +336,14 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
} catch (Exception var17) {
this.iserror = true;
message = "读取信号值时出现异常";
String extracted = DeviceErrorUtil.extracted(var17);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null")
.content(this.device_code + extracted + ",报错信息:" + var17.getMessage())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常";
var17.printStackTrace();
}

View File

@@ -121,8 +121,8 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_to_target);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
public String getTo_command() {
return this.getOpcStringValue(item_to_command);
}
public int getTo_container_type() {

View File

@@ -49,6 +49,7 @@ import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.taskscreen.service.TaskScreenService;
import org.nl.acs.utils.DeviceErrorUtil;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
@@ -114,11 +115,11 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
int to_command = 0;
int last_to_command = 0;
int to_target = 0;
int last_to_target = 0;
String to_target = null;
String last_to_target = null;
int to_task = 0;
int last_to_task = 0;
String to_task = null;
String last_to_task = null;
int to_container_type = 0;
int last_to_container_type = 0;
@@ -144,7 +145,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
String last_barcode = null;
//子卷条码
//木箱条码
String material_barcode = null;
String last_material_barcode = null;
@@ -409,9 +410,10 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
}
} catch (Exception e) {
this.iserror = true;
String extracted = DeviceErrorUtil.extracted(e);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.content(this.device_code + extracted + ",报错信息:" + e.getMessage())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
@@ -1102,7 +1104,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
this.writing(list);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
.content(device_code + instdto.getInstruction_code() + "再次下发电气信号")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
try {

View File

@@ -132,16 +132,16 @@ public class ItemProtocol {
public Float getWeight(){
return this.getOpcFloatValue(item_weight);
}
public int getTo_task() {
return this.getOpcIntegerValue(item_to_task);
public String getTo_task() {
return this.getOpcStringValue(item_to_task);
}
public int getTo_command() {
return this.getOpcIntegerValue(item_to_command);
}
public int getTo_target() {
return this.getOpcIntegerValue(item_to_target);
public String getTo_target() {
return this.getOpcStringValue(item_to_target);
}
public int getContainer_type(){

View File

@@ -39,6 +39,7 @@ import org.nl.acs.task.enums.TaskStatusEnum;
import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.utils.DeviceErrorUtil;
import org.nl.common.exception.BadRequestException;
import org.nl.common.utils.SecurityUtils;
import org.nl.config.SpringContextHolder;
@@ -228,9 +229,10 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} catch (Exception e) {
this.iserror = true;
String extracted = DeviceErrorUtil.extracted(e);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.content(this.device_code + extracted + ",报错信息:" + e.getMessage())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);

View File

@@ -885,7 +885,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
} else {
//维修解警后重新向堆垛机下发指令
Instruction instructionErro = checkInst();
if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status()) && StrUtil.isNotEmpty(instructionErro.getExecute_code())) {
if (ObjectUtil.isNotEmpty(instructionErro) && InstructionStatusEnum.BUSY.getIndex().equals(instructionErro.getInstruction_status())
&& StrUtil.isNotEmpty(instructionErro.getExecute_code())) {
if (StrUtil.isEmpty(instructionErro.getExecute_message())) {
String start_device_code = instructionErro.getStart_device_code();
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);

View File

@@ -0,0 +1,26 @@
package org.nl.acs.utils;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.logging.annotation.Log;
@Slf4j
public class DeviceErrorUtil {
public static String extracted(Exception var17) {
StringBuffer errorStack = new StringBuffer();
errorStack.append("<br/>【异常堆栈:");
int x = 0;
StackTraceElement[] stackTrace = var17.getStackTrace();
if (stackTrace != null && stackTrace.length > 0) {
for (StackTraceElement stack : stackTrace) {
x++;
errorStack.append(stack.toString().replaceAll("<", ">")).append("<br/>");
if (x > 10) {
break;
}
}
}
return errorStack.append("").toString();
}
}