From e88d1798d4ed45a8c78e3216fa4a1042c6648988 Mon Sep 17 00:00:00 2001 From: liejiu946 Date: Wed, 18 Nov 2026 13:54:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:1.NDC=E9=80=9A=E8=AE=AF=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=8C=BA=E5=88=86=E4=B8=80=E6=A5=BC?= =?UTF-8?q?=E3=80=81=E4=BA=8C=E6=A5=BCNDC=E7=AB=AF=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ndcAuto/NDCSocketConnectionAutoRun.java | 4 +++- .../java/org/nl/extInterface/ndc/NdcApi.java | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/NDCSocketConnectionAutoRun.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/NDCSocketConnectionAutoRun.java index bfb6a52..c09db50 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/NDCSocketConnectionAutoRun.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/autoThread/autoRun/impl/ndcAuto/NDCSocketConnectionAutoRun.java @@ -204,7 +204,9 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { } else { device_code = old_device_code; } - device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isNotEmpty(device_code)){ + device = deviceAppService.findDeviceByCode(device_code); + } } //开始任务 diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/extInterface/ndc/NdcApi.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/extInterface/ndc/NdcApi.java index 964db62..f2e9910 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/extInterface/ndc/NdcApi.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/extInterface/ndc/NdcApi.java @@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.nl.acs.autoThread.autoRun.impl.ndcAuto.NDCSocketConnectionAutoRun; import org.nl.acs.device.device.service.DeviceService; +import org.nl.acs.task.TaskConfig; import org.nl.acs.task.instruction.domain.Instruction; import org.nl.acs.task.task.service.TaskService; import org.nl.acs.task.task.service.dto.TaskDto; +import org.nl.system.service.param.ISysParamService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -20,6 +22,8 @@ public class NdcApi { private DeviceService deviceService; @Autowired private TaskService taskService; + @Autowired + private ISysParamService paramService; public void sendTask(Instruction inst) { log.info("正在向NDC发送任务:{}", JSONObject.toJSONString(inst)); @@ -37,6 +41,9 @@ public class NdcApi { int dropoffStation = deviceService.queryAddressBydeviceCode(inst.getNext_point_code()); String carno = inst.getCarno(); int vehicleId = carno == null || carno.trim().isEmpty() ? 0 : Integer.parseInt(carno.trim()); + // 20001一楼 20002二楼 + Integer agvPort = Integer.valueOf(paramService.findByCode(TaskConfig.AGVPORT).getValue()) == 20001 ? 1 : 7; + requireUnsignedShort("ikey", ikey); requireUnsignedShort("taskType", taskType); requireUnsignedShort("pickupStation", pickupStation); @@ -52,10 +59,12 @@ public class NdcApi { byte dropofflow = (byte) (dropoffStation & 0xFF); byte widthHigh = (byte) ((forkAdjustWidth >> 8) & 0xFF); byte widthLow = (byte) (forkAdjustWidth & 0xFF); + byte agvPortHigh = (byte) ((agvPort >> 8) & 0xFF); + byte agvPortLow = (byte) (agvPort & 0xFF); byte[] b = new byte[]{ (byte) 0x87, (byte) 0xCD, // 信息头 0x00, 0x08, // 信息头长度 - 0x00, 0x14, // 信息长度 如果是14就是不调节货叉,12调节货叉 + 0x00, 0x14, // 信息长度 如果是14就是不调节货叉,16调节货叉 0x00, 0x01, // 功能码 0x00, 0x71, // 消息类型 0x00, 0x0E, // 参数长度 0E是不调节货叉 @@ -65,13 +74,14 @@ public class NdcApi { ikeyhigh, ikeylow, typehigh, typelow, pickuphigh, pickuplow, - dropoffhigh, dropofflow + dropoffhigh, dropofflow, + agvPortHigh,agvPortLow }; if (ObjectUtil.isNotEmpty(param.getInteger("forkAdjustWidth"))) { b = new byte[]{ (byte) 0x87, (byte) 0xCD, // 信息头 0x00, 0x08, // 信息头长度 - 0x00, 0x12, // 信息长度 如果是14就是不调节货叉,12调节货叉 + 0x00, 0x16, // 信息长度 如果是14就是不调节货叉,16调节货叉 0x00, 0x01, // 功能码 0x00, 0x71, // 消息类型 0x00, 0x10, // 参数长度 @@ -82,6 +92,7 @@ public class NdcApi { typehigh, typelow, pickuphigh, pickuplow, dropoffhigh, dropofflow, + agvPortHigh,agvPortLow, widthHigh, widthLow }; }