Browse Source

add ndc驱动

master
周俊杰 1 year ago
parent
commit
c0f08af6a5
  1. 810
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  2. 2
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/converor_barcode/ConveyorBarcodeDeviceDriver.java
  3. 3
      acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java
  4. 5
      acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java
  5. 2
      acs/nladmin-ui/src/views/acs/device/index.vue

810
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -2,12 +2,15 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.mvel2.util.ErrorUtil;
import org.nl.acs.agv.server.AgvService;
import org.nl.acs.agv.server.NDCAgvService;
import org.nl.acs.config.AcsConfig;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.basedriver.agv.utils.OneAgvPhase;
@ -15,11 +18,17 @@ import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspect
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
import org.nl.acs.device_driver.lnsh.converor_barcode.ConveyorBarcodeDeviceDriver;
import org.nl.acs.device_driver.lnsh.conveyor_press_station.ConveyorPressStationDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_fold_disc_site.LnshFoldDiscSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.LnshPalletizingManipulatorSiteDeviceDriver;
import org.nl.acs.device_driver.lnsh.lnsh_station.LnshStationDeviceDriver;
import org.nl.acs.device_driver.standard_autodoor.StandardAutodoorDeviceDriver;
import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.ext.wms.service.WmsToAcsService;
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
import org.nl.acs.ext.wms.service.impl.WmsToAcsServiceImpl;
import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
@ -27,6 +36,9 @@ import org.nl.acs.log.service.DeviceExecuteLogService;
import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.Device;
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.modules.system.service.ParamService;
import org.nl.modules.system.service.impl.ParamServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
@ -47,14 +59,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.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);
NDCAgvService AgvService = SpringContextHolder.getBean(NDCAgvService.class);
OneAgvPhase oneAgvPhase = new OneAgvPhase();
ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class);
WmsToAcsService wmsToAcsService=SpringContextHolder.getBean(WmsToAcsService.class);
int agvaddr = 0;
int agvaddr_copy = 0;
int weight = 0;
@ -70,7 +84,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
int error = 0;
int last_error = 0;
String error_message = "";
boolean flag = false;
private synchronized void setErrorInfo(int error, String error_code, String error_message) {
this.error = error;
this.error_code = error_code;
@ -137,9 +151,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
LnshStationDeviceDriver lnshStationDeviceDriver;
//码垛机械手工位
LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver;
//标准版-压制对接位
ConveyorPressStationDeviceDriver conveyorPressStationDeviceDriver;
//下发条码输送线工位
ConveyorBarcodeDeviceDriver conveyorBarcodeDeviceDriver;
//标准版-叠盘机
LnshFoldDiscSiteDeviceDriver lnshFoldDiscSiteDeviceDriver;
//标准版-覆膜机
LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver;
//分配 车id
//(不需要WCS反馈)
if (phase == 0x02) {
@ -150,6 +169,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
//到达取货点
//(需要WCS反馈)
} else if (phase == 0x03) {
log.info("==================AGV请求取货==================");
if (ObjectUtil.isEmpty(device)) {
log.info("未找到 address = " + agvaddr + " 的设备");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令:" + ikey);
logServer.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]");
return;
}
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
@ -184,6 +213,195 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
//标准版-机械手对接位
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
lnshPalletizingManipulatorSiteDeviceDriver.writing(2);
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() != 0
&& lnshPalletizingManipulatorSiteDeviceDriver.getMove() != 0
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 1)
&& (lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 1)) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 3 && lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 1) {
message += "站点不允许进入,";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getAction() != 3 && lnshPalletizingManipulatorSiteDeviceDriver.getAction() != 1) {
message += "站点不允许取货,";
}
}
message += "不允许AGV取货。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-工位(交互模板)
if(device.getDeviceDriver() instanceof LnshStationDeviceDriver){
lnshStationDeviceDriver=(LnshStationDeviceDriver) device.getDeviceDriver();
lnshStationDeviceDriver.writing(2);
if(lnshStationDeviceDriver.getMode()!=0
&&lnshStationDeviceDriver.getMove() != 0
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)
&& (lnshStationDeviceDriver.getAction() == 3 || lnshStationDeviceDriver.getAction() == 1)){
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshStationDeviceDriver.setMessage("");
flag=true;
}else{
String message="";
if(lnshStationDeviceDriver.getMode()==0){
message += "站点未联机,";
}else{
if(lnshStationDeviceDriver.getMove()==0){
message += "站点无货,";
}
if (lnshStationDeviceDriver.getIo_action() != 3 && lnshStationDeviceDriver.getIo_action() != 1) {
message += "站点不允许进入,";
}
if (lnshStationDeviceDriver.getAction() != 3 && lnshStationDeviceDriver.getAction() != 1) {
message += "站点不允许取货,";
}
}
message += "不允许AGV取货。";
lnshStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-压制对接位
if(device.getDeviceDriver() instanceof ConveyorPressStationDeviceDriver){
conveyorPressStationDeviceDriver = (ConveyorPressStationDeviceDriver) device.getDeviceDriver();
TaskDto task=taskService.findByCode(inst.getTask_code());
String direction=task.getDirection();
Integer direction1=Integer.parseInt(direction);
//困料位写入方向
conveyorPressStationDeviceDriver.writing(2,direction1);
conveyorPressStationDeviceDriver.writing(2);
if (conveyorPressStationDeviceDriver.getMode() != 0
&& conveyorPressStationDeviceDriver.getMove() != 0
&& (conveyorPressStationDeviceDriver.getIo_action() == 3 || conveyorPressStationDeviceDriver.getIo_action() == 1)
&& (conveyorPressStationDeviceDriver.getAction() == 3 || conveyorPressStationDeviceDriver.getAction() == 1)) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorPressStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorPressStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorPressStationDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (conveyorPressStationDeviceDriver.getIo_action() != 3 && conveyorPressStationDeviceDriver.getIo_action() != 1) {
message += "站点不允许进入,";
}
if (conveyorPressStationDeviceDriver.getAction() != 3 && conveyorPressStationDeviceDriver.getAction() != 1) {
message += "站点不允许取货,";
}
}
message += "不允许AGV取货。";
conveyorPressStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.IGNOREHASGOODS).getValue(), "1")) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}无货,无法反馈");
}
}
}
//标准版-下发条码输送线
if(device.getDeviceDriver() instanceof ConveyorBarcodeDeviceDriver){
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
conveyorBarcodeDeviceDriver.writing(2);
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() != 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 3 || conveyorBarcodeDeviceDriver.getIo_action() == 1)
&& (conveyorBarcodeDeviceDriver.getAction() == 3 || conveyorBarcodeDeviceDriver.getAction() == 1)) {
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorBarcodeDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorBarcodeDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorBarcodeDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 3 && conveyorBarcodeDeviceDriver.getIo_action() != 1) {
message += "站点不允许进入,";
}
if (conveyorBarcodeDeviceDriver.getAction() != 3 && conveyorBarcodeDeviceDriver.getAction() != 1) {
message += "站点不允许取货,";
}
}
message += "不允许AGV取货。";
conveyorBarcodeDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-叠盘机 LnshFoldDiscSiteDeviceDriverl
if(device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver){
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
lnshFoldDiscSiteDeviceDriver.writing(2);
if (lnshFoldDiscSiteDeviceDriver.getMode() != 0
&& lnshFoldDiscSiteDeviceDriver.getMove() != 0) {
// && (lnshFoldDiscSiteDeviceDriver.getIo_action() == 3 || lnshFoldDiscSiteDeviceDriver.getIo_action() == 1)
// && (lnshFoldDiscSiteDeviceDriver.getAction() == 3 || lnshFoldDiscSiteDeviceDriver.getAction() == 1)
inst.setExecute_status("1");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshFoldDiscSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshFoldDiscSiteDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
// if (lnshFoldDiscSiteDeviceDriver.getIo_action() != 3 && lnshFoldDiscSiteDeviceDriver.getIo_action() != 1) {
// message += "站点不允许进入,";
// }
// if (lnshFoldDiscSiteDeviceDriver.getAction() != 3 && lnshFoldDiscSiteDeviceDriver.getAction() != 1) {
// message += "站点不允许取货,";
// }
}
message += "不允许AGV取货。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
@ -195,9 +413,23 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
if (flag) {
log.info("==================允许AGV取货==================");
logServer.deviceExecuteLog(device_code, "", "", "允许AGV取货。");
}
//取货完毕
//(需要WCS反馈)
} else if (phase == 0x05) {
log.info("================AGV取货完成请求离开================");
if (ObjectUtil.isEmpty(device)) {
log.info("未找到 address = " + ikey + " 的设备");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令:" + ikey);
logServer.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]");
return;
}
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
@ -231,7 +463,172 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
return;
}
//标准版-机械手对接位
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
lnshPalletizingManipulatorSiteDeviceDriver.writing(2);
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() != 0
&& lnshPalletizingManipulatorSiteDeviceDriver.getMove() != 0
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2)
) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0) {
message += "站点有货,";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 3 && lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 2) {
message += "站点不允许离开,";
}
}
message += "不允许AGV取货后离开。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-工位(交互模板) LnshStationDeviceDriver
if(device.getDeviceDriver() instanceof LnshStationDeviceDriver){
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
lnshStationDeviceDriver.writing(2);
if (lnshStationDeviceDriver.getMode() != 0
&& lnshStationDeviceDriver.getMove() != 0
&& (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)
) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshStationDeviceDriver.getMove() == 0) {
message += "站点有货,";
}
if (lnshStationDeviceDriver.getIo_action() != 3 && lnshStationDeviceDriver.getIo_action() != 2) {
message += "站点不允许离开,";
}
}
message += "不允许AGV取货后离开。";
lnshStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-压制对接位
if(device.getDeviceDriver() instanceof ConveyorPressStationDeviceDriver){
conveyorPressStationDeviceDriver = (ConveyorPressStationDeviceDriver) device.getDeviceDriver();
conveyorPressStationDeviceDriver.writing(2);
if (conveyorPressStationDeviceDriver.getMode() != 0
&& conveyorPressStationDeviceDriver.getMove() != 0
&& (conveyorPressStationDeviceDriver.getIo_action() == 3 || conveyorPressStationDeviceDriver.getIo_action() == 2)
) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorPressStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorPressStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorPressStationDeviceDriver.getMove() == 0) {
message += "站点有货,";
}
if (conveyorPressStationDeviceDriver.getIo_action() != 3 && conveyorPressStationDeviceDriver.getIo_action() != 2) {
message += "站点不允许离开,";
}
}
message += "不允许AGV取货后离开。";
conveyorPressStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.IGNOREHASGOODS).getValue(), "1")) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
}
}
//标准版-下发条码输送线
if(device.getDeviceDriver() instanceof ConveyorBarcodeDeviceDriver){
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
conveyorBarcodeDeviceDriver.writing(2);
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() != 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 3 || conveyorBarcodeDeviceDriver.getIo_action() == 2)
) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorBarcodeDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorBarcodeDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorBarcodeDeviceDriver.getMove() == 0) {
message += "站点有货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 3 && conveyorBarcodeDeviceDriver.getIo_action() != 2) {
message += "站点不允许离开,";
}
}
message += "不允许AGV取货后离开。";
conveyorBarcodeDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-叠盘机
if(device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver){
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
lnshFoldDiscSiteDeviceDriver.writing(2);
if (lnshFoldDiscSiteDeviceDriver.getMode() != 0
&& lnshFoldDiscSiteDeviceDriver.getMove() != 0
// && (lnshFoldDiscSiteDeviceDriver.getIo_action() == 3 || lnshFoldDiscSiteDeviceDriver.getIo_action() == 2)
) {
inst.setExecute_status("5");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshFoldDiscSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshFoldDiscSiteDeviceDriver.getMove() == 0) {
message += "站点有货,";
}
// if (lnshFoldDiscSiteDeviceDriver.getIo_action() != 3 && lnshFoldDiscSiteDeviceDriver.getIo_action() != 2) {
// message += "站点不允许离开,";
// }
}
message += "不允许AGV取货后离开。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
if (StrUtil.equals(inst.getStart_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@ -250,9 +647,39 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(data)) {
logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data));
}
if (flag) {
String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue();
if (!StrUtil.startWith(inst.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
try {
JSONArray ar = new JSONArray();
JSONObject param = new JSONObject();
param.put("task_code", inst.getTask_code());
param.put("task_status", "4");
ar.add(param);
acsToWmsService.feedbackTaskStatusToWms(ar);
} catch (Exception e) {
logServer.deviceExecuteLog(device_code, "", "", "AGV取货完成离开后,反馈上位系统失败!");
e.printStackTrace();
}
}
}
if (flag) {
log.info("================允许AGV取货后离开=================");
logServer.deviceExecuteLog(device_code, "", "", "允许AGV取货后离开。");
}
//到达放货点
//(需要WCS反馈)
} else if (phase == 0x07) {
log.info("==================AGV请求放货==================");
if (ObjectUtil.isEmpty(device)) {
log.info("未找到 address = " + ikey + " 的设备");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令:" + ikey);
logServer.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]");
return;
}
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
@ -283,6 +710,188 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到关联编号{}对应的指令", ikey);
return;
}
//标准版-机械手对接位
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
lnshPalletizingManipulatorSiteDeviceDriver.writing(13);
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() != 0
&& lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 1 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3)
&& (lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 2 || lnshPalletizingManipulatorSiteDeviceDriver.getAction() == 3)) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() != 0) {
message += "站点有货,";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 1 && lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 3) {
message += "站点不允许进入,";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getAction() != 2 && lnshPalletizingManipulatorSiteDeviceDriver.getAction() != 3) {
message += "站点不允许放货,";
}
}
message += "不允许AGV放货。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-工位(交互模板)
if(device.getDeviceDriver() instanceof LnshStationDeviceDriver){
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
lnshStationDeviceDriver.writing(13);
if (lnshStationDeviceDriver.getMode() != 0
&& lnshStationDeviceDriver.getMove() == 0
&& (lnshStationDeviceDriver.getIo_action() == 1 || lnshStationDeviceDriver.getIo_action() == 3)
&& (lnshStationDeviceDriver.getAction() == 2 || lnshStationDeviceDriver.getAction() == 3)) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshStationDeviceDriver.getMove() != 0) {
message += "站点有货,";
}
if (lnshStationDeviceDriver.getIo_action() != 1 && lnshStationDeviceDriver.getIo_action() != 3) {
message += "站点不允许进入,";
}
if (lnshStationDeviceDriver.getAction() != 2 && lnshStationDeviceDriver.getAction() != 3) {
message += "站点不允许放货,";
}
}
message += "不允许AGV放货。";
lnshStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-压制对接位
if(device.getDeviceDriver() instanceof ConveyorPressStationDeviceDriver){
conveyorPressStationDeviceDriver = (ConveyorPressStationDeviceDriver) device.getDeviceDriver();
conveyorPressStationDeviceDriver.writing(13);
if (conveyorPressStationDeviceDriver.getMode() != 0
&& conveyorPressStationDeviceDriver.getMove() == 0
&& (conveyorPressStationDeviceDriver.getIo_action() == 1 || conveyorPressStationDeviceDriver.getIo_action() == 3)
&& (conveyorPressStationDeviceDriver.getAction() == 2 || conveyorPressStationDeviceDriver.getAction() == 3)) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorPressStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorPressStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorPressStationDeviceDriver.getMove() != 0) {
message += "站点有货,";
}
if (conveyorPressStationDeviceDriver.getIo_action() != 1 && conveyorPressStationDeviceDriver.getIo_action() != 3) {
message += "站点不允许进入,";
}
if (conveyorPressStationDeviceDriver.getAction() != 2 && conveyorPressStationDeviceDriver.getAction() != 3) {
message += "站点不允许放货,";
}
}
message += "不允许AGV放货。";
conveyorPressStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.IGNOREHASGOODS).getValue(), "1")) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
}
}
//标准版-下发条码输送线
if(device.getDeviceDriver() instanceof ConveyorBarcodeDeviceDriver){
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
conveyorBarcodeDeviceDriver.writing(13);
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() == 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 1 || conveyorBarcodeDeviceDriver.getIo_action() == 3)
&& (conveyorBarcodeDeviceDriver.getAction() == 2 || conveyorBarcodeDeviceDriver.getAction() == 3)) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorBarcodeDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorBarcodeDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorBarcodeDeviceDriver.getMove() != 0) {
message += "站点有货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 1 && conveyorBarcodeDeviceDriver.getIo_action() != 3) {
message += "站点不允许进入,";
}
if (conveyorBarcodeDeviceDriver.getAction() != 2 && conveyorBarcodeDeviceDriver.getAction() != 3) {
message += "站点不允许放货,";
}
}
message += "不允许AGV放货。";
conveyorBarcodeDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-叠盘机
if(device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver){
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
lnshFoldDiscSiteDeviceDriver.writing(13);
if (lnshFoldDiscSiteDeviceDriver.getMode() != 0
&& lnshFoldDiscSiteDeviceDriver.getMove() == 0
// && (lnshFoldDiscSiteDeviceDriver.getIo_action() == 1 || lnshFoldDiscSiteDeviceDriver.getIo_action() == 3)
// && (lnshFoldDiscSiteDeviceDriver.getAction() == 2 || lnshFoldDiscSiteDeviceDriver.getAction() == 3)
) {
inst.setExecute_status("3");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshFoldDiscSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshFoldDiscSiteDeviceDriver.getMove() != 0) {
message += "站点有货,";
}
// if (lnshFoldDiscSiteDeviceDriver.getIo_action() != 1 && lnshFoldDiscSiteDeviceDriver.getIo_action() != 3) {
// message += "站点不允许进入,";
// }
// if (lnshFoldDiscSiteDeviceDriver.getAction() != 2 && lnshFoldDiscSiteDeviceDriver.getAction() != 3) {
// message += "站点不允许放货,";
// }
}
message += "不允许AGV放货。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
@ -296,9 +905,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
}
if (flag) {
log.info("==================允许AGV放货==================");
logServer.deviceExecuteLog(device_code, "", "", "允许AGV放货。");
}
//放货完毕
//(需要WCS反馈)
} else if (phase == 0x09) {
log.info("================AGV放货完成请求离开================");
if (ObjectUtil.isEmpty(device)) {
log.info("未找到 address = " + ikey + " 的设备");
return;
}
if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令:" + ikey);
logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey));
return;
}
if (agvaddr == 0) {
agvaddr = agvaddr_copy;
}
@ -330,18 +954,172 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("未找到编号{}对应的指令", ikey);
return;
}
if (StrUtil.equals(inst.getNext_device_code(), device_code)) {
if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver();
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
//标准版-机械手对接位
if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) {
lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver();
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() != 0
&& lnshPalletizingManipulatorSiteDeviceDriver.getMove() != 0
&& (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3)) {
inst.setExecute_status("6");
instructionService.update(inst);
lnshPalletizingManipulatorSiteDeviceDriver.writing(3);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshPalletizingManipulatorSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 2 && lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() != 3) {
message += "站点不允许离开,";
}
}
message += "不允许AGV放货后离开。";
lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
}
//标准版-工位(交互模板)
if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) {
lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver();
if (lnshStationDeviceDriver.getMode() != 0
&& lnshStationDeviceDriver.getMove() != 0
&& (lnshStationDeviceDriver.getIo_action() == 2 || lnshStationDeviceDriver.getIo_action() == 3)) {
inst.setExecute_status("6");
instructionService.update(inst);
lnshStationDeviceDriver.writing(3);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshStationDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (lnshStationDeviceDriver.getIo_action() != 2 && lnshStationDeviceDriver.getIo_action() != 3) {
message += "站点不允许离开,";
}
}
message += "不允许AGV放货后离开。";
lnshStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-压制对接位(需要给电气目标站)
if (device.getDeviceDriver() instanceof ConveyorPressStationDeviceDriver) {
conveyorPressStationDeviceDriver = (ConveyorPressStationDeviceDriver) device.getDeviceDriver();
if (conveyorPressStationDeviceDriver.getMode() != 0
&& conveyorPressStationDeviceDriver.getMove() != 0
&& (conveyorPressStationDeviceDriver.getIo_action() == 2 || conveyorPressStationDeviceDriver.getIo_action() == 3)) {
inst.setExecute_status("6");
instructionService.update(inst);
conveyorPressStationDeviceDriver.writing(3);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorPressStationDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorPressStationDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorPressStationDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (conveyorPressStationDeviceDriver.getIo_action() != 2 && conveyorPressStationDeviceDriver.getIo_action() != 3) {
message += "站点不允许离开,";
}
}
message += "不允许AGV放货后离开。";
conveyorPressStationDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//普通站点
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
if (StrUtil.equals(acsConfigService.findByCode(AcsConfig.IGNOREHASGOODS).getValue(), "1")) {
inst.setExecute_status("6");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
} else {
if (device.getHas_goods() != 0) {
inst.setExecute_status("6");
instructionService.update(inst);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
flag = true;
}
}
}
//标准版-下发条码输送线
if (device.getDeviceDriver() instanceof ConveyorBarcodeDeviceDriver) {
conveyorBarcodeDeviceDriver = (ConveyorBarcodeDeviceDriver) device.getDeviceDriver();
if (conveyorBarcodeDeviceDriver.getMode() != 0
&& conveyorBarcodeDeviceDriver.getMove() != 0
&& (conveyorBarcodeDeviceDriver.getIo_action() == 2 || conveyorBarcodeDeviceDriver.getIo_action() == 3)) {
inst.setExecute_status("6");
instructionService.update(inst);
conveyorBarcodeDeviceDriver.writing(3);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
conveyorBarcodeDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (conveyorBarcodeDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (conveyorBarcodeDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
if (conveyorBarcodeDeviceDriver.getIo_action() != 2 && conveyorBarcodeDeviceDriver.getIo_action() != 3) {
message += "站点不允许离开,";
}
}
message += "不允许AGV放货后离开。";
conveyorBarcodeDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
//标准版-叠盘机
if (device.getDeviceDriver() instanceof LnshFoldDiscSiteDeviceDriver) {
lnshFoldDiscSiteDeviceDriver = (LnshFoldDiscSiteDeviceDriver) device.getDeviceDriver();
if (lnshFoldDiscSiteDeviceDriver.getMode() != 0
&& lnshFoldDiscSiteDeviceDriver.getMove() != 0
// && (lnshFoldDiscSiteDeviceDriver.getIo_action() == 2 || lnshFoldDiscSiteDeviceDriver.getIo_action() == 3)
) {
inst.setExecute_status("6");
instructionService.update(inst);
lnshFoldDiscSiteDeviceDriver.writing(3);
data = AgvService.sendAgvOneModeInst(phase, index, 0);
lnshFoldDiscSiteDeviceDriver.setMessage("");
flag = true;
} else {
String message = "";
if (lnshFoldDiscSiteDeviceDriver.getMode() == 0) {
message += "站点未联机,";
} else {
if (lnshFoldDiscSiteDeviceDriver.getMove() == 0) {
message += "站点无货,";
}
// if (lnshFoldDiscSiteDeviceDriver.getIo_action() != 2 && lnshFoldDiscSiteDeviceDriver.getIo_action() != 3) {
// message += "站点不允许离开,";
// }
}
message += "不允许AGV放货后离开。";
lnshFoldDiscSiteDeviceDriver.setMessage(message);
logServer.deviceExecuteLog(device_code, "", "", message);
}
}
if (flag) {
log.info("================允许AGV放货后离开=================");
logServer.deviceExecuteLog(device_code, "", "", "允许AGV放货后离开。");
}
}
//到达位置点

2
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/converor_barcode/ConveyorBarcodeDeviceDriver.java

@ -42,7 +42,7 @@ import java.util.List;
import java.util.Map;
/**
* 晟华-工位(交互模板)
* 下发条码输送线工位
*/
@Slf4j
@Getter

3
acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java

@ -111,7 +111,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
String next_device_code = "";
String start_parent_code = "";
String next_parent_code = "";
//困料区需要方向
String direction=task.getDirection();
JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_point_code + "'").uniqueResult(0);
if (!ObjectUtil.isEmpty(start_device_json)) {

5
acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java

@ -243,4 +243,9 @@ public class TaskDto implements Serializable {
* 扩展参数
*/
private String params;
/**
* 方向 1往左 2往右
*/
private String direction;
}

2
acs/nladmin-ui/src/views/acs/device/index.vue

@ -263,7 +263,7 @@ export default {
regions: [],
is_configs: [],
uploadShow: false,
device_code: '',
regions: [],
rules: {
device_code: [

Loading…
Cancel
Save