fix: 读空指针异常解决阻塞问题

This commit is contained in:
2024-07-24 10:01:19 +08:00
parent fd9eef0191
commit 98618cbf52
2 changed files with 215 additions and 201 deletions

View File

@@ -273,14 +273,14 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (value == null) {
setIsonline(false);
return "0";
return value;
} else {
setIsonline(true);
return value;

View File

@@ -358,12 +358,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
}
}
} catch (Exception var17) {
var17.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
//不同任务限制清零
if (!Objects.equals(task, last_task)) {
this.isonline=true;
@@ -564,6 +558,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
}
} catch (Exception var17) {
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + var17.getMessage();
var17.printStackTrace();
}
last_heartbeat = heartbeat;
last_item_deviceCode = item_deviceCode;
last_mode = mode;
@@ -924,6 +932,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
requireSucess = true;
return true;
}
//同排移库报警
if (StrUtil.equals(startDevice.getDevice_type(), DeviceType.storage.name())) {
pakagePLCData(list, nextDevice.getExtraValue().get("x").toString(), nextDevice.getExtraValue().get("z").toString(), nextDevice.getExtraValue().get("y").toString(), "2", instructionErro.getInstruction_code());
requireSucess = true;
return true;
}
}else {
message = "one_message20";
}