add:添加agv交互逻辑和驱动更新

This commit is contained in:
2024-02-02 09:39:02 +08:00
parent f7f27a4f58
commit e846b623fa
15 changed files with 1412 additions and 92 deletions

View File

@@ -10,9 +10,12 @@ import org.nl.acs.common.base.CommonFinalParam;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
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;
import org.nl.acs.device_driver.storage.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.HongXiangStationDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
@@ -22,9 +25,16 @@ import org.nl.acs.log.LokiLog;
import org.nl.acs.log.LokiLogType;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.acs.task.service.impl.TaskServiceImpl;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.nl.system.service.param.ISysParamService;
import org.nl.config.SpringContextHolder;
import java.util.Arrays;
/**
* NDC双工位AGV
@@ -36,11 +46,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
ISysParamService ISysParamService = SpringContextHolder.getBean(ISysParamService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
TaskService taskService = SpringContextHolder.getBean(TaskServiceImpl.class);
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
int agvaddr = 0;
int agvaddr_copy = 0;
int weight = 0;
@@ -48,6 +61,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
String device_code = "";
int phase = 0;
int region = 0;
private Instruction instruction;
String message = null;
@LokiLog(type = LokiLogType.ACS_TO_LMS)
public synchronized void processSocket(int[] arr) throws Exception {
@@ -56,9 +71,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
phase = arr[16] * 256 + arr[17];
// agv任务号
int index = arr[12] * 256 + arr[13];
/**
* 任务号
*/
/**
* 任务号
*/
int ikey = arr[26] * 256 + arr[27];
//站点号
agvaddr = arr[18] * 256 + arr[19];
@@ -69,8 +84,19 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (carno != 0) {
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
}
TaskDto task = null;
if (ikey != 0) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) {
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
this.instruction = inst;
}
if (ObjectUtil.isNotEmpty(inst)) {
// log.info("该指令号未找到对应指令:" + ikey);
// message = "该指令号未找到对应指令:" + ikey;
// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:" + ikey);
// return;
task = taskService.findByTaskCode(inst.getTask_code());
}
}
@@ -99,6 +125,13 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
//货架
StandardStorageDeviceDriver standardStorageDeviceDriver;
//纸管抓取位
PaperTubePickSiteDeviceDriver paperTubePickSiteDeviceDriver;
//标准-光电检测
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
//烘箱对接位
HongXiangStationDeviceDriver hongXiangStationDeviceDriver;
if (phase == 0x02) {
if (ObjectUtil.isEmpty(inst)) {
@@ -107,7 +140,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase" + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase" + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//到达取货点
//(Itype=1/2/3,需要WCS反馈Phase)
@@ -138,16 +175,109 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content(agvaddr + "对应设备号为空")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
if (ObjectUtil.isEmpty(inst.getCarno())) {
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getMove() == 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())) {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
}
}
else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
try {
hongXiangStationDeviceDriver.writing(1);
} catch (Exception e) {
e.printStackTrace();
}
if (hongXiangStationDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
paperTubePickSiteDeviceDriver.writing(2);
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), ikey);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
// 取货完毕
//(Itype=1/2/3,需要WCS反馈Phase)
else if (phase == 0x05) {
@@ -155,7 +285,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -176,15 +310,106 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!");
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("对应设备号为空" + device_code)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey);
return;
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
if (ObjectUtil.isEmpty(inst.getCarno())) {
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getMove() == 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())) {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
paperTubePickSiteDeviceDriver.writing(3);
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), ikey);
}
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
try {
standardInspectSiteDeviceDriver.writing(0);
} catch (Exception e) {
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
//到达取货点(Itype=1、3需要WCS反馈)
else if (phase == 0x08) {
@@ -192,7 +417,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -218,10 +447,97 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
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 (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getMove() == 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())) {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
paperTubePickSiteDeviceDriver.writing(4);
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), ikey);
}
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
}
// 取货完毕
@@ -231,7 +547,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -260,8 +580,90 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
String agv_inst_type = inst.getAgv_inst_type();
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(device.getExtraValue().get("wait"))
&& StrUtil.equals("true", device.getExtraValue().get("wait").toString())
&& StrUtil.equals(task.getTask_type(), "1")) {
if (standardOrdinarySiteDeviceDriver.getMove() == 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())) {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{},任务号{}", device_code, ikey, task.getTask_code());
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
log.info("等待LMS系统进行确认允许取货设备号{},指令号{}", device_code, ikey);
message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey;
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
paperTubePickSiteDeviceDriver.writing(5);
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), ikey);
}
}
} 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);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
, standardInspectSiteDeviceDriver.getError(), ikey);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
@@ -278,7 +680,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
// inst.setWeight(String.valueOf(weight));
// instructionService.update(inst);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}
// 到达放货点
@@ -288,7 +695,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -315,8 +726,48 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey);
return;
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst);
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
if (paperTubePickSiteDeviceDriver.getMove() == 0)
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
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);
}else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction()+ "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足放货条件";
log.info("设备{}当前光电信号{},动作信号{} ,报警信号{},不满足放货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction()
,standardInspectSiteDeviceDriver.getError(), ikey);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
//放货完成
//(Itype=1/2/3,需要WCS反馈)
@@ -325,7 +776,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -352,8 +807,49 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到指令号{}对应的指令", ikey);
return;
}
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
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);
this.setPhase(phase);
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
standardInspectSiteDeviceDriver.writing(0);
if ((standardInspectSiteDeviceDriver.getMove() == 1)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
} else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
//到达放货点
//Itype=1、3,需要WCS反馈
@@ -362,7 +858,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -391,8 +891,44 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
String agv_inst_type = inst.getAgv_inst_type();
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
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);
this.setPhase(phase);
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
}
//放货完成
@@ -402,7 +938,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
agvaddr = agvaddr_copy;
}
if (agvaddr < 1) {
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agv地址参数有误,phase:" + phase)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return;
}
if (agvaddr != 0) {
@@ -431,8 +971,59 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
String agv_inst_type = inst.getAgv_inst_type();
if (StrUtil.equals(agv_inst_type, CommonFinalParam.ONE) || StrUtil.equals(agv_inst_type, "3")) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
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);
this.setPhase(phase);
}
else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try {
paperTubePickSiteDeviceDriver.writing(0);
} catch (Exception e) {
e.printStackTrace();
}
if (paperTubePickSiteDeviceDriver.getMove() > 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + paperTubePickSiteDeviceDriver.getMove() + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, paperTubePickSiteDeviceDriver.getMove(), paperTubePickSiteDeviceDriver.getAction()
, paperTubePickSiteDeviceDriver.getError(), ikey);
}
}
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);
} else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",动作信号:" + hongXiangStationDeviceDriver.getAction() + "报警信号:" + hongXiangStationDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
log.info("设备{}当前光电信号{},动作信号{} ,错误信号{},不满足取货条件,指令号{}", device_code, hongXiangStationDeviceDriver.getMove(), hongXiangStationDeviceDriver.getAction()
, hongXiangStationDeviceDriver.getError(), ikey);
}
}
else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
}
}
}
//上传AGV电量
@@ -443,7 +1034,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
agv_power = ikey;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
} //进入区域phase值
else if (phase == 0x50) {
@@ -453,7 +1048,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//离开区域phase值
@@ -464,7 +1063,11 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
}
region = agvaddr;
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
//上报异常信息
@@ -474,10 +1077,18 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
if (agvaddr == 0) {
}
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
if (!ObjectUtil.isEmpty(data)) {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("agvphase:" + phase + "反馈:" + data)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
// if (StrUtil.equals(inst.getAgv_system_type(), "2")) {
// TwoNDCSocketConnectionAutoRun.write(data);
// } else if (StrUtil.equals(inst.getAgv_system_type(), "3")) {

View File

@@ -116,6 +116,9 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple
*/
private int flag;
//任务号
String task_code;
/**
* 人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
*/

View File

@@ -41,6 +41,8 @@ import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.config.language.LangProcess;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.config.lucene.service.dto.LuceneLogDto;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
@@ -69,6 +71,8 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl");
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
//工作模式
int mode = 0;
int last_mode = 0;
@@ -170,49 +174,6 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
weight = this.itemProtocol.getWeight();
barcode = this.itemProtocol.getBarcode();
if (to_onset != last_to_onset) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_onset" + last_to_onset + "->" + to_onset);
}
if (to_command != last_to_command) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command" + last_to_command + "->" + to_command);
}
if (to_target != last_to_target) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_target" + last_to_target + "->" + to_target);
}
if (to_task != last_to_task) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号to_task" + last_to_task + "->" + to_task);
}
if (weight != last_weight) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号weight" + last_weight + "->" + weight);
}
if (barcode != last_barcode) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode" + last_barcode + "->" + barcode);
}
if (mode != last_mode) {
requireSucess = false;
logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode));
logServer.deviceExecuteLog(this.device_code, "", "", "信号mode" + last_mode + "->" + mode);
}
if (move != last_move) {
logServer.deviceItemValue(this.device_code, "move", String.valueOf(move));
logServer.deviceExecuteLog(this.device_code, "", "", "信号move" + last_move + "->" + move);
}
if (action != last_action) {
logServer.deviceItemValue(this.device_code, "action", String.valueOf(action));
logServer.deviceExecuteLog(this.device_code, "", "", "信号action" + last_action + "->" + action);
}
if (error != last_error) {
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
}
if (walk_y != last_walk_y) {
logServer.deviceItemValue(this.device_code, "walk_y", String.valueOf(walk_y));
logServer.deviceExecuteLog(this.device_code, "", "", "信号walk_y" + last_walk_y + "->" + walk_y);
}
if (task != last_task) {
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
// 更新指令状态
if (mode == 3 && task > 0) {
@@ -254,17 +215,29 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
if (body.getStatus() == 200) {
message = "反馈重量以及收卷轴LMS成功...";
requireSucess = true;
logServer.deviceExecuteLog(this.device_code, "", "", "反馈尺寸成请求成功,响应参数:" + JSON.toJSONString(body));
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("反馈尺寸成请求成功,响应参数:" + JSON.toJSONString(body))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", "5");
this.writing(map);
} else {
message = "反馈重量以及收卷轴LMS失败...";
requireSucess = false;
message = "反馈LMS尺寸失败";
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("反馈重量以及收卷轴LMS失败...")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
logServer.deviceExecuteLog(this.device_code, "", "", "当前指令号为空");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("当前指令号为空")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
} else {
feedMessage = "行架机械手:";
@@ -305,7 +278,11 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
} catch (Exception var17) {
var17.printStackTrace();
feedMessage = var17.getMessage();
logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol));
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol))
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
@@ -469,7 +446,11 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
instructionService.create(instdto);
} catch (Exception e) {
notCreateInstMessage = e.getMessage();
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "创建指令时出现异常:" + e.getMessage());
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("创建指令时出现异常:" + e.getMessage())
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
return false;
}
//创建指令后修改任务状态
@@ -481,12 +462,20 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
Device nextDevice = deviceAppService.findDeviceByCode(instdto.getNext_device_code());
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "设备:" + startDevice.getDevice_code() + "未设置电气调度号!";
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("设备:" + startDevice.getDevice_code() + "未设置电气调度号!")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException(LangProcess.msg("device_checkAdd", startDevice.getDevice_code()));
}
if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
notCreateInstMessage = "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!";
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!")
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
throw new BadRequestException(LangProcess.msg("device_checkAdd", nextDevice.getDevice_code()));
}
@@ -533,7 +522,11 @@ public class BlankManipulatorDeviceDriver extends AbstractOpcDeviceDriver implem
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code)
.content("下发多个电气信号:" + itemMap)
.build();
luceneExecuteLogService.deviceExecuteLog(logDto);
}
}

