更新 推送新增status + time
This commit is contained in:
parent
15a8b3f3bc
commit
9b6cd65daf
@ -14,6 +14,7 @@ import java.io.File;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -115,7 +116,8 @@ public class CommonFunction {
|
||||
* */
|
||||
public static Object var(Object object){
|
||||
if(object.getClass().isArray()){
|
||||
return Arrays.asList(object);
|
||||
List<Object> objects = Arrays.asList(object);
|
||||
return objects.get(0);
|
||||
}
|
||||
return object.toString();
|
||||
}
|
||||
|
@ -1058,7 +1058,7 @@ public class UAService {
|
||||
|
||||
//String s = ns.get(i)+","+id.get(i)+"|"+var.toString()+"|"+varType+"|"+plcName;
|
||||
|
||||
CurrentSubEntity cur = new CurrentSubEntity(ns.get(i),id.get(i),var,varType,isArray,plcName);
|
||||
CurrentSubEntity cur = new CurrentSubEntity(ns.get(i),id.get(i),var,varType,isArray,plcName,CommonFunction.quality(values.get(i).getStatusCode()));
|
||||
result.add(cur);
|
||||
}
|
||||
return result;
|
||||
|
@ -12,14 +12,16 @@ public class CurrentSubEntity {
|
||||
private String valueType;
|
||||
private Boolean isArray;
|
||||
private String plcName;
|
||||
private String status;
|
||||
|
||||
public CurrentSubEntity(Integer nameSpace, String identifier, Object value, String valueType, Boolean isArray, String plcName) {
|
||||
public CurrentSubEntity(Integer nameSpace, String identifier, Object value, String valueType, Boolean isArray, String plcName,String status) {
|
||||
this.nameSpace = nameSpace;
|
||||
this.identifier = identifier;
|
||||
this.value = value;
|
||||
this.valueType = valueType;
|
||||
this.isArray = isArray;
|
||||
this.plcName = plcName;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Boolean getArray() {
|
||||
@ -69,4 +71,12 @@ public class CurrentSubEntity {
|
||||
public void setPlcName(String plcName) {
|
||||
this.plcName = plcName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class S7Controller {
|
||||
@PostMapping("/addThisPlc")
|
||||
public R addThisPlc() throws PlcConnectionException {
|
||||
//s7://192.168.1.51?remote-rack=0&remote-slot=3&controller-type=S7_400,如果参数不是默认的 要向这样往url 后面加。
|
||||
return R.ok().put("res",s7Service.addPlc("s7://192.168.0.200"));
|
||||
return R.ok().put("res",s7Service.addPlc("s7://192.168.0.100"));
|
||||
}
|
||||
@PostMapping("/getValue")
|
||||
public R getValue() throws PlcConnectionException {
|
||||
|
Loading…
Reference in New Issue
Block a user