fix: 现场联调行家

This commit is contained in:
2024-03-20 13:42:36 +08:00
parent d99c0d8437
commit ea9cb45a3a
7 changed files with 150 additions and 27 deletions

View File

@@ -17,6 +17,7 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl;
import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
@@ -350,10 +351,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
notCreateInstMessage = "universal_notCreateInstMessage1";
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() != 1) {
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
if (beltConveyorDeviceDriver.getMove() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage2";
return false;
}
@@ -430,7 +431,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
map6.put("code", "to_length");
map6.put("code", "to_lenght");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}

View File

@@ -42,6 +42,18 @@ public class ItemProtocol {
public static String item_walk_y = "walk_y";
/**
* 行走列
*/
public static String item_x = "x";
/**
* 行走层号
*/
public static String item_y = "y";
/**
* 下发命令
*/
@@ -86,6 +98,16 @@ public class ItemProtocol {
private BoxStorageManipulatorDeviceDriver driver;
public float getX() {
return this.getOpcFloatValue(item_x);
}
public float getY() {
return this.getOpcFloatValue(item_y);
}
public ItemProtocol(BoxStorageManipulatorDeviceDriver driver){
this.driver=driver;
}
@@ -161,6 +183,18 @@ public class ItemProtocol {
return 0;
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (StrUtil.isBlank(value)) {
@@ -180,6 +214,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
return list;
}

View File

@@ -85,6 +85,26 @@ public class ItemProtocol {
private ReturnGoodManipulatorDeviceDriver driver;
/**
* 行走列
*/
public static String item_x = "x";
/**
* 行走层号
*/
public static String item_y = "y";
public float getX() {
return this.getOpcFloatValue(item_x);
}
public float getY() {
return this.getOpcFloatValue(item_y);
}
public ItemProtocol(ReturnGoodManipulatorDeviceDriver driver){
this.driver=driver;
}
@@ -143,6 +163,19 @@ public class ItemProtocol {
Boolean isonline;
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
if (value == null) {
@@ -163,6 +196,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_walk_y, "行走列", "DB1.B4"));
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
return list;
}

View File

@@ -18,6 +18,7 @@ import org.nl.acs.device_driver.DeviceDriver;
import org.nl.acs.device_driver.FeedLmsRealFailed;
import org.nl.acs.device_driver.RouteableDeviceDriver;
import org.nl.acs.device_driver.box_manipulator_site.BoxManipulatorSiteDeviceDriver;
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
import org.nl.acs.device_driver.conveyor.siemens_conveyor.SiemensConveyorDeviceDriver;
import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
@@ -373,15 +374,14 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
SiemensConveyorDeviceDriver siemensConveyorDeviceDriver;
if (nextDevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) {
siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) nextDevice.getDeviceDriver();
if (siemensConveyorDeviceDriver.getMove() != 1) {
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
if (startDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startDevice.getDeviceDriver();
if (beltConveyorDeviceDriver.getMove() != 1) {
notCreateInstMessage = "universal_notCreateInstMessage2";
return false;
}
}
String taskid = taskDto.getTask_id();
String taskcode = taskDto.getTask_code();
String start_point_code = taskDto.getStart_point_code();
@@ -450,7 +450,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
list.add(map5);
}
if (ObjectUtil.isNotEmpty(interactionJsonDTO.getLength())) {
map6.put("code", "to_length");
map6.put("code", "to_lenght");
map6.put("value", interactionJsonDTO.getLength());
list.add(map6);
}

View File

@@ -36,6 +36,21 @@ public class ItemProtocol {
*/
public static String item_error = "error";
/**
* 行走列
*/
public static String item_walk_y = "walk_y";
/**
* 行走列
*/
public static String item_x = "x";
/**
* 行走层号
*/
public static String item_y = "y";
/**
* 下发托盘类型
@@ -92,6 +107,18 @@ public class ItemProtocol {
private TrappedManipulatorManipulatorDeviceDriver driver;
public float getX() {
return this.getOpcFloatValue(item_x);
}
public float getY() {
return this.getOpcFloatValue(item_y);
}
public int getWalk_y() {
return this.getOpcIntegerValue(item_walk_y);
}
public ItemProtocol(TrappedManipulatorManipulatorDeviceDriver driver){
this.driver=driver;
}
@@ -158,6 +185,19 @@ public class ItemProtocol {
return 0;
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));
@@ -166,6 +206,8 @@ public class ItemProtocol {
list.add(new ItemDto(item_action, "动作信号", "DB1.B3"));
list.add(new ItemDto(item_error, "报警信号", "DB1.B5"));
list.add(new ItemDto(item_task, "任务号", "DB1.D6"));
list.add(new ItemDto(item_x, "行走列号", "DB101.B10"));
list.add(new ItemDto(item_y, "行走层号", "DB101.B11"));
return list;
}

View File

@@ -138,12 +138,12 @@ public class ItemProtocol {
public int getWalk_y() {
return this.getOpcIntegerValue(item_walk_y);
}
public Integer getItem_x() {
return this.getOpcIntegerValue(item_x);
public float getX() {
return this.getOpcFloatValue(item_x);
}
public Integer getItem_y() {
return this.getOpcIntegerValue(item_y);
public float getY() {
return this.getOpcFloatValue(item_y);
}
@@ -180,6 +180,19 @@ public class ItemProtocol {
return 0;
}
public float getOpcFloatValue(String protocol) {
Float value = this.driver.getDoubleValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList<ItemDto> list = new ArrayList<>();
list.add(new ItemDto(item_heartbeat, "心跳", "DB1.B0"));

View File

@@ -101,16 +101,12 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
int last_to_onset2 = 0;
int to_type = 0;
int last_to_type = 0;
/**
* 行走列
*/
Integer x = null;
Integer last_x = null;
/**
* 行走层号
*/
Integer y = 0;
Integer last_y = 0;
// x坐标
float x = 0.0f;
float last_x = 0.0f;
// y坐标
float y = 0.0f;
float last_y = 0.0f;
int to_task = 0;
int last_to_task = 0;
@@ -169,8 +165,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
heartbeat = this.itemProtocol.getHeartbeat();
x = this.itemProtocol.getItem_x();
y = this.itemProtocol.getItem_y();
x = this.itemProtocol.getX();
y = this.itemProtocol.getY();
to_command = this.itemProtocol.getTo_command();
to_target1 = this.itemProtocol.getTo_target1();
to_onset1 = this.itemProtocol.getTo_onset1();