|
@ -1,5 +1,6 @@ |
|
|
package org.nl.acs.agv.server.impl; |
|
|
package org.nl.acs.agv.server.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@ -85,6 +86,10 @@ public class NDCAgvServiceImpl implements NDCAgvService { |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); |
|
|
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); |
|
|
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); |
|
|
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_point_code()); |
|
|
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); |
|
|
int nextAddress = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); |
|
|
|
|
|
if (inst.getStart_point_code().contains("F2") || inst.getNext_point_code().contains("F2")) { |
|
|
|
|
|
inst.setCarno("2"); |
|
|
|
|
|
log.info("二楼任务:起点为:{},终点为:{},已分配车号为:2", inst.getStart_point_code(), inst.getNext_point_code()); |
|
|
|
|
|
} |
|
|
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); |
|
|
byte ikeyhigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); |
|
|
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); |
|
|
byte ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode)); |
|
|
byte typehigh = (byte) IntToHexHigh(type); |
|
|
byte typehigh = (byte) IntToHexHigh(type); |
|
@ -108,20 +113,50 @@ public class NDCAgvServiceImpl implements NDCAgvService { |
|
|
str1 += "/priority:" + hexToString(prioritylow & 0xFF); |
|
|
str1 += "/priority:" + hexToString(prioritylow & 0xFF); |
|
|
System.out.println(str); |
|
|
System.out.println(str); |
|
|
System.out.println(str1); |
|
|
System.out.println(str1); |
|
|
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, |
|
|
byte[] b = new byte[]{}; |
|
|
(byte) 0X00, (byte) 0X08, |
|
|
if (ObjectUtil.isNotEmpty(inst.getCarno())) { |
|
|
(byte) 0X00, (byte) 0X12, |
|
|
int carNo = Integer.parseInt(inst.getCarno()); |
|
|
(byte) 0X00, (byte) 0X01, |
|
|
byte agvnohigh = (byte) IntToHexHigh(carNo); |
|
|
(byte) 0X00, (byte) 0X71, |
|
|
byte agvnolow = (byte) IntToHexLow(carNo); |
|
|
(byte) 0X00, (byte) 0X0E, |
|
|
str1 += "/agvno:" + hexToString(agvnohigh & 0xFF) + hexToString(agvnolow & 0xFF); |
|
|
(byte) 0X01, prioritylow, |
|
|
b = new byte[]{ |
|
|
(byte) 0X00, (byte) 0X01, |
|
|
(byte) 0X87, (byte) 0XCD, |
|
|
(byte) ikeyhigh, (byte) ikeylow, |
|
|
(byte) 0X00, (byte) 0X08, |
|
|
(byte) ikeyhigh, (byte) ikeylow, |
|
|
(byte) 0X00, (byte) 0X12, |
|
|
(byte) typehigh, (byte) typelow, |
|
|
(byte) 0X00, (byte) 0X01, |
|
|
(byte) qhdhigh, (byte) qhdlow, |
|
|
(byte) 0X00, (byte) 0X71, |
|
|
(byte) fhdhigh, (byte) fhdlow |
|
|
(byte) 0X00, (byte) 0X0E, |
|
|
}; |
|
|
//任务优先级,80无优先级
|
|
|
|
|
|
(byte) 0X01, prioritylow, |
|
|
|
|
|
(byte) 0X00, (byte) 0X01, |
|
|
|
|
|
//任务单号
|
|
|
|
|
|
(byte) ikeyhigh, (byte) ikeylow, |
|
|
|
|
|
//重复任务单号
|
|
|
|
|
|
(byte) ikeyhigh, (byte) ikeylow, |
|
|
|
|
|
//任务类型
|
|
|
|
|
|
(byte) typehigh, (byte) typelow, |
|
|
|
|
|
//起点
|
|
|
|
|
|
(byte) qhdhigh, (byte) qhdlow, |
|
|
|
|
|
//终点
|
|
|
|
|
|
(byte) fhdhigh, (byte) fhdlow, |
|
|
|
|
|
(byte) agvnohigh, (byte) agvnolow, |
|
|
|
|
|
}; |
|
|
|
|
|
} else { |
|
|
|
|
|
b = new byte[]{ |
|
|
|
|
|
(byte) 0X87, (byte) 0XCD, |
|
|
|
|
|
(byte) 0X00, (byte) 0X08, |
|
|
|
|
|
(byte) 0X00, (byte) 0X12, |
|
|
|
|
|
(byte) 0X00, (byte) 0X01, |
|
|
|
|
|
(byte) 0X00, (byte) 0X71, |
|
|
|
|
|
(byte) 0X00, (byte) 0X0E, |
|
|
|
|
|
(byte) 0X01, prioritylow, |
|
|
|
|
|
(byte) 0X00, (byte) 0X01, |
|
|
|
|
|
(byte) ikeyhigh, (byte) ikeylow, |
|
|
|
|
|
(byte) ikeyhigh, (byte) ikeylow, |
|
|
|
|
|
(byte) typehigh, (byte) typelow, |
|
|
|
|
|
(byte) qhdhigh, (byte) qhdlow, |
|
|
|
|
|
(byte) fhdhigh, (byte) fhdlow}; |
|
|
|
|
|
} |
|
|
log.info("下发AGV作业指令--{}", str1); |
|
|
log.info("下发AGV作业指令--{}", str1); |
|
|
OneNDCSocketConnectionAutoRun.write(b); |
|
|
OneNDCSocketConnectionAutoRun.write(b); |
|
|
System.out.println("下发agv指令数据:" + Bytes2HexString(b)); |
|
|
System.out.println("下发agv指令数据:" + Bytes2HexString(b)); |
|
|