From 9113de4a020956d8036a411308fc2585b29f66f3 Mon Sep 17 00:00:00 2001 From: gongbaoxiong <751575283@qq.com> Date: Tue, 1 Apr 2025 21:29:16 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E6=9B=B4=E6=94=B9=E4=BA=8C=E6=A5=BC?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8C=87=E5=AE=9A2=E5=8F=B7=E8=BD=A6?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=EF=BC=8C1=E5=8F=B7=E8=BD=A6=E4=B8=8D?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 63 ++++++++++++++----- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index b6abb27..c15d108 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/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) 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 - }; + 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) 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));