Browse Source

rev:更改二楼任务指定2号车执行,1号车不执行。

master
龚宝雄 3 months ago
parent
commit
9113de4a02
  1. 39
      acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java

39
acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java

@ -1,5 +1,6 @@
package org.nl.acs.agv.server.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -85,6 +86,10 @@ public class NDCAgvServiceImpl implements NDCAgvService {
DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class);
int startAddress = deviceService.queryAddressBydeviceCode(inst.getStart_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 ikeylow = (byte) IntToHexLow(Integer.parseInt(instcode));
byte typehigh = (byte) IntToHexHigh(type);
@ -108,20 +113,50 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
System.out.println(str);
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) 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);
OneNDCSocketConnectionAutoRun.write(b);
System.out.println("下发agv指令数据:" + Bytes2HexString(b));

Loading…
Cancel
Save