add:添加驱动

This commit is contained in:
2025-02-27 11:07:03 +08:00
parent b641cf7157
commit 59922c4606
12 changed files with 811 additions and 195 deletions

View File

@@ -15,6 +15,7 @@ import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.agv.utils.TwoAgvPhase; 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_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; 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.paper_tube_pick_site.PaperTubePickSiteDeviceDriver;
@@ -178,6 +179,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
//废箔称重位 //废箔称重位
WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver; WasteFoilWeighingStationDriver wasteFoilWeighingStationDriver;
StandardConveyorWithInspectDeviceDriver standardConveyorWithInspectDeviceDriver;
if (phase == 0x02) { if (phase == 0x02) {
if (ObjectUtil.isEmpty(inst)) { if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
@@ -243,8 +246,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
.build(); .build();
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ } else if (device.getDeviceDriver() instanceof StandardConveyorWithInspectDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); standardConveyorWithInspectDeviceDriver = (StandardConveyorWithInspectDeviceDriver) device.getDeviceDriver();
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) .device_code(this.getDeviceCode())
@@ -350,6 +353,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
acsToWmsService.actionFinishRequest2(jsonObject); acsToWmsService.actionFinishRequest2(jsonObject);
} }
this.setPhase(phase); 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 { } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
@@ -361,196 +373,196 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} }
} }
// 取货完毕 // // 取货完毕
//(Itype=1、3,需要WCS反馈) // //(Itype=1、3,需要WCS反馈)
else if (phase == 0x0A) { // else if (phase == 0x0A) {
if (agvaddr == 0) { // if (agvaddr == 0) {
agvaddr = agvaddr_copy; // agvaddr = agvaddr_copy;
} // }
if (agvaddr < 1) { // if (agvaddr < 1) {
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) // .device_code(device_code)
.content("agv地址参数有误,phase:" + phase) // .content("agv地址参数有误,phase:" + phase)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
return; // return;
} // }
if (agvaddr != 0) { // if (agvaddr != 0) {
CommonFinalParam commonFinalParam = new CommonFinalParam(); // CommonFinalParam commonFinalParam = new CommonFinalParam();
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); // old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) { // if (StrUtil.contains(old_device_code, commonFinalParam.getBARRE())) {
String[] point = old_device_code.split(commonFinalParam.getBARRE()); // String[] point = old_device_code.split(commonFinalParam.getBARRE());
device_code = point[0]; // device_code = point[0];
} else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) { // } else if (StrUtil.contains(old_device_code, commonFinalParam.getPOINT())) {
String[] point = old_device_code.split("\\."); // String[] point = old_device_code.split("\\.");
device_code = point[0]; // device_code = point[0];
emptyNum = point[1]; // emptyNum = point[1];
} else { // } else {
device_code = old_device_code; // device_code = old_device_code;
} // }
} // }
//
device = deviceAppService.findDeviceByCode(device_code); // device = deviceAppService.findDeviceByCode(device_code);
if (ObjectUtil.isEmpty(device_code)) { // if (ObjectUtil.isEmpty(device_code)) {
log.info(agvaddr + "对应设备号为空!"); // log.info(agvaddr + "对应设备号为空!");
return; // return;
} // }
if (ObjectUtil.isEmpty(inst)) { // if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey); // log.info("未找到指令号{}对应的指令", ikey);
return; // return;
} // }
String agv_inst_type = inst.getAgv_inst_type(); // String agv_inst_type = inst.getAgv_inst_type();
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { // if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); // standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) { // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString())) {
standardOrdinarySiteDeviceDriver.setOption(0); // standardOrdinarySiteDeviceDriver.setOption(0);
} else { // } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} // }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
standardOrdinarySiteDeviceDriver.setAgvphase(phase); // standardOrdinarySiteDeviceDriver.setAgvphase(phase);
standardOrdinarySiteDeviceDriver.setIndex(index); // standardOrdinarySiteDeviceDriver.setIndex(index);
standardOrdinarySiteDeviceDriver.setInst(inst); // standardOrdinarySiteDeviceDriver.setInst(inst);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
String task_code = inst.getTask_code(); // String task_code = inst.getTask_code();
if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) // if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
&& StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { // && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code); // jsonObject.put("task_code", task_code);
LuceneLogDto logDto1 = LuceneLogDto.builder() // LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(standardOrdinarySiteDeviceDriver.getDevice_code()) // .device_code(standardOrdinarySiteDeviceDriver.getDevice_code())
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode()) // .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + standardOrdinarySiteDeviceDriver.getDeviceCode())
.build(); // .build();
logDto1.setLog_level(4); // logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1); // luceneExecuteLogService.deviceExecuteLog(logDto1);
acsToWmsService.actionFinishRequest2(jsonObject); // acsToWmsService.actionFinishRequest2(jsonObject);
} // }
//
} else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) { // } else if (device.getDeviceDriver() instanceof HongXiangStationDeviceDriver) {
hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver(); // hongXiangStationDeviceDriver = (HongXiangStationDeviceDriver) device.getDeviceDriver();
try { // try {
hongXiangStationDeviceDriver.writing(0); // hongXiangStationDeviceDriver.writing(0);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
if (hongXiangStationDeviceDriver.getMove() == 0) { // if (hongXiangStationDeviceDriver.getMove() == 0) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} else { // } else {
message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件"; // message = "设备号:" + device_code + "光电信号:" + hongXiangStationDeviceDriver.getMove() + ",指令号:" + ikey + "不满足取货条件";
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content(message) // .content(message)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} // }
} else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { // } else if (device.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver(); // manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) device.getDeviceDriver();
try { // try {
manipulatorAgvStationDeviceDriver.writing(3); // manipulatorAgvStationDeviceDriver.writing(3);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
String task_code = inst.getTask_code(); // String task_code = inst.getTask_code();
if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms")) // if (ObjectUtil.isNotEmpty(manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms"))
&& StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) { // && StrUtil.equals("true", manipulatorAgvStationDeviceDriver.getDevice().getExtraValue().get("feedbackToLms").toString())) {
JSONObject jsonObject = new JSONObject(); // JSONObject jsonObject = new JSONObject();
jsonObject.put("task_code", task_code); // jsonObject.put("task_code", task_code);
LuceneLogDto logDto1 = LuceneLogDto.builder() // LuceneLogDto logDto1 = LuceneLogDto.builder()
.device_code(manipulatorAgvStationDeviceDriver.getDevice_code()) // .device_code(manipulatorAgvStationDeviceDriver.getDevice_code())
.content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode()) // .content("取货完成反馈:" + jsonObject.toJSONString() + ";设备:" + manipulatorAgvStationDeviceDriver.getDeviceCode())
.build(); // .build();
logDto1.setLog_level(4); // logDto1.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto1); // luceneExecuteLogService.deviceExecuteLog(logDto1);
acsToWmsService.actionFinishRequest2(jsonObject); // acsToWmsService.actionFinishRequest2(jsonObject);
} // }
} else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) { // } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); // paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try { // try {
paperTubePickSiteDeviceDriver.writing(3); // paperTubePickSiteDeviceDriver.writing(3);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
if (paperTubePickSiteDeviceDriver.getAction() == 1 // if (paperTubePickSiteDeviceDriver.getAction() == 1
&& paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) { // && paperTubePickSiteDeviceDriver.getError() == 0 && paperTubePickSiteDeviceDriver.getMode() == 2) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} else { // } else {
message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; // message = "设备号:" + device_code + ",动作信号:" + paperTubePickSiteDeviceDriver.getAction() + "报警信号:" + paperTubePickSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content(message) // .content(message)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} // }
} else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { // } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); // standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver();
//
try { // try {
standardInspectSiteDeviceDriver.writing(1); // standardInspectSiteDeviceDriver.writing(1);
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) { // if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} else { // } else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件"; // message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content(message) // .content(message)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} // }
} else { // } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); // data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() // LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(this.getDeviceCode()) // .device_code(this.getDeviceCode())
.content("agvphase:" + phase + "反馈:" + data) // .content("agvphase:" + phase + "反馈:" + data)
.build(); // .build();
logDto.setLog_level(4); // logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); // luceneExecuteLogService.deviceExecuteLog(logDto);
} // }
//
} // }
// 到达放货点 // 到达放货点
//Itype=1/2/3,需要WCS反馈 //Itype=1/2/3,需要WCS反馈
@@ -618,6 +630,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
luceneExecuteLogService.deviceExecuteLog(logDto); 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) { } else if (device.getDeviceDriver() instanceof PaperTubePickSiteDeviceDriver) {
paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver(); paperTubePickSiteDeviceDriver = (PaperTubePickSiteDeviceDriver) device.getDeviceDriver();
try { try {
@@ -806,6 +827,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
logDto.setLog_level(4); logDto.setLog_level(4);
luceneExecuteLogService.deviceExecuteLog(logDto); luceneExecuteLogService.deviceExecuteLog(logDto);
this.setPhase(phase); 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 { } else {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()

View File

@@ -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 "";
}
}

View File

@@ -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;
}
}