View File

@@ -28,6 +28,7 @@ import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.config.SpringContextHolder;
import org.nl.config.lucene.service.LuceneExecuteLogService;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -66,6 +67,8 @@ public class BlankingButtonDriver extends AbstractOpcDeviceDriver implements Dev
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class);
@Autowired
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);

View File

@@ -130,7 +130,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
//当前指令
Instruction inst = null;
/**
/**
* 1-执行任务2-取货完成3-放货完成;
*/
int flag;
@@ -295,7 +295,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
case 8:
if (!requireSucess && task > 0) {
//缓存线已满,申请行架任务
// applyTask();
applyTask();
}
break;
default:
@@ -361,6 +361,10 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setWeight1(String.valueOf(weight1));
applyPlugPullSiteRequest.setMaterial1(String.valueOf(material1));
applyPlugPullSiteRequest.setWeight2(String.valueOf(weight2));
applyPlugPullSiteRequest.setMaterial2(String.valueOf(material2));
applyPlugPullSiteRequest.setType("2");
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
@@ -389,6 +393,7 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setBarcode(String.valueOf(barcode));
applyPlugPullSiteRequest.setType("3");
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
@@ -406,6 +411,29 @@ public class PlugPullDeviceSiteDeviceDriver extends AbstractOpcDeviceDriver impl
}
}
/**
* 缓存线已满,生成行架任务
*/
private synchronized void applyTask() {
ApplyPlugPullSiteRequest applyPlugPullSiteRequest = new ApplyPlugPullSiteRequest();
ApplyPlugPullSitResponse applyPlugPullSitResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code1 = inst1.getTask_code();
applyPlugPullSiteRequest.setDevice_code(device_code);
applyPlugPullSiteRequest.setTask_code(task_code1);
applyPlugPullSiteRequest.setType("4");
applyPlugPullSitResponse = acsToWmsService.applyPlugPullSiteRequest(applyPlugPullSiteRequest);
if (applyPlugPullSitResponse.getCode() == 200) {
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴,返回参数:" + applyPlugPullSitResponse);
message = "拔轴完成成功";
} else {
message = applyPlugPullSitResponse.getMessage();
requireSucess = true;
message = "申请行架任务失败";
logServer.deviceExecuteLog(this.device_code, "", "", "申请拔轴反馈失败,返回参数:" + applyPlugPullSitResponse);
}
}
/**
* 下发电气信号
* @param mode

View File

@@ -0,0 +1,121 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_conveyor_site;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.device.device_driver.standard_inspect.ItemDto;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
//心跳
public static String item_heartbeat = "heartbeat";
//工作模式
public static String item_mode = "mode";
//光电信号
public static String item_move = "move";
//动作信号
public static String item_action = "action";
//任务号
public static String item_task = "task";
//报警
public static String item_error = "error";
//载具类型
public static String item_container_type = "container_type";
//托盘方向
public static String item_carrier_direction = "carrier_direction";
//下发命令
public static String item_to_command = "to_command";
//下发目标站
public static String item_to_target = "to_target";
//下发任务号
public static String item_to_task = "to_task";
//下发托盘类型
public static String item_to_container_type = "to_container_type";
private SubRollConveyorSiteDeviceDriver driver;
public ItemProtocol(SubRollConveyorSiteDeviceDriver driver){
this.driver=driver;
}
public int getHeartbeat() {
return this.getOpcIntegerValue(item_heartbeat);
}
public int getMode() {
return this.getOpcIntegerValue(item_mode);
}
public int getMove() {
return this.getOpcIntegerValue(item_move);
}
public int getAction() {
return this.getOpcIntegerValue(item_action);
}
public int getError() {
return this.getOpcIntegerValue(item_error);
}
public int getTask() {
return this.getOpcIntegerValue(item_task);
}
public int getContainer_type(){
return this.getOpcIntegerValue(item_container_type);
}
public int getCarrier_direction(){
return this.getOpcIntegerValue(item_carrier_direction);
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB29.B0"));
list.add(new ItemDto(item_mode, "工作模式", "DB29.B1"));
list.add(new ItemDto(item_move, "光电信号", "DB29.B2"));
list.add(new ItemDto(item_action, "动作信号", "DB29.B3"));
list.add(new ItemDto(item_container_type, "载具类型", "DB29.B4"));
list.add(new ItemDto(item_to_container_type, "托盘方向", "DB29.B5"));
list.add(new ItemDto(item_error, "报警信号", "DB29.B9"));
list.add(new ItemDto(item_task, "任务号", "DB29.D10"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB30.W0"));
list.add(new ItemDto(item_to_target, "下发目标站", "DB30.W2"));
list.add(new ItemDto(item_to_task, "下发任务号", "DB30.W4"));
list.add(new ItemDto(item_to_container_type, "下发托盘类型", "DB30.W6"));
return list;
}
@Override
public String toString() {
return "";
}
}

View File

@@ -0,0 +1,62 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_conveyor_site;
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 SubRollConveyorSiteDefination implements OpcDeviceDriverDefination {
@Override
public String getDriverCode() {
return "sub_roll_conveyor_site";
}
@Override
public String getDriverName() {
return "子卷下卷输送线工位";
}
@Override
public String getDriverDescription() {
return "子卷下卷输送线工位";
}
@Override
public DeviceDriver getDriverInstance(Device device) {
return (new SubRollConveyorSiteDeviceDriver()).setDevice(device).setDriverDefination(this);
}
@Override
public Class<? extends DeviceDriver> getDeviceDriverType() {
return SubRollConveyorSiteDeviceDriver.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 ItemProtocol.getWriteableItemDtos();
}
}

View File

@@ -0,0 +1,271 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_conveyor_site;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.device.domain.Device;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.instruction.domain.Instruction;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.route.service.RouteLineService;
import org.nl.acs.task.service.TaskService;
import org.nl.config.SpringContextHolder;
import org.nl.system.service.param.ISysParamService;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
* 子卷下卷输送线工位
*/
@Slf4j
@Data
@RequiredArgsConstructor
public class SubRollConveyorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
protected ItemProtocol itemProtocol = new ItemProtocol(this);
@Autowired
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
@Autowired
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
@Autowired
DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class);
@Autowired
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
@Autowired
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@Autowired
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
@Autowired
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
@Autowired
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
@Autowired
AgvService agvService = SpringContextHolder.getBean(AgvService.class);
//工作模式
int mode = 0;
int last_mode = 0;
//光电信号
int move = 0;
int last_move = 0;
//动作信号
int action = 0;
int last_action = 0;
//报警信号
int error = 0;
int last_error = 0;
//任务号
int task = 0;
int last_task = 0;
int heartbeat = 0;
int last_heartbeat = 0;
int to_command = 0;
int last_to_command = 0;
//载具类型
int container_type = 0;
int last_container_type = 0;
//托盘方向
int carrier_direction = 0;
int last_carrier_direction = 0;
int to_target = 0;
int last_to_target = 0;
int to_container_type = 0;
int last_to_container_type = 0;
int to_task = 0;
int last_to_task = 0;
Boolean isonline = true;
Boolean iserror = false;
//当前指令
Instruction inst = null;
/**
* 1-执行任务2-取货完成3-放货完成;
*/
int flag;
String device_code;
String message = null;
@Override
public Device getDevice() {
return this.device;
}
/**
* 请求成功标记
*/
Boolean requireSucess = false;
String feedMessage = "";
@Override
public void execute() {
String message = null;
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
move = this.itemProtocol.getMove();
action = this.itemProtocol.getAction();
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
heartbeat = this.itemProtocol.getHeartbeat();
container_type = this.itemProtocol.getContainer_type();
carrier_direction = this.itemProtocol.getCarrier_direction();
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:
log.info("待机");
break;
case 3:
//收到行架任务任务号并且有货
if (task > 0 && move == 1) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("to_command", 1);
this.writing(map);
}
break;
default:
log.info("未知模式");
break;
}
}
last_mode = mode;
last_move = move;
last_action = action;
last_error = error;
last_task = task;
last_heartbeat = heartbeat;
last_to_command = to_command;
last_container_type = container_type;
last_carrier_direction = carrier_direction;
}
public void writing(Map<String, Object> map) {
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
Map<String, Object> itemMap = new LinkedHashMap<>();
map.forEach((key, value) -> {
if (ObjectUtil.isNotEmpty(value)) {
itemMap.put(getToParam() + key, value);
}
});
if (ObjectUtil.isNotEmpty(itemMap)) {
this.control(itemMap);
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
}
}
public String getToParam() {
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
}
/**
* 将扩展表中的字符串数据转换成集合
*/
@Override
public List<String> getExtraDeviceCodes(String extraName) {
String extraValue = (String) this.getDevice().getExtraValue().get(extraName);
if (StrUtil.isEmpty(extraValue)) {
return new ArrayList<>();
}
String devicesString = extraValue.substring(1, extraValue.length() - 1);
List<String> devicesList = new ArrayList<>();
String[] devices = devicesString.split(",");
for (int i = 0; i < devices.length; i++) {
String s = devices[i].replace("\"", "").replace("\"", "");
devicesList.add(s);
}
return devicesList;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();
String mode = "";
String action = "";
String move = "";
if (this.getMode() == 0) {
mode = "未联机";
} else if (this.getMode() == 1) {
mode = "单机";
} else if (this.getMode() == 2) {
mode = "联机";
} else if (this.getMode() == 3) {
mode = "运行中";
}
if (this.getMove() == 0) {
move = "无货";
jo.put("hasGoods", false);
} else if (this.getMove() == 1) {
move = "有货";
jo.put("hasGoods", true);
}
jo.put("device_name", this.getDevice().getDevice_name());
jo.put("mode", mode);
jo.put("move", move);
jo.put("action", action);
jo.put("isOnline", this.getIsonline());
jo.put("isError", this.getIserror());
return jo;
}
@Override
public void setDeviceStatus(JSONObject data) {
}
public void writing(String param, String value) {
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + param;
//String opcservcerid = this.getDevice().getOpc_server_id();
//Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_param, value);
// itemMap.put(to_param, Integer.parseInt(value));
this.control(itemMap);
}
}

