# Conflicts:
#	acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java
This commit is contained in:
psh
2023-09-20 11:35:27 +08:00
2 changed files with 52 additions and 56 deletions

View File

@@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.List;
@Slf4j
@Data
public class ItemProtocol {
@@ -30,48 +31,48 @@ public class ItemProtocol {
this.driver = driver;
}
public String getWeight() {
return String.valueOf(this.getOpcFloatValue(item_weight));
public Float getWeight() {
return this.getOpcFloatValue(item_weight);
}
public String getProductCode() {
return String.valueOf(this.getOpcStringValue(item_product_code));
return this.getOpcStringValue(item_product_code);
}
public String getBatchCode() {
return String.valueOf(this.getOpcStringValue(item_batch_code));
return this.getOpcStringValue(item_batch_code);
}
public String getProductSpecifications() {
return String.valueOf(this.getOpcStringValue(item_product_specifications));
return this.getOpcStringValue(item_product_specifications);
}
public String getYear() {
return String.valueOf(this.getOpcIntegerValue(item_year));
public Integer getYear() {
return this.getOpcIntegerValue(item_year);
}
public String getMonth() {
return String.valueOf(this.getOpcIntegerValue(item_month));
public Integer getMonth() {
return this.getOpcIntegerValue(item_month);
}
public String getDay() {
return String.valueOf(this.getOpcIntegerValue(item_day));
public Integer getDay() {
return this.getOpcIntegerValue(item_day);
}
public String getHour() {
return String.valueOf(this.getOpcIntegerValue(item_hour));
public Integer getHour() {
return this.getOpcIntegerValue(item_hour);
}
public String getMinute() {
return String.valueOf(this.getOpcIntegerValue(item_minute));
public Integer getMinute() {
return this.getOpcIntegerValue(item_minute);
}
public String getSecond() {
return String.valueOf(this.getOpcIntegerValue(item_second));
public Integer getSecond() {
return this.getOpcIntegerValue(item_second);
}
public String getFlag() {
return String.valueOf(this.getOpcIntegerValue(item_flag));
public Integer getFlag() {
return this.getOpcIntegerValue(item_flag);
}
@@ -81,27 +82,33 @@ public class ItemProtocol {
return move;
}
public Boolean getIsonline() {
return isonline;
}
public void setIsonline(Boolean isonline) {
this.isonline = isonline;
}
Boolean isonline;
public int getOpcIntegerValue(String protocol) {
Integer value = this.driver.getIntegeregerValue(protocol);
Integer value = this.driver.getIntegerValue(protocol);
if (value == null) {
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
setIsonline(false);
} else {
setIsonline(true);
return value;
}
return 0;
}
public Float getOpcFloatValue(String protocol) {
Float value = this.driver.getFloatValue(protocol);
if (value == null) {
//throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)});
} else {
return value;
}
return 0f;
}
public String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol);
if (value == null) {
@@ -113,17 +120,6 @@ public class ItemProtocol {
return "0";
}
public float getOpcFloatValue(String protocol) {
float value = this.driver.getFloatValue(protocol);
if (value == 0) {
} else {
return value;
}
return 0;
}
public static List<ItemDto> getReadableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_product_code, "产品名称", "VB3251 "));

View File

@@ -144,8 +144,8 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive
Boolean islock = false;
// 重量
private String weight;
private String last_weight;
private Float weight;
private Float last_weight;
// 产品名称
private String product_code;
@@ -160,24 +160,24 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive
private String last_product_specifications;
// 时间
private String year;
private String last_year;
private String month;
private String last_month;
private String day;
private String last_day;
private String hour;
private String last_hour;
private String minute;
private String last_minute;
private String second;
private String last_second;
private int year;
private int last_year;
private int month;
private int last_month;
private int day;
private int last_day;
private int hour;
private int last_hour;
private int minute;
private int last_minute;
private int second;
private int last_second;
private String time;
private String last_time;
//气缸分离状态0-不分离1分离
private String flag;
private String last_flag;
private int flag;
private int last_flag;
@Override
public Device getDevice() {