Merge remote-tracking branch 'origin/huaChuang' into huaChuang

This commit is contained in:
2026-11-19 15:36:33 +08:00
2 changed files with 17 additions and 4 deletions

View File

@@ -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);
}
}
//开始任务

View File

@@ -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
};
}