Browse Source

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
master
psh 1 year ago
parent
commit
4a9c7b7108
  1. 70
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java
  2. 32
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java

70
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/ItemProtocol.java

@ -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,47 +82,42 @@ 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 String getOpcStringValue(String protocol) {
String value = this.driver.getStringValue(protocol); public Float getOpcFloatValue(String protocol) {
Float value = this.driver.getFloatValue(protocol);
if (value == null) { if (value == null) {
//throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)}); //throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)});
} else { } else {
return value; return value;
} }
return "0"; return 0f;
} }
public float getOpcFloatValue(String protocol) { public String getOpcStringValue(String protocol) {
float value = this.driver.getFloatValue(protocol); String value = this.driver.getStringValue(protocol);
if (value == 0) { if (value == null) {
//throw new BusinessException("{} : {}", new Object[]{protocol, DeviceErrorProtocol.getMessage(10000)});
} else { } else {
return value; return value;
} }
return 0; return "0";
} }
public static List<ItemDto> getReadableItemDtos() { public static List<ItemDto> getReadableItemDtos() {

32
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site_smart200/StandardInspectSiteSmartDeviceDriver.java

@ -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() {

Loading…
Cancel
Save