View File

@@ -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) {
}
}

View File

@@ -10,7 +10,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy 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: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: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} username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456} # password: ${DB_PWD:Root.123456}

View File

@@ -22,6 +22,7 @@ export default {
'device_dialog': { 'device_dialog': {
'zh_device_name': 'ZH-name', 'zh_device_name': 'ZH-name',
'en_device_name': 'EN-name', 'en_device_name': 'EN-name',
'in_device_name': 'IN-Nama',
'ko_device_name': 'KO-Nama' 'ko_device_name': 'KO-Nama'
}, },
'driver_configuration': { 'driver_configuration': {

View File

@@ -22,6 +22,7 @@ export default {
'device_dialog': { 'device_dialog': {
'zh_device_name': 'ZH-Nama', 'zh_device_name': 'ZH-Nama',
'en_device_name': 'EN-Nama', 'en_device_name': 'EN-Nama',
'in_device_name': 'IN-Nama',
'ko_device_name': 'KO-Nama' 'ko_device_name': 'KO-Nama'
}, },
'driver_configuration': { 'driver_configuration': {

View File

@@ -22,6 +22,7 @@ export default {
'device_dialog': { 'device_dialog': {
'zh_device_name': '中文设备名称', 'zh_device_name': '中文设备名称',
'en_device_name': '英文设备名称', 'en_device_name': '英文设备名称',
'in_device_name': '因你设备名称',
'ko_device_name': '韩国设备名称' 'ko_device_name': '韩国设备名称'
}, },
'driver_configuration': { 'driver_configuration': {

View File

@@ -74,6 +74,7 @@ import crud from '@/mixins/crud'
import { get, selectDriverCodeList } from '@/api/acs/device/driverConfig' import { get, selectDriverCodeList } from '@/api/acs/device/driverConfig'
import { getDicts } from '@/views/system/dict/dict' import { getDicts } from '@/views/system/dict/dict'
import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' import standard_autodoor from '@/views/acs/device/driver/standard_autodoor'
import standard_conveyor_with_inspect from '@/views/acs/device/driver/standard_conveyor_with_inspect'
import standard_inspect_site from './driver/standard_inspect_site' import standard_inspect_site from './driver/standard_inspect_site'
import ranging_stations from './driver/ranging_stations' import ranging_stations from './driver/ranging_stations'
import standard_ordinary_site from './driver/standard_ordinary_site' import standard_ordinary_site from './driver/standard_ordinary_site'
@@ -198,6 +199,7 @@ export default {
manipulator_cache, manipulator_cache,
paper_tube_pick_size, paper_tube_pick_size,
one_rgv, one_rgv,
standard_conveyor_with_inspect,
die_manipulator die_manipulator
}, },
dicts: ['device_type'], dicts: ['device_type'],

View File

@@ -0,0 +1,413 @@
<template>
<!--标准版-带光电检测站点-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">设备协议</span>
</div>
<el-row>
<el-col :span="12">
OpcServer:
<el-select
v-model="opc_id"
placeholder="无"
clearable
@change="changeOpc"
>
<el-option
v-for="item in dataOpcservers"
:key="item.opc_id"
:label="item.opc_name"
:value="item.opc_id"
/>
</el-select>
</el-col>
<el-col :span="12">
PLC:
<el-select
v-model="plc_id"
placeholder="无"
clearable
@change="changePlc"
>
<el-option
v-for="item in dataOpcPlcs"
:key="item.plc_id"
:label="item.plc_name"
:value="item.plc_id"
/>
</el-select>
</el-col>
</el-row>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">输送系统</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row>
<el-col :span="12">
<el-form-item label="电气调度号" label-width="150px">
<el-switch v-model="form.OPCServer" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="选择区域" prop="region">
<el-select
v-model="form.region"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in region"
:key="item.region_number"
:label="item.region_name"
:value="item.region_number"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="关联设备" prop="device_code" label-width="135px">
<el-select
v-model="form.link_device_code"
filterable
clearable
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_name"
:label="item.device_code"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">PLC读取字段</span>
</div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-table
v-loading="false"
:data="data1"
:max-height="550"
size="small"
style="width: 100%;margin-bottom: 15px"
>
<el-table-column prop="name" label="用途" />
<el-table-column prop="code" label="别名要求" />
<el-table-column prop="db" label="DB块">
<template slot-scope="scope">
<el-input
v-model="data1[scope.$index].db"
size="mini"
class="edit-input"
@input="finishReadEdit(data1[scope.$index])"
/>
</template>
</el-table-column>
<el-table-column prop="dbr_value">
<template slot="header">
<el-link type="primary" :underline="false" @click.native="test_read1()">测试读</el-link>
</template>
<template slot-scope="scope">
<el-input v-model="data1[scope.$index].dbr_value" size="mini" class="edit-input" />
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<!-- <el-card class="box-card" shadow="never">-->
<!-- <div slot="header" class="clearfix">-->
<!-- <span class="role-span">PLC写入字段</span>-->
<!-- </div>-->
<!-- <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">-->
<!-- <el-table-->
<!-- v-loading="false"-->
<!-- :data="data2"-->
<!-- :max-height="550"-->
<!-- size="small"-->
<!-- style="width: 100%;margin-bottom: 15px"-->
<!-- >-->
<!-- <el-table-column prop="name" label="用途" />-->
<!-- <el-table-column prop="code" label="别名要求" />-->
<!-- <el-table-column prop="db" label="DB块">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-->
<!-- v-model="data2[scope.$index].db"-->
<!-- size="mini"-->
<!-- class="edit-input"-->
<!-- @input="finishWriteEdit(data2[scope.$index])"-->
<!-- />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="dbr_value2">-->
<!-- <template slot="header">-->
<!-- <el-link type="primary" :underline="false" @click.native="test_read2()">测试读</el-link>-->
<!-- </template>-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="data2[scope.$index].dbr_value" size="mini" class="edit-input" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="dbw_value">-->
<!-- <template slot="header">-->
<!-- <el-link type="primary" :underline="false" @click.native="test_write1()">测试写</el-link>-->
<!-- </template>-->
<!-- <template slot-scope="scope">-->
<!-- <el-input v-model="data2[scope.$index].dbw_value" size="mini" class="edit-input" />-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </el-form>-->
<!-- </el-card>-->
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig,
testRead,
testwrite
} from '@/api/acs/device/driverConfig'
import { selectOpcList } from '@/api/acs/device/opc'
import { selectPlcList } from '@/api/acs/device/opcPlc'
import { selectListByOpcID } from '@/api/acs/device/opcPlc'
import deviceCrud from '@/api/acs/device/device'
import crud from '@/mixins/crud'
export default {
name: 'StandardConveyorWithInspect',
mixins: [crud],
props: {
parentForm: {
type: Object,
required: true
}
},
data() {
return {
device_code: '',
device_id: '',
plc_id: '',
plc_code: '',
opc_id: '',
opc_code: '',
configLoading: false,
dataOpcservers: [],
dataOpcPlcs: [],
deviceList: [],
data1: [],
data2: [],
form: {
inspect_in_stocck: true,
ignore_pickup_check: true,
ignore_release_check: true,
apply_task: true,
manual_create_task: true,
is_pickup: true,
is_release: true
},
rules: {},
region: [
{ region_name: '区域一', region_number: '1' },
{ region_name: '区域二', region_number: '2' },
{ region_name: '区域三', region_number: '3' }
]
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
// 给表单赋值,并且属性不能为空
if (data.parentForm) {
const arr = Object.keys(data.parentForm)
// 不为空
if (arr.length > 0) {
this.opc_code = data.parentForm.opc_code
this.plc_code = data.parentForm.plc_code
}
}
this.data1 = data.rs
this.data2 = data.ws
this.sliceItem()
})
selectPlcList().then(data => {
this.dataOpcPlcs = data
this.plc_id = this.$props.parentForm.opc_plc_id
})
selectOpcList().then(data => {
this.dataOpcservers = data
this.opc_id = this.$props.parentForm.opc_server_id
})
deviceCrud.selectDeviceList().then(data => {
this.deviceList = data
})
})
},
methods: {
changeOpc(val) {
this.dataOpcservers.forEach(item => {
if (item.opc_id === val) {
this.opc_code = item.opc_code
}
})
selectListByOpcID(val).then(data => {
this.dataOpcPlcs = data
this.plc_id = ''
this.plc_code = ''
if (this.dataOpcPlcs && this.dataOpcPlcs.length > 0) {
this.plc_id = this.dataOpcPlcs[0].plc_id
this.plc_code = this.dataOpcPlcs[0].plc_code
}
this.sliceItem()
})
},
finishReadEdit(data) {
// 编辑的是code列,并且值包含mode
if (data.code.indexOf('mode') !== -1) {
const dbValue = data.db
// .之前的字符串
const beforeStr = dbValue.match(/(\S*)\./)[1]
// .之后的字符串
const afterStr = dbValue.match(/\.(\S*)/)[1]
// 取最后数字
const endNumber = afterStr.substring(1)
// 最后为非数字
if (isNaN(parseInt(endNumber))) {
return
}
for (const val in this.data1) {
if (this.data1[val].code.indexOf('action') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 1)
}
if (this.data1[val].code.indexOf('error') !== -1) {
this.data1[val].db = beforeStr + '.' + afterStr.substring(0, 1) + (parseInt(endNumber) + 2)
}
}
}
},
changePlc(val) {
this.dataOpcPlcs.forEach(item => {
if (item.plc_id === val) {
this.plc_code = item.plc_code
this.sliceItem()
return
}
})
},
test_read1() {
testRead(this.data1, this.opc_id).then(data => {
this.data1 = data
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_write1() {
testwrite(this.data2, this.opc_id).then(data => {
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
test_read2() {
testRead(this.data2, this.opc_id).then(data => {
this.data2 = data
console.log(this.data2)
this.notify('操作成功!', 'success')
}).catch(err => {
console.log(err.response.data.message)
})
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
parentForm.plc_id = this.plc_id
parentForm.opc_id = this.opc_id
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
},
sliceItem() { // 拼接DB的Item值
this.data1.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
this.data2.forEach(item => {
const str = item.code
// 是否包含.
if (str.search('.') !== -1) {
// 截取最后一位
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + str.slice(str.lastIndexOf('.') + 1)
} else {
item.code = this.opc_code + '.' + this.plc_code + '.' + this.device_code + '.' + item.code
}
})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -116,6 +116,9 @@
<el-form-item :label="$t('device.device_dialog.en_device_name')" prop="en_device_name"> <el-form-item :label="$t('device.device_dialog.en_device_name')" prop="en_device_name">
<el-input v-model="form.en_device_name" style="width: 370px;" /> <el-input v-model="form.en_device_name" style="width: 370px;" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('device.device_dialog.in_device_name')" prop="in_device_name">
<el-input v-model="form.in_device_name" style="width: 370px;" />
</el-form-item>
<el-form-item :label="$t('device.device_dialog.zh_device_name')" prop="zh_device_name"> <el-form-item :label="$t('device.device_dialog.zh_device_name')" prop="zh_device_name">
<el-input v-model="form.zh_device_name" style="width: 370px;" /> <el-input v-model="form.zh_device_name" style="width: 370px;" />
</el-form-item> </el-form-item>
@@ -248,7 +251,8 @@ const defaultForm = {
remark: null, remark: null,
zh_device_name: null, zh_device_name: null,
en_device_name: null, en_device_name: null,
in_device_name: null in_device_name: null,
ko_device_name: null
} }
export default { export default {
name: 'Device', name: 'Device',