驱动更新&问题修复
This commit is contained in:
@@ -8,7 +8,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
public class ItemProtocol {
|
||||
|
||||
|
||||
@@ -32,47 +31,47 @@ public class ItemProtocol {
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return this.getOpcStringValue(item_weight);
|
||||
return String.valueOf(this.getOpcFloatValue(item_weight));
|
||||
}
|
||||
|
||||
public String getProductCode() {
|
||||
return this.getOpcStringValue(item_product_code);
|
||||
return String.valueOf(this.getOpcStringValue(item_product_code));
|
||||
}
|
||||
|
||||
public String getBatchCode() {
|
||||
return this.getOpcStringValue(item_batch_code);
|
||||
return String.valueOf(this.getOpcStringValue(item_batch_code));
|
||||
}
|
||||
|
||||
public String getProductSpecifications() {
|
||||
return this.getOpcStringValue(item_product_specifications);
|
||||
return String.valueOf(this.getOpcStringValue(item_product_specifications));
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return this.getOpcStringValue(item_year);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_year));
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return this.getOpcStringValue(item_month);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_month));
|
||||
}
|
||||
|
||||
public String getDay() {
|
||||
return this.getOpcStringValue(item_day);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_day));
|
||||
}
|
||||
|
||||
public String getHour() {
|
||||
return this.getOpcStringValue(item_hour);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_hour));
|
||||
}
|
||||
|
||||
public String getMinute() {
|
||||
return this.getOpcStringValue(item_minute);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_minute));
|
||||
}
|
||||
|
||||
public String getSecond() {
|
||||
return this.getOpcStringValue(item_second);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_second));
|
||||
}
|
||||
|
||||
public String getFlag() {
|
||||
return this.getOpcStringValue(item_flag);
|
||||
return String.valueOf(this.getOpcIntegerValue(item_flag));
|
||||
}
|
||||
|
||||
|
||||
@@ -82,15 +81,21 @@ 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.getIntegerValue(protocol);
|
||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
||||
if (value == null) {
|
||||
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||
setIsonline(false);
|
||||
|
||||
} else {
|
||||
setIsonline(true);
|
||||
return value;
|
||||
}
|
||||
return 0;
|
||||
@@ -108,6 +113,17 @@ 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 "));
|
||||
|
||||
Reference in New Issue
Block a user