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

This commit is contained in:
2024-07-24 09:01:30 +08:00
parent 4a6c1c7af4
commit fd9eef0191
27 changed files with 867 additions and 738 deletions

View File

@@ -256,82 +256,88 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
}
});
}
//申请空托盘出库
if (mode == 8 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
}else {
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
}
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("弃用(留作兼容)");
break;
case 2:
//申请任务
if (move == 1 && !requireSucess) {
instruction_require();
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
break;
case 3:
log.info("运行中");
break;
case 4:
//申请出货
if (move == 1 && !requireSucess) {
//request_for_shipment(String.valueOf(mode), item_out_seq_arr, item_out_qty_arr);
}
break;
default:
break;
}
}
} 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();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
//申请空托盘出库
if (mode == 8 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
}else {
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
}
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("弃用(留作兼容)");
break;
case 2:
//申请任务
if (move == 1 && !requireSucess) {
instruction_require();
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
break;
case 3:
log.info("运行中");
break;
case 4:
//申请出货
if (move == 1 && !requireSucess) {
//request_for_shipment(String.valueOf(mode), item_out_seq_arr, item_out_qty_arr);
}
break;
default:
break;
}
}
last_heartbeat = heartbeat;
last_mode = mode;
last_move = move;

View File

@@ -139,7 +139,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
@@ -152,7 +152,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public int[] getOpcArrayValue(String protocol) {

View File

@@ -242,10 +242,11 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code+ "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol))
.content(this.device_code+ "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + var17.getMessage();
var17.printStackTrace();
}

View File

@@ -150,7 +150,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}

View File

@@ -192,80 +192,88 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
requireSucess = false;
}
if (move != 0 && task > 0) {
if (null!=inst) {
if (null != inst) {
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
}
update_instruction_status();
}
} catch (Exception var17) {
var17.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (move != last_move && move == 0 && last_move == 1) {
requireSucess = false;
clearWrite();
}
if (mode == 0) {
this.setIsonline(false);
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
if (move != last_move && move == 0 && last_move == 1) {
requireSucess = false;
clearWrite();
}
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
break;
case 19:
//申请AGV任务
if (move == 1 && !requireSucess) {
if (StrUtil.isEmpty(material_barcode)) {
message = "条码为空";
}else {
applyAgvTask();
}
if (mode == 0) {
this.setIsonline(false);
}
break;
case 2:
//申请任务
if (move > 0 && !requireSucess) {
instruction_require();
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
break;
case 19:
//申请AGV任务
if (move == 1 && !requireSucess) {
if (StrUtil.isEmpty(material_barcode)) {
message = "条码为空";
} else {
applyAgvTask();
}
}
if (requireSucess) {
remark = "universal_remark5";
break;
case 2:
//申请任务
if (move > 0 && !requireSucess) {
instruction_require();
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
this.setNotCreateInstMessage(remark);
//}
}
break;
break;
}
}
} 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_mode = mode;
last_move = move;
last_carrier_direction = carrier_direction;
@@ -390,7 +398,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
this.writing(list);
logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo);
requireSucess = true;
}else {
} else {
message = "申请AGV任务报错,参数,接口返回:" + jo;
this.iserror = true;
}
@@ -426,6 +434,7 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
itemMap.put(to_command, command);
this.control(itemMap);
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();

View File

@@ -142,7 +142,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
@@ -153,7 +153,7 @@ public class ItemProtocol {
} else {
return value;
}
return "";
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -200,105 +200,113 @@ public class FinishedProductOutBindLableDeviceDriver extends AbstractOpcDeviceDr
if (move != 0 && task > 0) {
update_instruction_status();
}
if (move != last_move && move==0 && last_move==1) {
requireSucess = false;
clearWrite();
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
//有报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有警报";
}
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
break;
case 2:
//申请任务
if (move > 0 && !requireSucess) {
instruction_require();
}else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
break;
case 5:
//申请贴标
applyLabeling(mode);
break;
case 10:
//申请捆轧贴标信息
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 12:
//申请贴标(未贴标)
applyLabeling(mode);
break;
case 13:
//申请捆轧贴标信息(未捆扎)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 14:
//申请捆轧贴标信息(未贴标)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 16:
//申请捆轧贴标信息(未贴标,未捆扎)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
case 17:
//申请调试贴标
if(move > 0 && !requireSucess){
applyLaStrangulationAndLabeling(mode);
}
break;
}
}
} 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();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (move != last_move && move==0 && last_move==1) {
requireSucess = false;
clearWrite();
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
//有报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有警报";
}
Instruction instruction = null;
List toInstructions;
switch (mode) {
case 1:
log.debug("设备运转模式:等待工作");
break;
case 2:
//申请任务
if (move > 0 && !requireSucess) {
instruction_require();
}else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
break;
case 5:
//申请贴标
applyLabeling(mode);
break;
case 10:
//申请捆轧贴标信息
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 12:
//申请贴标(未贴标)
applyLabeling(mode);
break;
case 13:
//申请捆轧贴标信息(未捆扎)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 14:
//申请捆轧贴标信息(未贴标)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
break;
case 16:
//申请捆轧贴标信息(未贴标,未捆扎)
if (move > 0 && !requireSucess) {
applyLaStrangulationAndLabeling(mode);
}
case 17:
//申请调试贴标
if(move > 0 && !requireSucess){
applyLaStrangulationAndLabeling(mode);
}
break;
}
}
last_mode = mode;
last_move = move;
last_carrier_direction = carrier_direction;