View File

@@ -0,0 +1,4 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_manipulator;
public class ItemProtocol {
}

View File

@@ -0,0 +1,4 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_manipulator;
public class SubRollManipulatorDefination {
}

View File

@@ -0,0 +1,4 @@
package org.nl.acs.device_driver.two_conveyor.sub_roll_manipulator;
public class SubRollManipulatorDeviceDriver {
}

View File

@@ -10,6 +10,7 @@ public class ApplyPlugPullSiteRequest extends BaseRequest {
* 1-申请套管
* 2-套管完成
* 3-拔轴完成
* 4-缓存线已满,生成行架任务
*/
private String type;
@@ -19,9 +20,25 @@ public class ApplyPlugPullSiteRequest extends BaseRequest {
private String task_code;
/**
* 重量
* 纸管1重量
*/
private String weight;
private String weight1;
/**
* 纸管1规格
*/
private String material1;
/**
* 纸管2规格
*/
private String material2;
/**
* 纸管2重量
*/
private String weight2;
/**
* 条码

View File

@@ -494,4 +494,12 @@ public interface TaskService extends CommonService<Task> {
* @return 指令终点 B
*/
String queryAssignedByDeviceCode(String device_code, String task_nextDeice_code);
/**
* 根据编号查询
*
* @param task_code
* @return AcsTask
*/
TaskDto findByTaskCode(String task_code);
}

View File

@@ -1458,6 +1458,20 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
return null;
}
@Override
public TaskDto findByTaskCode(String task_code) {
List<TaskDto> list = new ArrayList<>();
Iterator<TaskDto> iterator = tasks.iterator();
while (iterator.hasNext()) {
TaskDto task = iterator.next();
if (StrUtil.equals(task.getTask_code(), task_code)) {
return task;
}
}
return null;
}
/**
* 把多个字符串拼接的inst_nextDevice_code解析成集合
*