Merge branch 'master' of http://121.40.234.130:8899/wangs/jiaNan
# Conflicts: # acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java
This commit is contained in:
@@ -8,6 +8,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Data
|
||||||
public class ItemProtocol {
|
public class ItemProtocol {
|
||||||
|
|
||||||
|
|
||||||
@@ -30,48 +31,48 @@ public class ItemProtocol {
|
|||||||
this.driver = driver;
|
this.driver = driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getWeight() {
|
public Float getWeight() {
|
||||||
return String.valueOf(this.getOpcFloatValue(item_weight));
|
return this.getOpcFloatValue(item_weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductCode() {
|
public String getProductCode() {
|
||||||
return String.valueOf(this.getOpcStringValue(item_product_code));
|
return this.getOpcStringValue(item_product_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBatchCode() {
|
public String getBatchCode() {
|
||||||
return String.valueOf(this.getOpcStringValue(item_batch_code));
|
return this.getOpcStringValue(item_batch_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProductSpecifications() {
|
public String getProductSpecifications() {
|
||||||
return String.valueOf(this.getOpcStringValue(item_product_specifications));
|
return this.getOpcStringValue(item_product_specifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getYear() {
|
public Integer getYear() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_year));
|
return this.getOpcIntegerValue(item_year);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMonth() {
|
public Integer getMonth() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_month));
|
return this.getOpcIntegerValue(item_month);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDay() {
|
public Integer getDay() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_day));
|
return this.getOpcIntegerValue(item_day);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHour() {
|
public Integer getHour() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_hour));
|
return this.getOpcIntegerValue(item_hour);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMinute() {
|
public Integer getMinute() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_minute));
|
return this.getOpcIntegerValue(item_minute);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSecond() {
|
public Integer getSecond() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_second));
|
return this.getOpcIntegerValue(item_second);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFlag() {
|
public Integer getFlag() {
|
||||||
return String.valueOf(this.getOpcIntegerValue(item_flag));
|
return this.getOpcIntegerValue(item_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -81,27 +82,33 @@ public class ItemProtocol {
|
|||||||
return move;
|
return move;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIsonline() {
|
|
||||||
return isonline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsonline(Boolean isonline) {
|
|
||||||
this.isonline = isonline;
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean isonline;
|
Boolean isonline;
|
||||||
|
|
||||||
public int getOpcIntegerValue(String protocol) {
|
public int getOpcIntegerValue(String protocol) {
|
||||||
Integer value = this.driver.getIntegeregerValue(protocol);
|
Integer value = this.driver.getIntegerValue(protocol);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!");
|
||||||
|
setIsonline(false);
|
||||||
} else {
|
} else {
|
||||||
|
setIsonline(true);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
return 0;
|
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) {
|
public String getOpcStringValue(String protocol) {
|
||||||
String value = this.driver.getStringValue(protocol);
|
String value = this.driver.getStringValue(protocol);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -113,17 +120,6 @@ public class ItemProtocol {
|
|||||||
return "0";
|
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() {
|
public static List<ItemDto> getReadableItemDtos() {
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
list.add(new ItemDto(item_product_code, "产品名称", "VB3251 "));
|
list.add(new ItemDto(item_product_code, "产品名称", "VB3251 "));
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
Boolean islock = false;
|
Boolean islock = false;
|
||||||
|
|
||||||
// 重量
|
// 重量
|
||||||
private String weight;
|
private Float weight;
|
||||||
private String last_weight;
|
private Float last_weight;
|
||||||
|
|
||||||
// 产品名称
|
// 产品名称
|
||||||
private String product_code;
|
private String product_code;
|
||||||
@@ -160,24 +160,24 @@ public class StandardInspectSiteSmartDeviceDriver extends AbstractOpcDeviceDrive
|
|||||||
private String last_product_specifications;
|
private String last_product_specifications;
|
||||||
|
|
||||||
// 时间
|
// 时间
|
||||||
private String year;
|
private int year;
|
||||||
private String last_year;
|
private int last_year;
|
||||||
private String month;
|
private int month;
|
||||||
private String last_month;
|
private int last_month;
|
||||||
private String day;
|
private int day;
|
||||||
private String last_day;
|
private int last_day;
|
||||||
private String hour;
|
private int hour;
|
||||||
private String last_hour;
|
private int last_hour;
|
||||||
private String minute;
|
private int minute;
|
||||||
private String last_minute;
|
private int last_minute;
|
||||||
private String second;
|
private int second;
|
||||||
private String last_second;
|
private int last_second;
|
||||||
private String time;
|
private String time;
|
||||||
private String last_time;
|
private String last_time;
|
||||||
|
|
||||||
//气缸分离状态0-不分离,1分离
|
//气缸分离状态0-不分离,1分离
|
||||||
private String flag;
|
private int flag;
|
||||||
private String last_flag;
|
private int last_flag;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Device getDevice() {
|
public Device getDevice() {
|
||||||
|
|||||||
Reference in New Issue
Block a user