View File

@@ -194,7 +194,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
@@ -205,7 +205,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -198,101 +198,109 @@ public class FoldDiscSiteDeviceDriver extends AbstractOpcDeviceDriver implements
if (move != 0 && task > 0) {
update_instruction_status();
}
if (move != last_move && move == 0 && last_move == 1) {
requireSucess = false;
clearWrite();
}
//托盘去扫码位
if (mode == 4) {
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", 0);
list1.add(map);
this.writing(list1);
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//申请空托盘入库
if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
}
}
//申请空托盘出库
if (mode == 8 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
}
}
//碟盘位申请任务
if (mode == 2 && move == 1 && !requireSucess) {
boolean res = instruction_require();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
if (mode == 2) {
//if (!requireSucess) {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = LangProcess.msg("universal_remark4");
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = LangProcess.msg("universal_remark5");
}
this.setNotCreateTaskMessage(remark);
//}
}
}
}
} 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();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (move != last_move && move == 0 && last_move == 1) {
requireSucess = false;
clearWrite();
}
//托盘去扫码位
if (mode == 4) {
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", 0);
list1.add(map);
this.writing(list1);
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//申请空托盘入库
if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
}
}
//申请空托盘出库
if (mode == 8 && !requireSucess) {
if (container_type == 0) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_OUT.getType(), mode);
}
}
//碟盘位申请任务
if (mode == 2 && move == 1 && !requireSucess) {
boolean res = instruction_require();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
if (mode == 2) {
//if (!requireSucess) {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = LangProcess.msg("universal_remark4");
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = LangProcess.msg("universal_remark5");
}
this.setNotCreateTaskMessage(remark);
//}
}
}
}
last_mode = mode;
last_move = move;
last_action = action;

View File

@@ -112,7 +112,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public String getOpcStringValue(String protocol) {
@@ -123,7 +123,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -243,15 +243,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode + "复位请求标记:" + requireSucess);
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (mode == -99){
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("PLC断连需重启程序")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException("PLC断连需重启程序");
}
if (move != last_move && move == 0 && last_move == 1) {
@@ -287,105 +278,113 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
update_instruction_status();
}
} catch (Exception e) {
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace()));
}
if (mode == 0) {
this.setIsonline(false);
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//申请异常位任务
applyErrorTask();
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//木箱入库申请入库任务
if (mode == 6 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空";
} else {
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
}
}
//子卷入库申请入库任务
if (mode == 7 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空";
} else {
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
}
}
//申请空托盘入库
if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0 || StrUtil.isEmpty(barcode)) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
}
}
//申请退货入库
if (mode == 18 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空";
} else {
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
}
}
//申请高度
if (mode == 23 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "条码为空";
} else {
applyErrorHeight();
}
}
//申请入库指令、异常位指令
if (mode == 2 && move == 1 && !requireSucess) {
boolean res = instruction_require();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
if (mode == 0) {
this.setIsonline(false);
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//申请异常位任务
applyErrorTask();
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//木箱入库申请入库任务
if (mode == 6 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空";
} else {
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
}
}
if (move != 0) {
remark = "universal_remark3";
//子卷入库申请入库任务
if (mode == 7 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空";
} else {
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
}
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
//申请空托盘入库
if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0 || StrUtil.isEmpty(barcode)) {
message = "托盘类型为空";
} else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
//申请退货入库
if (mode == 18 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空";
} else {
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
}
}
//申请高度
if (mode == 23 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "条码为空";
} else {
applyErrorHeight();
}
}
//申请入库指令、异常位指令
if (mode == 2 && move == 1 && !requireSucess) {
boolean res = instruction_require();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
}
} catch (Exception e) {
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + e.getMessage();
e.printStackTrace();
}
last_mode = mode;
last_move = move;
last_action = action;

View File

@@ -166,7 +166,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public int getOpcIntegerValue(String protocol) {
@@ -178,7 +178,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return -99;
return value;
}
@@ -191,7 +191,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}

View File

