rev:更改二楼任务指定2号车执行,1号车不执行。
This commit is contained in:
@@ -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,7 +113,37 @@ 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[]{};
|
||||||
|
if (ObjectUtil.isNotEmpty(inst.getCarno())) {
|
||||||
|
int carNo = Integer.parseInt(inst.getCarno());
|
||||||
|
byte agvnohigh = (byte) IntToHexHigh(carNo);
|
||||||
|
byte agvnolow = (byte) IntToHexLow(carNo);
|
||||||
|
str1 += "/agvno:" + hexToString(agvnohigh & 0xFF) + hexToString(agvnolow & 0xFF);
|
||||||
|
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,
|
||||||
|
//任务优先级,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) 0X08,
|
||||||
(byte) 0X00, (byte) 0X12,
|
(byte) 0X00, (byte) 0X12,
|
||||||
(byte) 0X00, (byte) 0X01,
|
(byte) 0X00, (byte) 0X01,
|
||||||
@@ -120,8 +155,8 @@ public class NDCAgvServiceImpl implements NDCAgvService {
|
|||||||
(byte) ikeyhigh, (byte) ikeylow,
|
(byte) ikeyhigh, (byte) ikeylow,
|
||||||
(byte) typehigh, (byte) typelow,
|
(byte) typehigh, (byte) typelow,
|
||||||
(byte) qhdhigh, (byte) qhdlow,
|
(byte) qhdhigh, (byte) qhdlow,
|
||||||
(byte) fhdhigh, (byte) fhdlow
|
(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));
|
||||||
|
|||||||
Reference in New Issue
Block a user