opt: 1.新增ndc端口服务,区分上报的任务和状态 2.上报任务状态时增加起点终点 3.车辆执行中时上报车号
This commit is contained in:
@@ -18,6 +18,8 @@ public interface AcsConfig {
|
||||
String AGVURL = "agvurl";
|
||||
//AGV系统端口
|
||||
String AGVPORT = "agvport";
|
||||
//AGV2系统端口
|
||||
String AGVPORT2 = "agvport2";
|
||||
//rgv系统接口地址
|
||||
String RGVURL = "rgvurl";
|
||||
//RGV系统端口
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.auto.run;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
@@ -30,6 +31,7 @@ import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
|
||||
@@ -115,6 +117,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
StringBuffer bs1 = new StringBuffer("0");
|
||||
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
|
||||
}
|
||||
log.info("接收agv上报任务信息:" + bs);
|
||||
// 从字节流的开头开始读取
|
||||
int offset = 0;
|
||||
// 循环处理字节流,逐个拆包 按照S消息解析
|
||||
@@ -134,7 +137,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
int messageLength = messageHeaderLength + messageDataLength;
|
||||
// 检查剩余字节是否足够处理完整的数据包
|
||||
if (offset + messageLength > packetData.length) {
|
||||
System.out.println("错误:检测到不完整的数据包。");
|
||||
// System.out.println("错误:检测到不完整的数据包。");
|
||||
log.info("错误:检测到不完整的数据包");
|
||||
// 数据包不完整,停止处理
|
||||
break;
|
||||
}
|
||||
@@ -172,7 +176,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
}
|
||||
log.info("接收agv上报信息:" + bs);
|
||||
log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
|
||||
Device device = null;
|
||||
String device_code = null;
|
||||
@@ -237,15 +240,35 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
}
|
||||
|
||||
// 更新偏移量,继续处理下一个数据包
|
||||
offset+=messageLength;
|
||||
} else {
|
||||
System.out.println("agv上报不是0073类型动作,不处理");
|
||||
log.info("agv上报不是0073类型动作,不处理");
|
||||
// 更新偏移量,继续处理下一个数据包
|
||||
offset+=messageHeaderLength;
|
||||
// ArrayUtils.indexOf()
|
||||
int index = IntStream.range(offset, packetData.length)
|
||||
.filter(i -> packetData[i] == 135 && packetData[i + 1] == 205)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
// 如果未找到,返回 -1
|
||||
if (index == -1) {
|
||||
break;
|
||||
}else {
|
||||
offset = index;
|
||||
}
|
||||
}
|
||||
// 更新偏移量,继续处理下一个数据包
|
||||
offset+=messageLength;
|
||||
}else {
|
||||
System.out.println("消息头无效,不处理。");
|
||||
break;
|
||||
log.info("消息头无效,不处理。");
|
||||
int index = IntStream.range(offset, packetData.length)
|
||||
.filter(i -> packetData[i] == 135 && packetData[i + 1] == 205)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
if (index == -1) {
|
||||
break;
|
||||
}else {
|
||||
offset = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
package org.nl.acs.auto.run;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.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.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.lucene.LuceneExecuteLogService;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static org.nl.acs.agv.server.impl.NDCAgvServiceImpl.Bytes2HexString;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@Lazy
|
||||
public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
|
||||
Socket s;
|
||||
String ip = "192.168.10.34";
|
||||
int port = 1234;
|
||||
static DataOutputStream dos;
|
||||
static DataInputStream dis;
|
||||
private int recordTimeOut = 10000;
|
||||
private Date recordTime;
|
||||
String[] ERROR = new String[]{
|
||||
"货叉尖部传感器触发", "S300传感器触发", "载货状态改变", "急停按钮触发", "触边开关出发", "需要复位",
|
||||
"停在充电位", "取货失败", "放货失败", "轮子打滑", "没有动作码不能进入站点", "取货时有货", "丢失定位",
|
||||
"抬叉停止"};
|
||||
boolean bConnected = true;
|
||||
|
||||
boolean isReConnect = false;
|
||||
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
@Autowired
|
||||
AutoRunService autoRunService;
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
ISysDictService dictService;
|
||||
|
||||
|
||||
public TwoNDCSocketConnectionAutoRun() {
|
||||
this.recordTime = new Date((new Date()).getTime() - (long) this.recordTimeOut);
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return TwoNDCSocketConnectionAutoRun.class.getSimpleName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "NDC2在线连接";
|
||||
}
|
||||
|
||||
//todo NDC相关逻辑
|
||||
public void autoRun() throws IOException {
|
||||
System.out.println("TwoNDCAgv链接开始");
|
||||
ISysParamService ISysParamService = SpringContextHolder.getBean(SysParamServiceImpl.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class);
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT2).getValue());
|
||||
|
||||
|
||||
try {
|
||||
byte[] b = new byte[1024];
|
||||
s = new Socket(ip, port);
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("NDCAgv链接成功");
|
||||
log.info("NDCAgv链接成功");
|
||||
while (bConnected) {
|
||||
int count = dis.read(b);
|
||||
|
||||
if (count == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
int[] packetData = new int[count];
|
||||
StringBuffer bs = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
int temp = b[i];
|
||||
if (temp < 0)
|
||||
temp += 256;
|
||||
packetData[i] = temp;
|
||||
StringBuffer bs1 = new StringBuffer("0");
|
||||
bs.append(temp < 16 ? bs1.append(Integer.toHexString(temp)) : Integer.toHexString(temp));
|
||||
}
|
||||
log.info("接收agv上报状态信息:" + bs);
|
||||
// 从字节流的开头开始读取
|
||||
int offset = 0;
|
||||
// 循环处理字节流,逐个拆包 按照S消息解析
|
||||
while (offset < packetData.length) {
|
||||
if (offset + 6 > packetData.length) {
|
||||
System.out.println("错误:没有足够的字节来读取长度字段。");
|
||||
break;
|
||||
}
|
||||
int messageHeader = packetData[offset] * 256 + packetData[offset+1];
|
||||
//检测消息头是否有效
|
||||
if (messageHeader == 0x87CD){
|
||||
//消息头长度
|
||||
int messageHeaderLength = packetData[offset+2] * 256 + packetData[offset+3];
|
||||
//消息数据长度
|
||||
int messageDataLength = packetData[offset+4] * 256 + packetData[offset+5];
|
||||
//消息总长度
|
||||
int messageLength = messageHeaderLength + messageDataLength;
|
||||
// 检查剩余字节是否足够处理完整的数据包
|
||||
if (offset + messageLength > packetData.length) {
|
||||
// System.out.println("错误:检测到不完整的数据包。");
|
||||
log.info("错误:检测到不完整的数据包");
|
||||
// 数据包不完整,停止处理
|
||||
break;
|
||||
}
|
||||
int[] arr = Arrays.copyOfRange(packetData, offset, offset+messageLength);
|
||||
boolean flag = false;
|
||||
if (arr[8] * 256 + arr[9] == 0x73) {
|
||||
byte[] data = null;
|
||||
System.out.println("接收agv上报信息:" + bs);
|
||||
//执行阶段
|
||||
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];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
//充电桩站点号
|
||||
int station = arr[25];
|
||||
Instruction link_inst = null;
|
||||
Instruction inst = null;
|
||||
List<Instruction> insts = null;
|
||||
boolean link_flag = false;
|
||||
Device agv_device = null;
|
||||
if (carno != 0) {
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
}
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
link_flag = true;
|
||||
}
|
||||
log.info("接收agv上报信息:" + "phase--" + phase + " index--" + index + " ikey--" + ikey + " agvaddr--" + agvaddr + " Car--" + carno);
|
||||
Device device = null;
|
||||
String device_code = null;
|
||||
|
||||
|
||||
//
|
||||
AgvNdcOneDeviceDriver agvNdcOneDeviceDriver;
|
||||
|
||||
//开始任务/上报订单号
|
||||
if (phase == 0x01) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
inst.setSend_status("1");
|
||||
instructionService.update(inst);
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
//任务完毕
|
||||
//(无车id及状态)
|
||||
else if (phase == 0x0A) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
} else {
|
||||
log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!");
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
log.info("指令号:{},已反馈agv任务完成!");
|
||||
}
|
||||
//todo 检查协议里删除任务流程有很多个步骤,在哪体现的
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0x30) {
|
||||
data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
//任务删除确认
|
||||
//(需要WCS反馈)
|
||||
else if (phase == 0xFF) {
|
||||
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
instructionService.cancelNOSendAgv(inst.getInstruction_id());
|
||||
}
|
||||
}
|
||||
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
} else {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75 || phase == 0x76 || phase == 0x77) {
|
||||
device = deviceAppService.findDeviceByCode(String.valueOf(agvaddr));
|
||||
} else {
|
||||
//todo NDC根据车辆编号123456进行查找特定车辆
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver();
|
||||
agvNdcOneDeviceDriver.processSocket2(arr);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
}
|
||||
// 更新偏移量,继续处理下一个数据包
|
||||
offset+=messageLength;
|
||||
} else {
|
||||
log.info("agv上报不是0073类型动作,不处理");
|
||||
// 更新偏移量,继续处理下一个数据包
|
||||
offset+=messageHeaderLength;
|
||||
// ArrayUtils.indexOf()
|
||||
int index = IntStream.range(offset, packetData.length)
|
||||
.filter(i -> packetData[i] == 135 && packetData[i + 1] == 205)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
// 如果未找到,返回 -1
|
||||
if (index == -1) {
|
||||
break;
|
||||
}else {
|
||||
offset = index;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
log.info("消息头无效,不处理。");
|
||||
int index = IntStream.range(offset, packetData.length)
|
||||
.filter(i -> packetData[i] == 135 && packetData[i + 1] == 205)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
if (index == -1) {
|
||||
break;
|
||||
}else {
|
||||
offset = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("Agv链接异常");
|
||||
log.info("Agv链接异常");
|
||||
log.error("agv连接出现异常:{}", e);
|
||||
if (ObjectUtil.isNotEmpty(s)) {
|
||||
s.close();
|
||||
}
|
||||
System.out.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
} finally {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
super.after();
|
||||
try {
|
||||
s.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void write(byte[] b) {
|
||||
try {
|
||||
log.info("下发agv数据:" + Bytes2HexString(b));
|
||||
System.out.println("下发agv数据:" + Bytes2HexString(b));
|
||||
dos.write(b);
|
||||
dos.flush();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
try {
|
||||
Thread.sleep(5000L);
|
||||
log.error("tofix下发agv数据失败,再次下发,再次下发agv数据:" + Bytes2HexString(b) + "失败原因:" + e.getMessage());
|
||||
System.out.println("再次下发agv数据:" + Bytes2HexString(b));
|
||||
dos.write(b);
|
||||
dos.flush();
|
||||
} catch (Exception e1) {
|
||||
log.error("tofix下发agv数据失败,再次下发,下发agv数据:" + Bytes2HexString(b) + "失败原因:" + e1.getMessage());
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
||||
int agvaddr = 0;
|
||||
int statusAgvaddr =0;
|
||||
int agvaddr_copy = 0;
|
||||
int weight = 0;
|
||||
String device_code = "";
|
||||
String status_device_code = "";
|
||||
int phase = 0;
|
||||
int statusPhase =0;
|
||||
boolean flag = false;
|
||||
int x = 0; //x坐标
|
||||
int y = 0; //y坐标
|
||||
@@ -655,32 +658,34 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
log.info("agv进入" + device_code + ",放货完成,开始写入信号5进行安全交互,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
ssxDeviceDriver.writing(5);
|
||||
if (ssxDeviceDriver.getMode() == 4) {
|
||||
log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
if (ObjectUtil.isNotEmpty(task)){
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setTask_id(task.getExt_task_id());
|
||||
request.setTask_code(task.getTask_code());
|
||||
request.setTask_status("2");
|
||||
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
String res = acsToWmsService.feedTaskStatus(request);
|
||||
JSONObject result = JSONObject.parseObject(res);
|
||||
if (StringUtil.isNotBlank(result.getString("status")) && "200".equals(result.getString("status"))) {
|
||||
log.info("任务号" + request.getTask_code() + "开始反馈wcs任务完成状态" + "成功。");
|
||||
} else if (StringUtil.isNotBlank(result.getString("status")) && !"200".equals(result.getString("status"))){
|
||||
log.info("任务号" + request.getTask_code() + "开始反馈wcs任务完成状态" + "失败,服务器响应的失败原因为:" + result.getString("message"));
|
||||
}else if (StringUtil.isNotBlank(result.getString("code")) && "500".equals(result.getString("code"))){
|
||||
log.info("任务号" + request.getTask_code() + "请求不通" + "失败,服务器响应的失败原因为:" + result.getString("message"));
|
||||
return;
|
||||
log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
if (ObjectUtil.isNotEmpty(task)){
|
||||
String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setTask_id(task.getExt_task_id());
|
||||
request.setTask_code(task.getTask_code());
|
||||
request.setTask_status("2");
|
||||
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
request.setStartLocation(task.getStart_point_code());
|
||||
request.setEndLocation(task.getNext_point_code());
|
||||
String res = acsToWmsService.feedTaskStatus(request);
|
||||
JSONObject result = JSONObject.parseObject(res);
|
||||
if (StringUtil.isNotBlank(result.getString("status")) && "200".equals(result.getString("status"))) {
|
||||
log.info("任务号" + request.getTask_code() + "放货完成---反馈wcs任务完成状态" + "成功。");
|
||||
} else if (StringUtil.isNotBlank(result.getString("status")) && !"200".equals(result.getString("status"))){
|
||||
log.info("任务号" + request.getTask_code() + "放货完成---反馈wcs任务完成状态" + "失败,服务器响应的失败原因为:" + result.getString("message"));
|
||||
}else if (StringUtil.isNotBlank(result.getString("code")) && "500".equals(result.getString("code"))){
|
||||
log.info("任务号" + request.getTask_code() + "放货完成---请求不通" + "失败,服务器响应的失败原因为:" + result.getString("message"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ssxDeviceDriver.writing(0);
|
||||
flag = true;
|
||||
data = actionComplete(index, inst, device_code, ssxDeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
|
||||
log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",agv开始离开。");
|
||||
ssxDeviceDriver.writing(0);
|
||||
flag = true;
|
||||
data = actionComplete(index, inst, device_code, ssxDeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
|
||||
log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",agv开始离开。");
|
||||
} else {
|
||||
log.info("设备" + device_code + "的Mode信号未变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",尝试重新写入信号5进行安全交互");
|
||||
ssxDeviceDriver.writing(5);
|
||||
@@ -749,6 +754,659 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
}
|
||||
|
||||
@LokiLog(type = LokiLogType.ACS_TO_LMS)
|
||||
public void processSocket2(int[] arr) throws Exception {
|
||||
status_device_code = this.getDeviceCode();
|
||||
byte[] data = null;
|
||||
statusPhase = arr[16] * 256 + arr[17];
|
||||
// agv任务号
|
||||
int index = arr[12] * 256 + arr[13];
|
||||
//任务单号和其他状态信息
|
||||
int ikey = arr[26] * 256 + arr[27];
|
||||
//站点号
|
||||
statusAgvaddr = arr[18] * 256 + arr[19];
|
||||
//车号
|
||||
int carno = arr[20];
|
||||
Instruction link_inst = null;
|
||||
List<Instruction> insts = null;
|
||||
Instruction inst = null;
|
||||
boolean link_flag = false;
|
||||
Device agv_device = null;
|
||||
if (carno != 0) {
|
||||
agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno));
|
||||
}
|
||||
if (ikey != 0) {
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(ikey));
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
inst = instructionService.findByCode(String.valueOf(ikey));
|
||||
}
|
||||
}
|
||||
// if (!ObjectUtil.isEmpty(link_inst)) {
|
||||
// link_flag = true;
|
||||
// }
|
||||
if (error != 0) {
|
||||
//todo 反馈立库AGV故障信息
|
||||
sendAgvErrorStatus(inst, status_device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
}
|
||||
// Device device = null;
|
||||
// String old_device_code = null;
|
||||
// String emptyNum = null;
|
||||
// String device_code = null;
|
||||
|
||||
if (statusPhase == 0x67) {
|
||||
//todo 故障信息
|
||||
if (arr[18] * 256 + arr[19] == 0) {
|
||||
|
||||
}
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
request.setDevice_code(this.status_device_code);
|
||||
request.setState("故障");
|
||||
acsToWmsService.notify(request);
|
||||
data = ndcAgvService.sendAgvOneModeInst(statusPhase, index, 0, 0, 0, 0, 0);
|
||||
}
|
||||
// TaskDto task = new TaskDto();
|
||||
//
|
||||
// if (ObjectUtil.isNotEmpty(inst)) {
|
||||
// task = taskService.findById(inst.getTask_id());
|
||||
// }
|
||||
|
||||
// Hj1DeviceDriver hj1DeviceDriver;
|
||||
// Hj2DeviceDriver hj2DeviceDriver;
|
||||
// SsxDeviceDriver ssxDeviceDriver;
|
||||
// //分配 车id
|
||||
// //(不需要WCS反馈)
|
||||
// if (phase == 0x02) {
|
||||
// inst.setCarno(String.valueOf(carno));
|
||||
// instructionService.update(inst);
|
||||
// transportOrder = inst.getTask_code();
|
||||
// //车辆分配任务时 状态为1 执行中
|
||||
// task.setTask_status("1");
|
||||
// taskserver.update(task);
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data);
|
||||
// //车辆状态归零
|
||||
// agv_status = 0;
|
||||
// //到达取货点
|
||||
// //(需要WCS反馈)
|
||||
// } else if (phase == 0x03) {
|
||||
// if (agvaddr == 0) {
|
||||
// agvaddr = agvaddr_copy;
|
||||
// }
|
||||
// if (agvaddr < 1) {
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
// return;
|
||||
// }
|
||||
// device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
// if (agvaddr != 0) {
|
||||
// old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
// if (StrUtil.contains(old_device_code, "-")) {
|
||||
// String[] point = old_device_code.split("-");
|
||||
// device_code = point[0];
|
||||
// } else if (StrUtil.contains(old_device_code, ".")) {
|
||||
// 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;
|
||||
// }
|
||||
// // "========================================================================请求取货================================================================================="
|
||||
// agv_status = 1;
|
||||
// //到达桁架1请求取货
|
||||
// if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
|
||||
// hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
|
||||
// log.info("agv到达" + device_code + ",取货点,开始写入信号2进行进入申请,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// hj1DeviceDriver.writing(2);
|
||||
// //反馈WMS请求取货
|
||||
// //sendAgvTaskStatus(inst, device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
// if (hj1DeviceDriver.getMode() != 0) {
|
||||
// if (hj1DeviceDriver.getAction() == 2) {
|
||||
// log.info("设备" + device_code + "的Action信号已变更为2允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始进入取货。");
|
||||
// flag = true;
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Action信号未变更为2,不允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",尝试重新写入信号2进行进入申请");
|
||||
// hj1DeviceDriver.writing(2);
|
||||
// log.info("设备" + device_code + "已完成信号2写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// }
|
||||
// hj1DeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "agv申请进入" + device_code + ",但设备Mode值为0,设备异常,请检查!";
|
||||
// agv_message = hj1DeviceDriver.getDevice_code() + message;
|
||||
// hj1DeviceDriver.setMessage(message);
|
||||
// log.info(message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达桁架2请求取货
|
||||
// if (device.getDeviceDriver() instanceof Hj2DeviceDriver) {
|
||||
// hj2DeviceDriver = (Hj2DeviceDriver) device.getDeviceDriver();
|
||||
// log.info("agv到达" + device_code + ",取货点,开始写入信号7进行进入申请,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// hj2DeviceDriver.writing(7);
|
||||
// //反馈WMS请求取货
|
||||
// //sendAgvTaskStatus(inst, device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
// if (hj2DeviceDriver.getMode() != 0) {
|
||||
// if (hj2DeviceDriver.getAction() == 2) {
|
||||
// log.info("设备" + device_code + "的Action信号已变更为2允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始进入取货。");
|
||||
// flag = true;
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Action信号未变更为2,不允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",尝试重新写入信号7进行进入申请");
|
||||
// hj2DeviceDriver.writing(7);
|
||||
// log.info("设备" + device_code + "已完成信号7写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// }
|
||||
// hj2DeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "agv申请进入" + device_code + ",但设备Mode值为0,设备异常,请检查!";
|
||||
// agv_message = hj2DeviceDriver.getDevice_code() + message;
|
||||
// hj2DeviceDriver.setMessage(message);
|
||||
// log.info(message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达输送线请求取货
|
||||
// if (device.getDeviceDriver() instanceof SsxDeviceDriver) {
|
||||
// ssxDeviceDriver = (SsxDeviceDriver) device.getDeviceDriver();
|
||||
// //有货,待机,运行取货
|
||||
// log.info("agv到达取货点" + device_code + ",需满足取货条件:Mode:1,Move:1,Action:1,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
// if (ssxDeviceDriver.getMove() == 1 & ssxDeviceDriver.getMode() == 1 & ssxDeviceDriver.getAction() == 1) {
|
||||
// log.info("agv到达取货点" + device_code + ",满足取货条件,开始取货,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
// inst.setExecute_status("1");
|
||||
// instructionService.update(inst);
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// ssxDeviceDriver.setMessage("");
|
||||
// flag = true;
|
||||
// } else {
|
||||
// String message = "";
|
||||
// if (ssxDeviceDriver.getAction() != 1) {
|
||||
// message += "设备Action不为1,不允许取放货,设备异常,请检查!";
|
||||
// } else if (ssxDeviceDriver.getMode() != 1) {
|
||||
// message += "设备工作模式不为待机,无法取放货,请检查!";
|
||||
// } else if (ssxDeviceDriver.getMove() == 0) {
|
||||
// message += "设备光电信号为0,站点无货,请检查!";
|
||||
// }
|
||||
// ssxDeviceDriver.setMessage(message);
|
||||
// agv_message = ssxDeviceDriver.getDevice_code() + message;
|
||||
// logServer.deviceExecuteLog(device_code, "", "", message);
|
||||
// log.info(device_code + message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达普通站点
|
||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// log.info("到达{}取货点开始取货", device_code);
|
||||
// inst.setExecute_status("1");
|
||||
// instructionService.update(inst);
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// flag = true;
|
||||
// }
|
||||
// if (flag) {
|
||||
// // log.info("==================允许AGV取货==================");
|
||||
// // logServer.deviceExecuteLog(device_code, "", "", "允许AGV取货。");
|
||||
// //log.info("{},{}", device_code, "允许AGV取货。");
|
||||
// // lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, "允许AGV取货。"));
|
||||
// }
|
||||
// //到达取货等待点
|
||||
// //(需要WCS反馈)
|
||||
// } else if (phase == 0x04) {
|
||||
// data = getData(data, index, inst, task);
|
||||
// //取货完毕
|
||||
// //(需要WCS反馈)
|
||||
// } else if (phase == 0x05) {
|
||||
// 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);
|
||||
// if (StrUtil.contains(old_device_code, "-")) {
|
||||
// String[] point = old_device_code.split("-");
|
||||
// device_code = point[0];
|
||||
// } else if (StrUtil.contains(old_device_code, ".")) {
|
||||
// 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;
|
||||
// }
|
||||
//// "========================================================================取货完成================================================================================="
|
||||
// //反馈车辆动作
|
||||
// agv_status = 2;
|
||||
// //到达桁架1取货完成
|
||||
// if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
|
||||
// hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
|
||||
// if (hj1DeviceDriver.getMode() != 0) {
|
||||
// log.info("agv进入" + device_code + ",取货完成,开始写入信号3进行安全交互,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// hj1DeviceDriver.writing(3);
|
||||
// if (hj1DeviceDriver.getMode() == 3) {
|
||||
// flag = true;
|
||||
// log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
// hj1DeviceDriver.writing(0);
|
||||
// data = actionComplete(index, inst, device_code, hj1DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成");
|
||||
// log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始离开。");
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Mode信号未变更为3,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",尝试重新写入信号3进行安全交互");
|
||||
// hj1DeviceDriver.writing(3);
|
||||
// log.info("设备" + device_code + "已完成信号3写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// }
|
||||
// hj1DeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "agv已取货完成,但设备Mode值为0,设备异常,请检查!";
|
||||
// agv_message = hj1DeviceDriver.getDevice_code() + message;
|
||||
// hj1DeviceDriver.setMessage(message);
|
||||
// log.info(message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达桁架2取货完成
|
||||
// if (device.getDeviceDriver() instanceof Hj2DeviceDriver) {
|
||||
// hj2DeviceDriver = (Hj2DeviceDriver) device.getDeviceDriver();
|
||||
// if (hj2DeviceDriver.getMode() != 0) {
|
||||
// log.info("agv进入" + device_code + ",取货完成,开始写入信号3进行安全交互,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// hj2DeviceDriver.writing(3);
|
||||
// if (hj2DeviceDriver.getMode() == 3) {
|
||||
// flag = true;
|
||||
// log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
// hj2DeviceDriver.writing(0);
|
||||
// data = actionComplete(index, inst, device_code, hj2DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成");
|
||||
// log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始离开。");
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Mode信号未变更为3,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",尝试重新写入信号3进行安全交互");
|
||||
// hj2DeviceDriver.writing(3);
|
||||
// log.info("设备" + device_code + "已完成信号3写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// }
|
||||
// hj2DeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "agv已取货完成,但设备Mode值为0,设备异常,请检查!";
|
||||
// agv_message = hj2DeviceDriver.getDevice_code() + message;
|
||||
// hj2DeviceDriver.setMessage(message);
|
||||
// log.info(message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达输送线取货完成
|
||||
// if (device.getDeviceDriver() instanceof SsxDeviceDriver) {
|
||||
// ssxDeviceDriver = (SsxDeviceDriver) device.getDeviceDriver();
|
||||
// if (ssxDeviceDriver.getMode() != 0) {
|
||||
// log.info("agv进入" + device_code + ",取货完成,开始写入信号3进行安全交互,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
// ssxDeviceDriver.writing(3);
|
||||
// if (ssxDeviceDriver.getMode() == 3) {
|
||||
// flag = true;
|
||||
// log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
// ssxDeviceDriver.writing(0);
|
||||
// data = actionComplete(index, inst, device_code, ssxDeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成");
|
||||
// log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",agv开始离开。");
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Mode信号未变更为3,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",尝试重新写入信号3进行安全交互");
|
||||
// ssxDeviceDriver.writing(3);
|
||||
// log.info("设备" + device_code + "已完成信号3写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
// }
|
||||
// ssxDeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "agv取货完成写入信号3安全交互失败,设备允许模式mode值为0,设备异常,请检查!";
|
||||
// agv_message = ssxDeviceDriver.getDevice_code() + message;
|
||||
// ssxDeviceDriver.setMessage(message);
|
||||
// log.info(message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达普通站点取货完成
|
||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// data = actionComplete(index, inst, device_code, 0, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成");
|
||||
// log.info("agv进入" + device_code + "取货完成");
|
||||
// flag = true;
|
||||
// }
|
||||
// //到达放货等待点
|
||||
// //(需要WCS反馈)
|
||||
// } else if (phase == 0x06) {
|
||||
// data = getData(data, index, inst, task);
|
||||
// //到达放货点
|
||||
// //(需要WCS反馈)
|
||||
// } else if (phase == 0x07) {
|
||||
// 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);
|
||||
// if (StrUtil.contains(old_device_code, "-")) {
|
||||
// String[] point = old_device_code.split("-");
|
||||
// device_code = point[0];
|
||||
// } else if (StrUtil.contains(old_device_code, ".")) {
|
||||
// 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) && !device_code.equals("0")) {
|
||||
// log.info(agvaddr + "对应设备号为空!");
|
||||
// return;
|
||||
// }
|
||||
// //校验agv上报站点编号与指令起始点相同
|
||||
// if (ObjectUtil.isEmpty(inst)) {
|
||||
// log.info("未找到关联编号{}对应的指令", ikey);
|
||||
// return;
|
||||
// }
|
||||
//// "========================================================================请求放货================================================================================="
|
||||
// agv_status = 3;
|
||||
// if (inst != null && !"3".equals(inst.getExecute_status())) {
|
||||
// inst.setExecute_status("3");
|
||||
// instructionService.update(inst);
|
||||
// }
|
||||
// //到达桁架1请求放货
|
||||
// if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
|
||||
// hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
|
||||
// hj1DeviceDriver.writing(2);
|
||||
// log.info("agv到达" + device_code + ",放货点,开始写入信号2进行进入申请,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// //反馈WMS请求放货
|
||||
// //sendAgvTaskStatus(inst, device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
// if (hj1DeviceDriver.getMode() != 0 && hj1DeviceDriver.getMove() == 0) {
|
||||
// if (hj1DeviceDriver.getAction() == 3) {
|
||||
// log.info("设备" + device_code + "的Action信号已变更为3允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始进入放货。");
|
||||
// flag = true;
|
||||
// data = getData(data, index, inst, task);
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Action信号未变更为3,不允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",尝试重新写入信号2进行进入申请");
|
||||
// hj1DeviceDriver.writing(2);
|
||||
// log.info("设备" + device_code + "已完成信号2写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// //反馈WMS请求放货
|
||||
// //sendAgvTaskStatus(inst, device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
// }
|
||||
// hj1DeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "";
|
||||
// if (hj1DeviceDriver.getMode() == 0) {
|
||||
// message += "设备Mode值为0,设备异常,请检查!";
|
||||
// } else {
|
||||
// message += "设备光电信号不为0,站点有货,请检查!";
|
||||
// }
|
||||
// message += "不允许AGV放货。";
|
||||
// agv_message = hj1DeviceDriver.getDevice_code() + message;
|
||||
// hj1DeviceDriver.setMessage(message);
|
||||
// logServer.deviceExecuteLog(device_code, "", "", message);
|
||||
// log.info(device_code + message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //到达桁架2请求放货
|
||||
// if (device.getDeviceDriver() instanceof Hj2DeviceDriver) {
|
||||
// hj2DeviceDriver = (Hj2DeviceDriver) device.getDeviceDriver();
|
||||
// hj2DeviceDriver.writing(7);
|
||||
// log.info("agv到达" + device_code + ",放货点,开始写入信号7进行进入申请,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// //反馈WMS请求放货
|
||||
// //sendAgvTaskStatus(inst, device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
// if (hj2DeviceDriver.getMode() != 0 && hj2DeviceDriver.getMove() == 0) {
|
||||
// if (hj2DeviceDriver.getAction() == 3) {
|
||||
// log.info("设备" + device_code + "的Action信号已变更为3允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始进入放货。");
|
||||
// flag = true;
|
||||
// data = getData(data, index, inst, task);
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Action信号未变更为3,不允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",尝试重新写入信号7进行进入申请");
|
||||
// hj2DeviceDriver.writing(7);
|
||||
// log.info("设备" + device_code + "已完成信号7写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// //反馈WMS请求放货
|
||||
// //sendAgvTaskStatus(inst, device_code, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("请求取货")));
|
||||
// }
|
||||
// hj2DeviceDriver.setMessage("");
|
||||
// } else {
|
||||
// String message = "";
|
||||
// if (hj2DeviceDriver.getMode() == 0) {
|
||||
// message += "设备Mode值为0,设备异常,请检查!";
|
||||
// } else {
|
||||
// message += "设备光电信号不为0,站点有货,请检查!";
|
||||
// }
|
||||
// message += "不允许AGV放货。";
|
||||
// agv_message = hj2DeviceDriver.getDevice_code() + message;
|
||||
// hj2DeviceDriver.setMessage(message);
|
||||
// logServer.deviceExecuteLog(device_code, "", "", message);
|
||||
// log.info(device_code + message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //输送线到达放货点
|
||||
// if (device.getDeviceDriver() instanceof SsxDeviceDriver) {
|
||||
// ssxDeviceDriver = (SsxDeviceDriver) device.getDeviceDriver();
|
||||
// log.info("agv到达" + device_code + "放货点,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",准备执行放货");
|
||||
// if (ssxDeviceDriver.getMove() == 0 & ssxDeviceDriver.getMode() == 1 & ssxDeviceDriver.getAction() == 1) {
|
||||
//// if (inst != null) {
|
||||
//// inst.setExecute_status("3");
|
||||
//// instructionService.update(inst);
|
||||
//// }
|
||||
// data = getData(data, index, inst, task);
|
||||
// ssxDeviceDriver.setMessage("");
|
||||
// flag = true;
|
||||
// } else {
|
||||
// String message = "";
|
||||
// message += "放货失败,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",不满足放货条件Mode:1,Move:0,Action:1";
|
||||
// ssxDeviceDriver.setMessage(message);
|
||||
// agv_message = ssxDeviceDriver.getDevice_code() + message;
|
||||
// logServer.deviceExecuteLog(device_code, "", "", message);
|
||||
// log.info(message);
|
||||
// lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message));
|
||||
// }
|
||||
// }
|
||||
// //普通站点
|
||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// log.info("到达{}放货点", device_code);
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
// flag = true;
|
||||
// }
|
||||
// if (flag) {
|
||||
// // log.info("==================允许AGV放货==================");
|
||||
// // logServer.deviceExecuteLog(device_code, "", "", "允许AGV放货。");
|
||||
// // log.info("{},{}", device_code, "允许AGV放货。");
|
||||
// // lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, "允许AGV放货。"));
|
||||
// }
|
||||
// //放货完毕
|
||||
// //(需要WCS反馈)
|
||||
// } else if (phase == 0x09) {
|
||||
// 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);
|
||||
// if (StrUtil.contains(old_device_code, "-")) {
|
||||
// String[] point = old_device_code.split("-");
|
||||
// device_code = point[0];
|
||||
// } else if (StrUtil.contains(old_device_code, ".")) {
|
||||
// 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;
|
||||
// }
|
||||
// transportOrder = "";
|
||||
//// "========================================================================放货完成================================================================================="
|
||||
// agv_status = 4;
|
||||
// //到达桁架1放货完成
|
||||
// if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
|
||||
// hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
|
||||
// log.info("agv进入" + device_code + ",放货完成,开始写入信号5进行安全交互,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// hj1DeviceDriver.writing(5);
|
||||
// if (hj1DeviceDriver.getMode() == 4) {
|
||||
// log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
// hj1DeviceDriver.writing(0);
|
||||
// flag = true;
|
||||
// data = actionComplete(index, inst, device_code, hj1DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
|
||||
// log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始离开。");
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Mode信号未变更为4,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",尝试重新写入信号5进行安全交互");
|
||||
// hj1DeviceDriver.writing(5);
|
||||
// log.info("设备" + device_code + "已完成信号5写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction());
|
||||
// }
|
||||
// hj1DeviceDriver.setMessage("");
|
||||
// }
|
||||
// //到达桁架2放货完成
|
||||
// if (device.getDeviceDriver() instanceof Hj2DeviceDriver) {
|
||||
// hj2DeviceDriver = (Hj2DeviceDriver) device.getDeviceDriver();
|
||||
// log.info("agv进入" + device_code + ",放货完成,开始写入信号5进行安全交互,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// hj2DeviceDriver.writing(5);
|
||||
// if (hj2DeviceDriver.getMode() == 4) {
|
||||
// log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
// hj2DeviceDriver.writing(0);
|
||||
// flag = true;
|
||||
// data = actionComplete(index, inst, device_code, hj2DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
|
||||
// log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始离开。");
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Mode信号未变更为4,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",尝试重新写入信号5进行安全交互");
|
||||
// hj2DeviceDriver.writing(5);
|
||||
// log.info("设备" + device_code + "已完成信号5写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction());
|
||||
// }
|
||||
// hj2DeviceDriver.setMessage("");
|
||||
// }
|
||||
// //到达输送线放货完成
|
||||
// if (device.getDeviceDriver() instanceof SsxDeviceDriver) {
|
||||
// ssxDeviceDriver = (SsxDeviceDriver) device.getDeviceDriver();
|
||||
// log.info("agv进入" + device_code + ",放货完成,开始写入信号5进行安全交互,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
// ssxDeviceDriver.writing(5);
|
||||
// if (ssxDeviceDriver.getMode() == 4) {
|
||||
// log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。");
|
||||
//// if (ObjectUtil.isNotEmpty(task)){
|
||||
//// String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue();
|
||||
//// if (!StrUtil.startWith(task.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
//// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
//// request.setTask_id(task.getExt_task_id());
|
||||
//// request.setTask_code(task.getTask_code());
|
||||
//// request.setTask_status("2");
|
||||
//// request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
//// request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
//// request.setStartLocation(task.getStart_point_code());
|
||||
//// request.setEndLocation(task.getNext_point_code());
|
||||
//// String res = acsToWmsService.feedTaskStatus(request);
|
||||
//// JSONObject result = JSONObject.parseObject(res);
|
||||
//// if (StringUtil.isNotBlank(result.getString("status")) && "200".equals(result.getString("status"))) {
|
||||
//// log.info("任务号" + request.getTask_code() + "放货完成---反馈wcs任务完成状态" + "成功。");
|
||||
//// } else if (StringUtil.isNotBlank(result.getString("status")) && !"200".equals(result.getString("status"))){
|
||||
//// log.info("任务号" + request.getTask_code() + "放货完成---反馈wcs任务完成状态" + "失败,服务器响应的失败原因为:" + result.getString("message"));
|
||||
//// }else if (StringUtil.isNotBlank(result.getString("code")) && "500".equals(result.getString("code"))){
|
||||
//// log.info("任务号" + request.getTask_code() + "放货完成---请求不通" + "失败,服务器响应的失败原因为:" + result.getString("message"));
|
||||
//// return;
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
// ssxDeviceDriver.writing(0);
|
||||
// flag = true;
|
||||
// data = actionComplete(index, inst, device_code, ssxDeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
|
||||
// log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",agv开始离开。");
|
||||
// } else {
|
||||
// log.info("设备" + device_code + "的Mode信号未变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",尝试重新写入信号5进行安全交互");
|
||||
// ssxDeviceDriver.writing(5);
|
||||
// log.info("设备" + device_code + "已完成信号5写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
|
||||
// }
|
||||
// ssxDeviceDriver.setMessage("");
|
||||
// }
|
||||
// //agv普通站点放货完成
|
||||
// if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
// log.info("{}放货完成", device_code);
|
||||
// data = actionComplete(index, inst, device_code, 0, Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
|
||||
// flag = true;
|
||||
// }
|
||||
// if (flag) {
|
||||
// //log.info("================允许AGV放货后离开=================");
|
||||
// //logServer.deviceExecuteLog(device_code, "", "", "允许AGV放货后离开。");
|
||||
// // log.info("{},{}", device_code, "允许AGV放货后离开。");
|
||||
// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, "允许AGV放货后离开。"));
|
||||
// }
|
||||
// }
|
||||
// //到达位置点
|
||||
// //(需要WCS反馈)
|
||||
// else if (phase == 0x64) {//param,agv货位id待定
|
||||
// //1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备
|
||||
// agvaddr = arr[18] * 256 + arr[19];
|
||||
// agvaddr_copy = agvaddr;
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
// } else if (phase == 0x50) {//进入交通灯区域
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
// } else if (phase == 0x51) {//离开交通灯区域
|
||||
// data = ndcAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
|
||||
// logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);
|
||||
// } else
|
||||
if (statusPhase == 0x70) {
|
||||
//x坐标
|
||||
x = ikey;
|
||||
} else if (statusPhase == 0x71) {
|
||||
//y坐标
|
||||
y = ikey;
|
||||
} else if (statusPhase == 0x72) {
|
||||
//车辆角度
|
||||
angle = ikey;
|
||||
} else if (statusPhase == 0x73) {
|
||||
//agv电量
|
||||
electric_qty = ikey;
|
||||
// 电量不足充电
|
||||
// int electric = Integer.parseInt(paramService.findByCode(AcsConfig.ELECTRIC).getValue());
|
||||
// if (electric_qty > 0 && electric_qty < electric) {
|
||||
// log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.device_code, electric_qty, electric);
|
||||
// ndcAgvService.charge(String.valueOf(this.agvaddr));
|
||||
// isCharge = true;
|
||||
// }
|
||||
} else if (statusPhase == 0x74) {
|
||||
status = ikey;
|
||||
} else if (statusPhase == 0x75) {
|
||||
is_have = ikey;
|
||||
} else if (statusPhase == 0x76) {
|
||||
direction = ikey;
|
||||
} else if (statusPhase == 0x77) {
|
||||
distance = ikey;
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
logServer.deviceExecuteLog(this.status_device_code, "", "", "agvphase:" + statusPhase + "反馈:" + data);
|
||||
OneNDCSocketConnectionAutoRun.write(data);
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] actionComplete(int index, Instruction inst, String device_code, int to_command, int status, String action) {
|
||||
byte[] data;
|
||||
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
|
||||
|
||||
@@ -21,6 +21,16 @@ public class FeedBackTaskStatusRequest extends BaseRequest {
|
||||
*/
|
||||
private String task_status;
|
||||
|
||||
/**
|
||||
* 起点
|
||||
*/
|
||||
private String startLocation;
|
||||
|
||||
/**
|
||||
* 终点
|
||||
*/
|
||||
private String endLocation;
|
||||
|
||||
/**
|
||||
* 任务类型
|
||||
*/
|
||||
|
||||
@@ -871,6 +871,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) {
|
||||
TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code());
|
||||
FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest();
|
||||
Instruction instruction = instructionService.findByTaskcode(entity.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)){
|
||||
request.setCar_no(instruction.getCarno());
|
||||
}
|
||||
request.setTask_code(entity.getTask_code());
|
||||
request.setTask_id(entity.getExt_task_id());
|
||||
request.setTask_status(dto.getTask_status());
|
||||
@@ -959,6 +963,8 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
request.setTask_status(entity.getTask_status());
|
||||
request.setRequest_medthod_code(RequestMethodEnum.feedback_task_status.getCode());
|
||||
request.setRequest_medthod_name(RequestMethodEnum.feedback_task_status.getName());
|
||||
request.setStartLocation(entity.getStart_point_code());
|
||||
request.setEndLocation(entity.getNext_point_code());
|
||||
boolean flag = false;
|
||||
String resp = null;
|
||||
//反馈任务状态
|
||||
|
||||
Reference in New Issue
Block a user