Browse Source

add:添加驱动

master
涂强 4 months ago
parent
commit
59922c4606
  1. 402
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/agv/ndctwo/AgvNdcTwoDeviceDriver.java
  2. 44
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/ItemProtocol.java
  3. 58
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDefination.java
  4. 62
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDeviceDriver.java
  5. 2
      acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java
  6. 2
      acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml
  7. 1
      acs2/nladmin-ui/src/i18n/langs/device/en.js
  8. 1
      acs2/nladmin-ui/src/i18n/langs/device/in.js
  9. 1
      acs2/nladmin-ui/src/i18n/langs/device/zh.js
  10. 2
      acs2/nladmin-ui/src/views/acs/device/config.vue
  11. 413
      acs2/nladmin-ui/src/views/acs/device/driver/standard_conveyor_with_inspect.vue
  12. 6
      acs2/nladmin-ui/src/views/acs/device/index.vue

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

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

44
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/ItemProtocol.java

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

58
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDefination.java

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

62
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/standard_conveyor_with_inspect/StandardConveyorWithInspectDeviceDriver.java

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

2
acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java

@ -72,7 +72,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
group = opcServerService.getServer(this.getOpcServer());
itemsString = new ArrayList<>(itemValues.keySet());
Iterator nis = itemsString.iterator();
while (nis.hasNext()) {
String string = (String) nis.next();
try {

2
acs2/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -10,7 +10,7 @@ spring:
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hanguodoushan}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:xlm_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
username: ${DB_USER:root}
# password: ${DB_PWD:Root.123456}

1
acs2/nladmin-ui/src/i18n/langs/device/en.js

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

1
acs2/nladmin-ui/src/i18n/langs/device/in.js

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

1
acs2/nladmin-ui/src/i18n/langs/device/zh.js

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

2
acs2/nladmin-ui/src/views/acs/device/config.vue

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

413
acs2/nladmin-ui/src/views/acs/device/driver/standard_conveyor_with_inspect.vue

@ -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() { // DBItem
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>

6
acs2/nladmin-ui/src/views/acs/device/index.vue

@ -116,6 +116,9 @@
<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-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-input v-model="form.zh_device_name" style="width: 370px;" />
</el-form-item>
@ -248,7 +251,8 @@ const defaultForm = {
remark: null,
zh_device_name: null,
en_device_name: null,
in_device_name: null
in_device_name: null,
ko_device_name: null
}
export default {
name: 'Device',

Loading…
Cancel
Save