@@ -178,7 +178,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
@@ -189,7 +189,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -178,48 +178,55 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
to_target = this.itemProtocol.getTo_target();
to_task = this.itemProtocol.getTo_task();
heartbeat = this.itemProtocol.getHeartbeat();
if (mode != last_mode) {
} catch (Exception e) {
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace()));
}
if (mode != last_mode) {
requireSucess = false;
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
//有报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
inst = checkInst();
if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
requireSucess = false;
}
if (mode == 0) {
this.setIsonline(false);
message = "脱机";
Instruction instruction = instructionService.findByCode(String.valueOf(task));
//空箱出库开盖位,申请开盖
if (mode == 15 && move == 1 && task > 0 ) {
//不允许开盖,完成出库任务,自动去扫码位
if (StrUtil.isEmpty(instruction.getVehicle_code())){
message = "任务托盘码为空";
//有报警
} else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
inst = checkInst();
if (inst != null) {
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
}
applyUnbox(instruction.getVehicle_code());
Instruction instruction = instructionService.findByCode(String.valueOf(task));
//空箱出库开盖位,申请开盖
if (mode == 15 && move == 1 && task > 0 ) {
//不允许开盖,完成出库任务,自动去扫码位
if (StrUtil.isEmpty(instruction.getVehicle_code())){
message = "任务托盘码为空";
}
applyUnbox(instruction.getVehicle_code());
}
}
} catch (Exception e) {
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + e.getMessage();
e.printStackTrace();
}
last_mode =mode;
last_move =move;
last_carrier_direction =carrier_direction;

View File

@@ -194,59 +194,66 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
updateInstrction();
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
} catch (Exception e) {
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace()));
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
}else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
//行架机械手申请任务
if (mode == 2 && move == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
}else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
}
} catch (Exception e) {
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + e.getMessage();
e.printStackTrace();
}
last_mode = mode;
last_move = move;
last_action = action;

View File

@@ -199,7 +199,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public float getOpcFloatValue(String protocol) {
@@ -211,7 +211,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}

View File

@@ -164,64 +164,68 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
updateInstructionStatus();
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
} catch (Exception e) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("读取信号值时出现异常" + this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.device_code + "." + Arrays.toString(e.getStackTrace()))
.build();
logDto.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
} catch (Exception e) {
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + e.getMessage();
e.printStackTrace();
}
last_mode =mode;
last_action = action;

View File

@@ -199,7 +199,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public String getOpcStringValue(String protocol) {
@@ -209,7 +209,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -173,7 +173,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public int getOpcIntegerValue(String protocol) {
@@ -184,7 +184,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -177,60 +177,68 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
updateInstructionStatus();
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
}
} catch (Exception e) {
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + Arrays.toString(e.getStackTrace()));
this.iserror = true;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(this.device_code + "读取信号值时出现异常:" + e.getMessage() + ",this.itemProtocol is null")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
message = "读取信号值时出现异常:" + e.getMessage();
e.printStackTrace();
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
}
last_mode = mode;
last_move = move;
last_action = action;

View File

@@ -81,7 +81,7 @@ ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public String getOpcStringValue(String protocol) {
@@ -91,7 +91,7 @@ ItemProtocol {
} else {
return value;
}
return "0";
return value;
}
public static List<ItemDto> getReadableItemDtos() {

View File

@@ -163,32 +163,39 @@ public class StandardManipulatoDeviceDriver extends AbstractOpcDeviceDriver impl
if (mode != last_mode) {
requireSucess = false;
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
}
} 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();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
}
last_mode = mode;
last_move = move;
last_action = action;

View File

@@ -182,7 +182,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public float getOpcFloatValue(String protocol) {
@@ -194,7 +194,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}

View File

@@ -172,58 +172,65 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
}
updateInstructionStatus();
}
} catch (Exception var17) {
var17.printStackTrace();
// feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (mode == 0) {
this.setIsonline(false);
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
if (mode == 0) {
this.setIsonline(false);
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
this.setIsonline(true);
this.setIserror(false);
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
} 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_mode = mode;
last_move = move;
last_action = action;

View File

@@ -177,7 +177,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}
public float getOpcFloatValue(String protocol) {
@@ -189,7 +189,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
return 0;
return value;
}

View File

@@ -210,60 +210,68 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
Integer actionType = ActionTypeEnum.IN_FINISHING.getCode();
creatAGV(actionType, action);
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
} catch (Exception var17) {
var17.printStackTrace();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
}
if (mode == 0) {
this.setIsonline(false);
message = "universal_off-line";
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
//有报警
} else if (error != 0) {
this.setIserror(true);
message = "universal_message3";
//无报警
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
this.setIsonline(true);
this.setIserror(false);
message = "";
Instruction instruction = null;
List toInstructions;
//行架机械手申请任务
if (mode == 2 && move == 0 && task == 0 && !requireSucess) {
boolean res = applyTask();
if (res) {
notCreateInstMessage = "";
notCreateTaskMessage = "";
feedMessage = "";
}
} else {
String remark = "";
;
if (mode != 2) {
remark = "universal_remark2";
}
if (move != 0) {
remark = "universal_remark3";
}
if (task != 0) {
remark = "universal_remark4";
if (ObjectUtil.isNotEmpty(this.inst)) {
this.inst = null;
}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
if (requireSucess) {
remark = "universal_remark5";
}
this.setNotCreateInstMessage(remark);
//}
}
} 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_mode = mode;
last_move = move;
last_action = action;