fix: ndc交互

This commit is contained in:
2026-09-30 18:20:12 +08:00
parent 1c65c4015e
commit eeaded7d0f
3 changed files with 41 additions and 4 deletions

View File

@@ -10,6 +10,8 @@ import org.nl.acs.device.device.service.DeviceAppService;
import org.nl.acs.device.device.service.DeviceService;
import org.nl.acs.device.device.service.entity.Device;
import org.nl.acs.device.deviceDriver.service.defination.opcDefination.AbstractDeviceDriver;
import org.nl.acs.device.deviceDriver.service.defination.opcDefination.one_floor.conveyor.belt_conveyor_agv.BeltConveyorAgvDeviceDriver;
import org.nl.acs.device.deviceDriver.service.defination.opcDefination.two_floor.manipulator.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
import org.nl.acs.device.deviceDriver.service.driver.DeviceDriver;
import org.nl.acs.device.deviceDriver.service.driver.plugin.DeviceStageMonitorPlugin;
import org.nl.acs.device.storageMgt.service.StorageCellService;
@@ -205,6 +207,17 @@ public class AgvNdcDeviceDriver extends AbstractDeviceDriver implements DeviceDr
instructionService.update(inst);
}
DeviceDriver deviceDriver = device.getDeviceDriver();
if (deviceDriver instanceof BeltConveyorAgvDeviceDriver) {
BeltConveyorAgvDeviceDriver conveyorAgvDeviceDriver = (BeltConveyorAgvDeviceDriver) deviceDriver;
conveyorAgvDeviceDriver.writing("to_command", 2);
if (1 == conveyorAgvDeviceDriver.getAction() && 1 == conveyorAgvDeviceDriver.getMove()) {
reply = true;
}
} else {
reply = true;
}
}
else if (phase == 0x05) {
@@ -248,6 +261,17 @@ public class AgvNdcDeviceDriver extends AbstractDeviceDriver implements DeviceDr
inst.setCarno(String.valueOf(carno));
instructionService.update(inst);
}
DeviceDriver deviceDriver = device.getDeviceDriver();
if (deviceDriver instanceof BeltConveyorAgvDeviceDriver) {
BeltConveyorAgvDeviceDriver conveyorAgvDeviceDriver = (BeltConveyorAgvDeviceDriver) deviceDriver;
conveyorAgvDeviceDriver.writing("to_command", 3);
}
if (deviceDriver instanceof ManipulatorAgvStationDeviceDriver) {
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) deviceDriver;
manipulatorAgvStationDeviceDriver.writing("to_command", 3);
}
reply = true;
}
else if (phase == 0x4D) {
if (agvaddr == 0) {
@@ -326,7 +350,16 @@ public class AgvNdcDeviceDriver extends AbstractDeviceDriver implements DeviceDr
log.info("未找到指令号{}对应的指令", ikey);
return;
}
DeviceDriver deviceDriver = device.getDeviceDriver();
if (deviceDriver instanceof ManipulatorAgvStationDeviceDriver) {
ManipulatorAgvStationDeviceDriver agvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) deviceDriver;
agvStationDeviceDriver.writing("to_command", 4);
if (1 == agvStationDeviceDriver.getAction()) {
reply = true;
}
} else {
reply = true;
}
}
else if (phase == 0x09) {
if (agvaddr == 0) {
@@ -363,6 +396,13 @@ public class AgvNdcDeviceDriver extends AbstractDeviceDriver implements DeviceDr
return;
}
DeviceDriver deviceDriver = device.getDeviceDriver();
if (deviceDriver instanceof ManipulatorAgvStationDeviceDriver) {
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) deviceDriver;
manipulatorAgvStationDeviceDriver.writing("to_command", 5);
}
reply = true;
}
else if (phase == 0x70) {

View File

@@ -9,7 +9,6 @@ import java.util.List;
public enum ItemProtocol implements DeviceDriverBaseReader.KeyProvider {
HEARTBEAT("heartbeat", "心跳", "DB600.B1"),
MODE("mode", "工作模式", "DB600.B2"),
MOVE("move", "光电信号", "DB600.B3"),
ACTION("action", "动作信号", "DB600.B4"),
TO_COMMAND("to_command", "下发命令", "DB601.W0");

View File

@@ -38,8 +38,6 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i
private int lastHeartbeat;
private int mode;
private int lastMode;
private int move;
private int lastMove;
private int action;
private int lastAction;
private int error;