add:添加驱动
This commit is contained in:
@@ -15,6 +15,7 @@ import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase;
|
||||
import org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect.StandardConveyorWithInspectDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.paper_tube_pick_site.PaperTubePickSiteDeviceDriver;
|
||||
@@ -178,6 +179,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//废箔称重位
|
||||
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
|
||||
|
||||
StandardConveyorWithInspectDeviceDriver standardConveyorWithInspectDeviceDriver;
|
||||
|
||||
if (phase == 0x02) {
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到指令号{}对应的指令", ikey);
|
||||
@@ -243,8 +246,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){
|
||||
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
|
||||
} else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) {
|
||||
standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver();
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
@@ -350,6 +353,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
acsToWmsService.actionFinishRequest2(jsonObject);
|
||||
}
|
||||
this.setPhase(phase);
|
||||
} else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) {
|
||||
standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver();
|
||||
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()
|
||||
@@ -361,196 +373,196 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
}
|
||||
|
||||
// 取货完毕
|
||||
//(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);
|
||||
} 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);
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
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);
|
||||
}
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
hongXiangStationDeviceDriver.writing(0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (hongXiangStationDeviceDriver.getMove() == 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 + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
manipulatorAgvStationDeviceDriver.writing(3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
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(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
|
||||
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("task_code", task_code);
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
||||
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode())
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
acsToWmsService.actionFinishRequest2(jsonObject);
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
paperTubePickSiteDeviceDriver.writing(3);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (paperTubePickSiteDeviceDriver.getAction() == 1
|
||||
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
|
||||
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 + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.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(this.getDeviceCode())
|
||||
.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);
|
||||
// } 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);
|
||||
// }
|
||||
// data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
// standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
// standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
// standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
|
||||
// hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
|
||||
// try {
|
||||
// hongXiangStationDeviceDriver.writing(0);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if (hongXiangStationDeviceDriver.getMove() == 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 + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
|
||||
// LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
// .device_code(this.getDeviceCode())
|
||||
// .content(message)
|
||||
// .build();
|
||||
// logDto.setLog_level(4);
|
||||
// luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
// }
|
||||
// } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
// manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
|
||||
// try {
|
||||
// manipulatorAgvStationDeviceDriver.writing(3);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// 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(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
|
||||
// && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("task_code", task_code);
|
||||
// LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
// .device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
|
||||
// .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode())
|
||||
// .build();
|
||||
// logDto1.setLog_level(4);
|
||||
// luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
// acsToWmsService.actionFinishRequest2(jsonObject);
|
||||
// }
|
||||
// } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
|
||||
// paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
// try {
|
||||
// paperTubePickSiteDeviceDriver.writing(3);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if (paperTubePickSiteDeviceDriver.getAction() == 1
|
||||
// && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
|
||||
// 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 + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
|
||||
// LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
// .device_code(this.getDeviceCode())
|
||||
// .content(message)
|
||||
// .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(this.getDeviceCode())
|
||||
// .content("agvphase:" + phase + "反馈:" + data)
|
||||
// .build();
|
||||
// logDto.setLog_level(4);
|
||||
// luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
// 到达放货点
|
||||
//(Itype=1/2/3,需要WCS反馈)
|
||||
@@ -618,6 +630,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
|
||||
} else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) {
|
||||
standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver();
|
||||
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 PaperTubePickSiteDeviceDriver) {
|
||||
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
|
||||
try {
|
||||
@@ -806,6 +827,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
this.setPhase(phase);
|
||||
}else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver){
|
||||
standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver();
|
||||
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()
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class ItemProtocol {
|
||||
public static String item_move = "move";
|
||||
|
||||
private StandardConveyorWithInspectDeviceDriver driver;
|
||||
|
||||
public ItemProtocol(StandardConveyorWithInspectDeviceDriver driver){
|
||||
this.driver=driver;
|
||||
}
|
||||
|
||||
public int getMove() {
|
||||
return this.getOpcIntegerValue(item_move);
|
||||
}
|
||||
|
||||
public int getOpcIntegerValue(String protocol) {
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
public static List<ItemDto> getReadableItemDtos() {
|
||||
ArrayList list = new ArrayList();
|
||||
list.add(new ItemDto(item_move, "光电信号", "10001"));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect;
|
||||
|
||||
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class StandardConveyorWithInspectDefination implements OpcDeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "standard_conveyor_with_inspect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "标准版-带光电检测站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "标准版-带光电检测站点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new StandardConveyorWithInspectDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return StandardConveyorWithInspectDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package org.nl.acs.device_driver.conveyor.standard_conveyor_with_inspect;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class StandardConveyorWithInspectDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
int move = 0;
|
||||
int last_move = 0;
|
||||
String device_code = null;
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
device_code = this.getDevice().getDevice_code();
|
||||
move = this.itemProtocol.getMove();
|
||||
last_move = move;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
JSONObject jo = new JSONObject();
|
||||
String move = "";
|
||||
|
||||
if (this.getMove() == 0) {
|
||||
move = "无货";
|
||||
} else if (this.getMove() == 1) {
|
||||
move = "有货";
|
||||
}
|
||||
|
||||
jo.put("device_name", this.getDevice().getDevice_name());
|
||||
jo.put("move", move);
|
||||
jo.put("isOnline", true);
|
||||
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
group = opcServerService.getServer(this.getOpcServer());
|
||||
itemsString = new ArrayList<>(itemValues.keySet());
|
||||
Iterator nis = itemsString.iterator();
|
||||
|
||||
|
||||
while (nis.hasNext()) {
|
||||
String string = (String) nis.next();
|
||||
try {
|
||||
|
||||
@@ -10,7 +10,7 @@ spring:
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hanguodoushan}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:xlm_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
|
||||
Reference in New Issue
Block a user