fix:现场测试

This commit is contained in:
2023-12-20 18:31:21 +08:00
parent ee6fd716bc
commit 5f8b795902
2 changed files with 23 additions and 11 deletions

View File

@@ -52,12 +52,12 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task);
}
public int getQty1() {
return this.getOpcIntegerValue(item_qty1);
public float getQty1() {
return this.getOpcFloatValue(item_qty1);
}
public int getQty2() {
return this.getOpcIntegerValue(item_qty2);
public float getQty2() {
return this.getOpcFloatValue(item_qty2);
}
public int getToCommand() {
@@ -66,6 +66,18 @@ 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) {
@@ -84,7 +96,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_heartbeat, "心跳", "DB103.W0"));
list.add(new ItemDto(item_mode, "工作状态", "DB103.W2"));
list.add(new ItemDto(item_move1, "光电开关信号1", "DB103.W4"));
list.add(new ItemDto(item_move1, "光电开关信号2", "DB103.W6"));
list.add(new ItemDto(item_move2, "光电开关信号2", "DB103.W6"));
list.add(new ItemDto(item_qty1, "工位1重量", "DB103.REAL8"));
list.add(new ItemDto(item_qty2, "工位2重量", "DB103.REAL12"));
list.add(new ItemDto(item_error, "报警信号", "DB103.W16"));

View File

@@ -68,10 +68,10 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
int last_move1 = 0;
int move2 = 0;
int last_move2 = 0;
int qty1 = 0;
int last_qty1 = 0;
int qty2 = 0;
int last_qty2 = 0;
float qty1 = 0f;
float last_qty1 = 0f;
float qty2 = 0f;
float last_qty2 = 0f;
int task = 0;
int last_task = 0;
@@ -122,7 +122,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
}
} catch (Exception var17) {
var17.printStackTrace();
}
@@ -172,7 +172,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr
private void feedbackQty() {
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
Instruction inst1 = checkInst();
Instruction inst1 = instructionService.findByCode(String.valueOf(task));
String task_code = inst1.getTask_code();
applyManipulatorActionRequest.setType("2");
if (qty1 > 0) {