feat: ndc部分驱动开发
This commit is contained in:
@@ -16,11 +16,11 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -28,11 +28,13 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
|
||||
/**
|
||||
* Demo class
|
||||
*
|
||||
@@ -43,7 +45,7 @@ import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
@Component
|
||||
public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
Socket s;
|
||||
Socket socket;
|
||||
String ip = "192.168.46.225";
|
||||
int port = 1234;
|
||||
static DataOutputStream dos;
|
||||
@@ -71,10 +73,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
public OneNDCSocketConnectionAutoRun() {
|
||||
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return OneNDCSocketConnectionAutoRun.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "NDC在线连接";
|
||||
@@ -92,13 +96,16 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL2).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue());
|
||||
|
||||
InetSocketAddress socketAddress = new InetSocketAddress(ip, port);
|
||||
|
||||
try {
|
||||
byte[] b = new byte[1024];
|
||||
s = new Socket(ip, port);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
socket = new Socket(ip, port);
|
||||
socket.connect(socketAddress, 5 * 1000);
|
||||
socket.setKeepAlive(true);//长链接
|
||||
socket.setSoTimeout(30000);//读取超时时间
|
||||
dos = new DataOutputStream(socket.getOutputStream());
|
||||
dis = new DataInputStream(socket.getInputStream());
|
||||
System.out.println("NDCAgv链接成功");
|
||||
log.info("NDCAgv链接成功");
|
||||
while (bConnected) {
|
||||
@@ -129,9 +136,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
int phase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
int index = arr[12] * 256 + arr[13];
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
int ikey = arr[26] * 256 + arr[27];
|
||||
//站点号
|
||||
int agvaddr = arr[18] * 256 + arr[19];
|
||||
@@ -202,23 +209,23 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
|
||||
}else if (phase == 0x64){
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
} else if (phase == 0x64) {
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}", agvaddr, station);
|
||||
Dict dict = dictService.getDictByName3("station", String.valueOf(agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
dict.setValue("1");
|
||||
dict.setPara2(String.valueOf(agvaddr));
|
||||
dict.setPara3("下发成功");
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
//充电成功
|
||||
}else if (phase == 0x65){
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station);
|
||||
} else if (phase == 0x65) {
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}", agvaddr, station);
|
||||
//充电取消上报
|
||||
}else if (phase == 0x66){
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
} else if (phase == 0x66) {
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}", agvaddr, station);
|
||||
Dict dict = dictService.getDictByName3("station", String.valueOf(agvaddr), null);
|
||||
if (ObjectUtil.isNotEmpty(dict)) {
|
||||
dict.setValue("0");
|
||||
dict.setPara2("");
|
||||
dict.setPara3("充电桩空闲");
|
||||
@@ -253,8 +260,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
System.out.println("Agv链接异常");
|
||||
log.info("Agv链接异常");
|
||||
log.error("agv连接出现异常:{}", e);
|
||||
if (ObjectUtil.isNotEmpty(s)) {
|
||||
s.close();
|
||||
if (ObjectUtil.isNotEmpty(socket)) {
|
||||
socket.close();
|
||||
}
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
@@ -271,7 +278,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
public void stop() {
|
||||
super.after();
|
||||
try {
|
||||
s.close();
|
||||
socket.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -100,12 +100,6 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
log.info("2楼1区域AGV系统链接开始");
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
// byte[] b = new byte[1024];
|
||||
// s = new Socket(ip, port);
|
||||
// System.out.println("2楼1区域Agv链接成功");
|
||||
// dos = new DataOutputStream(s.getOutputStream());
|
||||
// dis = new DataInputStream(s.getInputStream());
|
||||
|
||||
InetSocketAddress socketAddress = new InetSocketAddress(ip, port);
|
||||
|
||||
byte[] b = new byte[1024];
|
||||
@@ -248,7 +242,9 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
instructionService.cancelNOSendAgv(inst.getInstruction_id());
|
||||
}
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
|
||||
} else if (phase == 0x50) {
|
||||
}
|
||||
// 开门
|
||||
else if (phase == 0x50) {
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
@@ -274,7 +270,9 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
}
|
||||
|
||||
} else if (phase == 0x51) {
|
||||
}
|
||||
// 关门
|
||||
else if (phase == 0x51) {
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
@@ -299,7 +297,9 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
} else {
|
||||
log.info(device_code + "对应设备号为空!");
|
||||
}
|
||||
} else if (phase == 0x64){
|
||||
}
|
||||
// todo: ??
|
||||
else if (phase == 0x64){
|
||||
log.info("AGV车号{}反馈充电任务下发成功,锁定充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
@@ -309,10 +309,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
dictService.updateDetail(dict);
|
||||
}
|
||||
//充电成功
|
||||
}else if (phase == 0x65){
|
||||
}
|
||||
// todo: ??
|
||||
else if (phase == 0x65){
|
||||
log.info("AGV车号{}反馈充电中,充电桩{}",agvaddr,station);
|
||||
//充电取消上报
|
||||
}else if (phase == 0x66){
|
||||
}
|
||||
// todo: ??
|
||||
else if (phase == 0x66){
|
||||
log.info("AGV车号{}反馈充电任务已取消,释放充电桩{}",agvaddr,station);
|
||||
Dict dict = dictService.getDictByName3("station",String.valueOf(agvaddr),null);
|
||||
if (ObjectUtil.isNotEmpty(dict)){
|
||||
|
||||
@@ -16,6 +16,9 @@ import org.nl.acs.device_driver.FeedLmsRealFailed;
|
||||
import org.nl.acs.device_driver.agv.utils.OneAgvPhase;
|
||||
import org.nl.acs.device_driver.conveyor.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.device_driver.zz_driver.unpacking_conveyor.UnpackingConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.zz_driver.unpacking_machine.UnpackingMachineDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.ApplyPlugPullSitResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
@@ -24,11 +27,14 @@ import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* NDC单工位AGV
|
||||
@@ -41,11 +47,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.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);
|
||||
// DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
// DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
|
||||
OneAgvPhase oneAgvPhase = new OneAgvPhase();
|
||||
|
||||
@@ -103,9 +110,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
phase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
int index = arr[12] * 256 + arr[13];
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
int ikey = arr[26] * 256 + arr[27];
|
||||
//站点号
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
@@ -143,11 +150,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
// if (arr[18] * 256 + arr[19] == 0) {
|
||||
//
|
||||
// }
|
||||
// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// data = nDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// }
|
||||
|
||||
//普通站点
|
||||
StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver;
|
||||
UnpackingMachineDeviceDriver unpackingMachineDeviceDriver;
|
||||
UnpackingConveyorDeviceDriver unpackingConveyorDeviceDriver;
|
||||
|
||||
//分配 车id
|
||||
//(不需要WCS反馈)
|
||||
@@ -202,6 +211,63 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 1);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingMachineDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 1);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingConveyorDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//取货完毕
|
||||
@@ -249,9 +315,46 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 2);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 2);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(data)) {
|
||||
@@ -259,7 +362,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
//到达放货点
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x07) {
|
||||
} else if (phase == 0x08) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
@@ -295,13 +398,71 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 3);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingMachineDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 3);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingConveyorDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//放货完毕
|
||||
//(需要WCS反馈)
|
||||
} else if (phase == 0x09) {
|
||||
} else if (phase == 0x0A) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
@@ -338,11 +499,420 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 4);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 4);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 到达取货2
|
||||
else if (phase == 0x0C) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (agvaddr != 0) {
|
||||
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 + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空");
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 1);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingMachineDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 1);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingConveyorDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 取货完毕2
|
||||
else if (phase == 0x0E) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||
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 + "对应设备号为空!");
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code);
|
||||
return;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey);
|
||||
return;
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
standardOrdinarySiteDeviceDriver.setAgvphase(phase);
|
||||
standardOrdinarySiteDeviceDriver.setIndex(index);
|
||||
standardOrdinarySiteDeviceDriver.setInst(inst);
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 2);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 2);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 到达放货2
|
||||
else if (phase == 0x10) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||
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;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到关联编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
|
||||
// 各个驱动判断
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 3);
|
||||
try {
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingMachineDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingMachineDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 请求进入
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 3);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (unpackingConveyorDeviceDriver.getAction() == 1) {
|
||||
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 + ",动作信号:" + unpackingConveyorDeviceDriver.getAction() + ",指令号:" + ikey + "不满足取货条件";
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.getDeviceCode())
|
||||
.content(message)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 放货完毕2
|
||||
else if (phase == 0x12) {
|
||||
if (agvaddr == 0) {
|
||||
agvaddr = agvaddr_copy;
|
||||
}
|
||||
if (agvaddr < 1) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
CommonFinalParam commonFinalParam = new CommonFinalParam();
|
||||
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;
|
||||
}
|
||||
//校验agv上报站点编号与指令起始点相同
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
log.info("未找到编号{}对应的指令", ikey);
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(inst.getNext_device_code2(), device_code)) {
|
||||
|
||||
if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingMachineDeviceDriver) {
|
||||
unpackingMachineDeviceDriver = (UnpackingMachineDeviceDriver) device.getDeviceDriver();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 下发去皮
|
||||
map.put("to_operate", 1);
|
||||
// 告知放货完成
|
||||
map.put("to_command", 4);
|
||||
unpackingMachineDeviceDriver.writing(map);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
}
|
||||
|
||||
if (device.getDeviceDriver() instanceof UnpackingConveyorDeviceDriver) {
|
||||
unpackingConveyorDeviceDriver = (UnpackingConveyorDeviceDriver) device.getDeviceDriver();
|
||||
// 取货完毕
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("to_command", 4);
|
||||
try {
|
||||
unpackingConveyorDeviceDriver.writing(map);
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// 料桶检验
|
||||
else if (phase == 0x61) {
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
log.info(agvaddr + "对应设备号为空!");
|
||||
return;
|
||||
}
|
||||
String task_code = inst.getTask_code();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("task_code", task_code);
|
||||
jsonObject.put("vehicle_code", agvaddr);
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("AGV-61")
|
||||
.content("料桶检验AGV扫码反馈:" + jsonObject.toJSONString() + ";设备:AGV-61")
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
ApplyPlugPullSitResponse response = acsToWmsService.actionCheckMaterialBucket(jsonObject);
|
||||
if (response.getCode() == 200) {
|
||||
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0, 0, 0);
|
||||
}
|
||||
this.setPhase(phase);
|
||||
}
|
||||
//到达位置点
|
||||
//(需要WCS反馈)
|
||||
//param,agv货位id待定
|
||||
@@ -350,13 +920,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
//1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
|
||||
agvaddr = arr[18] * 256 + arr[19];
|
||||
agvaddr_copy = agvaddr;
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
//进入交通灯区域
|
||||
} else if (phase == 0x50) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
//离开交通灯区域
|
||||
} else if (phase == 0x51) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
//agv异常
|
||||
} else if (phase == 0x67) {
|
||||
// if (ikey == 0) {
|
||||
@@ -384,7 +954,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
param.put("product_area", paramService.findByCode("productArea").getValue());
|
||||
// acsToWmsService.sendDeviceStatus(param);
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
last_error = error;
|
||||
} else if (phase == 0x70) {
|
||||
//x坐标
|
||||
@@ -467,19 +1037,17 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常";
|
||||
//agv状态
|
||||
jo.put("status_name", status_name);
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
/**
|
||||
* 任务号
|
||||
*/
|
||||
jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code());
|
||||
//异常
|
||||
jo.put("fault", this.getError_message());
|
||||
jo.put("message",message);
|
||||
jo.put("message", message);
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.data.ApplyPlugPullSitResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
@@ -35,6 +37,8 @@ public class UnpackingConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
private DeviceExecuteLogService logServer;
|
||||
@Resource
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Resource
|
||||
private AcsToWmsService acsToWmsService;
|
||||
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
@@ -81,10 +85,13 @@ public class UnpackingConveyorDeviceDriver extends AbstractOpcDeviceDriver imple
|
||||
move = itemProtocol.getMove();
|
||||
error = itemProtocol.getError();
|
||||
|
||||
if (move == 1 && mode == 5 && mode != last_mode) {
|
||||
// 1、todo: 请求LMS横移
|
||||
// 2、复位
|
||||
this.writing("to_command", 5);
|
||||
if (mode == 5 && mode != last_mode) {
|
||||
// 1、请求LMS横移
|
||||
ApplyPlugPullSitResponse response = acsToWmsService.actionMove(new JSONObject().fluentPut("device_code", device_code));
|
||||
if (response.getCode() == 200) {
|
||||
// 2、复位
|
||||
this.writing("to_command", 5);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -132,6 +132,7 @@ public class UnpackingMachineDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
|
||||
public void writing(String commandKey, int command) {
|
||||
log.info("执行写入数据:{} - {}", commandKey, command);
|
||||
Map<String, Object> itemMap = new HashMap<>();
|
||||
itemMap.put(getToParam(commandKey), command);
|
||||
this.control(itemMap);
|
||||
|
||||
@@ -217,6 +217,20 @@ public interface AcsToWmsService {
|
||||
*/
|
||||
void actionFinishRequest2(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 检测料桶
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
ApplyPlugPullSitResponse actionCheckMaterialBucket(JSONObject jsonObject);
|
||||
|
||||
/**
|
||||
* 横移请求
|
||||
* @param jsonObject
|
||||
* @return
|
||||
*/
|
||||
ApplyPlugPullSitResponse actionMove(JSONObject jsonObject);
|
||||
|
||||
String forceMove(JSONObject param);
|
||||
|
||||
/**
|
||||
|
||||
@@ -857,6 +857,86 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplyPlugPullSitResponse actionCheckMaterialBucket(JSONObject param) {
|
||||
log.info("向lms请求校验料桶编码,请求参数{}", param);
|
||||
String result = "";
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse = new ApplyPlugPullSitResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("actionCheckMaterialBucket");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("向lms请求校验料桶编码----请求参数:{}", JSONObject.toJSONString(param));
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionCheckMaterialBucket", String.valueOf(applyPlugPullSitResponse.getstatus()),
|
||||
JSON.toJSONString(param), String.valueOf(result), "ACS向LMS申请料桶检验");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("向lms请求校验料桶编码----返回参数{}", e.getMessage());
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionCheckMaterialBucket", String.valueOf(applyPlugPullSitResponse.getstatus()),
|
||||
JSON.toJSONString(param),
|
||||
String.valueOf(result), "向lms请求校验料桶编码请求失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
}
|
||||
return applyPlugPullSitResponse;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplyPlugPullSitResponse actionMove(JSONObject param) {
|
||||
log.info("向lms请求横移,请求参数{}", param);
|
||||
String result = "";
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
ApplyPlugPullSitResponse applyPlugPullSitResponse = new ApplyPlugPullSitResponse();
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
|
||||
String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("actionMove");
|
||||
String methods_url = addressDto.getMethods_url();
|
||||
String url = wmsUrl + methods_url;
|
||||
log.info("向lms请求横移----请求参数:{}", JSONObject.toJSONString(param));
|
||||
try {
|
||||
result = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.body(JSON.toJSONString(param))
|
||||
.execute().body();
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionMove", String.valueOf(applyPlugPullSitResponse.getstatus()),
|
||||
JSON.toJSONString(param), String.valueOf(result), "向lms请求横移");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
} catch (Exception e) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
log.info("向lms请求校验料桶编码----返回参数{}", e.getMessage());
|
||||
applyPlugPullSitResponse = JSONObject.toJavaObject(jsonObject, ApplyPlugPullSitResponse.class);
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4, "actionMove", String.valueOf(applyPlugPullSitResponse.getstatus()),
|
||||
JSON.toJSONString(param),
|
||||
String.valueOf(result), "向lms请求横移请求失败");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
}
|
||||
}
|
||||
return applyPlugPullSitResponse;
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse feedbackDies(JSONObject param) {
|
||||
HttpResponse result2 = null;
|
||||
|
||||
Reference in New Issue
Block a user