Browse Source

rev:优化agv驱动

master
涂强 2 weeks ago
parent
commit
e256468765
  1. 611
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java

611
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java

@ -225,74 +225,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait")) data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code);
if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("任务号为空")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
log.info("等待LMS系统进行确认允许取货,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDevice_code(), standardOrdinarySiteDeviceDriver.getOption());
logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("等待LMS系统进行确认允许取货,设备号" + standardOrdinarySiteDeviceDriver.getDevice_code() + ",option当前值" + standardOrdinarySiteDeviceDriver.getOption())
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1
&& standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setOption(0);
} else { } else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
@ -313,7 +255,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agv地址参数有误,phase:" + phase) .content("agv地址参数有误,phase:" + phase)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(2);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
return; return;
} }
@ -354,302 +296,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait")) data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
&& StrUtil.equals("true", this.device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
standardOrdinarySiteDeviceDriver.setOption(0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
String task_code = inst.getTask_code();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode())
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
acsToWmsService.actionFinishRequest2(jsonObject);
}
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(0);
} catch (Exception e) {
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() != 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//到达取货点(Itype=1、3,需要WCS反馈)
else if (phase == 0x08) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
CommonFinalParam commonFinalParam = new CommonFinalParam();
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
if (ObjectUtil.isEmpty(inst.getCarno())) {
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
String agv_inst_type = inst.getAgv_inst_type();
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
if (standardOrdinarySiteDeviceDriver.getOption() == 1) {
String task_code = standardOrdinarySiteDeviceDriver.getTask_code();
log.info("当前任务号{},创建任务号{}", task.getTask_code(), task_code);
if (StrUtil.isEmpty(task_code) || !task_code.equals(task.getTask_code())) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("任务号为空!")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
log.info("等待LMS系统进行确认允许取货,设备号{},option值{}", standardOrdinarySiteDeviceDriver.getDeviceCode(), standardOrdinarySiteDeviceDriver.getOption());
message = "等待LMS系统进行确认允许取货,设备号:" + standardOrdinarySiteDeviceDriver.getDeviceCode() + ",option值:" + standardOrdinarySiteDeviceDriver.getOption();
logServer.deviceExecuteLog(standardOrdinarySiteDeviceDriver.getDeviceCode(), "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDeviceCode())
.content(standardOrdinarySiteDeviceDriver.getDevice_code() + "option值不为1")
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
// 取货完毕
//(Itype=1、3,需要WCS反馈)
else if (phase == 0x0A) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
String agv_inst_type = inst.getAgv_inst_type();
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
standardOrdinarySiteDeviceDriver.setOption(0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} else { standardOrdinarySiteDeviceDriver.setAgvphase(phase);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst); standardOrdinarySiteDeviceDriver.setInst(inst);
String task_code = inst.getTask_code();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code);
LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode())
.build();
logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1);
acsToWmsService.actionFinishRequest2(jsonObject);
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else { } else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
@ -657,46 +315,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} }
}
//(Itype=1,上传称重数据)
else if (phase == 0x64) {
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
} }
String instruction_type = inst.getInstruction_type();
//上传称重数据
if (StrUtil.equals(instruction_type, CommonFinalParam.ONE)) {
weight = agvaddr;
inst.setWeight(String.valueOf(weight));
instructionService.update(inst);
if (ObjectUtil.isNotEmpty(task)) {
logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight);
message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
task.setWeight(String.valueOf(weight));
task.setCarno(this.device_code);
taskService.update(task);
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
// 到达放货点 // 到达放货点
//(Itype=1/2/3,需要WCS反馈) //(Itype=1/2/3,需要WCS反馈)
else if (phase == 0x0C) { else if (phase == 0x07) {
if (agvaddr == 0) { if (agvaddr == 0) {
agvaddr = agvaddr_copy; agvaddr = agvaddr_copy;
} }
@ -735,126 +358,17 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} }
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(1);
if ((standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件";
log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content(message)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} standardOrdinarySiteDeviceDriver.setOption(0);
}
//放货完成
//(Itype=1/2/3,需要WCS反馈)
else if (phase == 0x0E) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
// && StrUtil.equals(task.getTask_type(), "1")) {
// //
// if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// standardOrdinarySiteDeviceDriver.setOption(0);
// } else {
// log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey);
// message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
// }
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
this.setPhase(phase);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(0);
if ((standardInspectSiteDeviceDriver.getMove() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else { } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
@ -863,84 +377,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} }
} }
//到达放货点
//(Itype=1、3,需要WCS反馈)
else if (phase == 0x10) {
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\.");
device_code = point[0];
emptyNum = point[1];
} else {
device_code = old_device_code;
}
}
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
String agv_inst_type = inst.getAgv_inst_type();
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
// && StrUtil.equals(task.getTask_type(), "1")) {
// //
// if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// standardOrdinarySiteDeviceDriver.setOption(0);
// } else {
// log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey);
// message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
// }
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
this.setPhase(phase);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data)
.build();
logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//放货完成 //放货完成
//(Itype=1、3,需要WCS反馈) //(Itype=1/2/3,需要WCS反馈)
else if (phase == 0x12) { else if (phase == 0x09) {
if (agvaddr == 0) { if (agvaddr == 0) {
agvaddr = agvaddr_copy; agvaddr = agvaddr_copy;
} }
@ -977,34 +418,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
return; return;
} }
String agv_inst_type = inst.getAgv_inst_type();
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
// standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
// if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
// && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())
// && StrUtil.equals(task.getTask_type(), "1")) {
// //
// if (standardOrdinarySiteDeviceDriver.getOption() == 2) {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// standardOrdinarySiteDeviceDriver.setOption(0);
// } else {
// log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey);
// message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey;
// }
// } else {
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
// }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
this.setPhase(phase); standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
} else { } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) .content("agvphase:" + phase + "反馈:" + data)

Loading…
Cancel
Save