fix 信号读取
This commit is contained in:
@@ -282,8 +282,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
map.put("code", "to_command");
|
map.put("code", "to_command");
|
||||||
map.put("value", "2");
|
map.put("value", "2");
|
||||||
list.add(map);
|
list.add(map);
|
||||||
siemensConveyorDeviceDriver.writing(list);
|
try{
|
||||||
siemensConveyorDeviceDriver.writing(list);
|
siemensConveyorDeviceDriver.writing(list);
|
||||||
|
siemensConveyorDeviceDriver.writing(list);
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,8 +303,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
|||||||
map.put("code", "to_command");
|
map.put("code", "to_command");
|
||||||
map.put("value", "2");
|
map.put("value", "2");
|
||||||
list.add(map);
|
list.add(map);
|
||||||
siemensOneFloorAGVConveyorDeviceDriver.writing(list);
|
try{
|
||||||
siemensOneFloorAGVConveyorDeviceDriver.writing(list);
|
siemensOneFloorAGVConveyorDeviceDriver.writing(list);
|
||||||
|
siemensOneFloorAGVConveyorDeviceDriver.writing(list);
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -783,7 +783,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
}
|
}
|
||||||
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code());
|
||||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||||
|
if(StrUtil.equals(next_addr,"0")){
|
||||||
|
if (StrUtil.isNotEmpty(inst.getTo_z())) {
|
||||||
|
if (StrUtil.equals(inst.getTo_z(), "01")) {
|
||||||
|
next_addr = "102";
|
||||||
|
} else if (StrUtil.equals(inst.getTo_z(), "02")) {
|
||||||
|
next_addr = "201";
|
||||||
|
} else if (StrUtil.equals(inst.getTo_z(), "03")) {
|
||||||
|
next_addr = "301";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
map.put("code", "to_target");
|
map.put("code", "to_target");
|
||||||
@@ -938,20 +948,20 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
|||||||
JSONObject apply = new JSONObject();
|
JSONObject apply = new JSONObject();
|
||||||
apply.put("device_code", device_code);
|
apply.put("device_code", device_code);
|
||||||
apply.put("type", "2");
|
apply.put("type", "2");
|
||||||
String str = acsToWmsService.applyTaskToWms(apply);
|
// String str = acsToWmsService.applyTaskToWms(apply);
|
||||||
logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:" + apply);
|
// logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:" + apply);
|
||||||
|
//
|
||||||
JSONObject jo = JSON.parseObject(str);
|
// JSONObject jo = JSON.parseObject(str);
|
||||||
if (ObjectUtil.isEmpty(jo)) {
|
// if (ObjectUtil.isEmpty(jo)) {
|
||||||
message = "申请空盘入库接口不通";
|
// message = "申请空盘入库接口不通";
|
||||||
} else {
|
// } else {
|
||||||
if (jo.getInteger("status") == 200) {
|
// if (jo.getInteger("status") == 200) {
|
||||||
message = "申请空盘入库成功";
|
message = "申请空盘入库成功";
|
||||||
requireEmptyInSuccess = true;
|
requireEmptyInSuccess = true;
|
||||||
} else {
|
// } else {
|
||||||
message = "申请空盘入库失败," + jo.get("message").toString();
|
// message = "申请空盘入库失败," + jo.get("message").toString();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -361,11 +361,16 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
|||||||
result.put("comment", "当前设备光电信号:"+siemensConveyorDeviceDriver.getMove()+",工作模式:"+siemensConveyorDeviceDriver.getMode());
|
result.put("comment", "当前设备光电信号:"+siemensConveyorDeviceDriver.getMove()+",工作模式:"+siemensConveyorDeviceDriver.getMode());
|
||||||
}
|
}
|
||||||
} else if(StrUtil.equals(type,"2")){
|
} else if(StrUtil.equals(type,"2")){
|
||||||
siemensConveyorDeviceDriver.writing("to_command","3");
|
try{
|
||||||
siemensConveyorDeviceDriver.writing("to_command","3");
|
siemensConveyorDeviceDriver.writing("to_command","3");
|
||||||
|
siemensConveyorDeviceDriver.writing("to_command","3");
|
||||||
result.put("result", "true");
|
} catch (Exception e){
|
||||||
result.put("comment", "");
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if(siemensConveyorDeviceDriver.getTo_command() == 3){
|
||||||
|
result.put("result", "true");
|
||||||
|
result.put("comment", "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.nl.acs.heartbeat.enums.HeartbeatType;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
public class HeartbeatDomain extends Domain {
|
public class HeartbeatDomain {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private String resource_code;
|
private String resource_code;
|
||||||
private String resource_name;
|
private String resource_name;
|
||||||
@@ -15,13 +15,17 @@ public class HeartbeatDomain extends Domain {
|
|||||||
private Date online_datetime;
|
private Date online_datetime;
|
||||||
private Date offline_datetime;
|
private Date offline_datetime;
|
||||||
private Date lastreceivetime;
|
private Date lastreceivetime;
|
||||||
|
private String id;
|
||||||
public HeartbeatDomain() {
|
public HeartbeatDomain() {
|
||||||
this.resource_code = SqlUtilFactory.string_column_defatult;
|
this.resource_code = SqlUtilFactory.string_column_defatult;
|
||||||
this.resource_name = SqlUtilFactory.string_column_defatult;
|
this.resource_name = SqlUtilFactory.string_column_defatult;
|
||||||
this.duration = 0L;
|
this.duration = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
public String getResource_code() {
|
public String getResource_code() {
|
||||||
return this.resource_code;
|
return this.resource_code;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,52 +70,47 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
|
|||||||
public Group getServer(String code) {
|
public Group getServer(String code) {
|
||||||
synchronized(this.buildLock(code)) {
|
synchronized(this.buildLock(code)) {
|
||||||
Group group = null;
|
Group group = null;
|
||||||
// group = (Group)this.groups.get(code);
|
group = (Group)this.groups.get(code);
|
||||||
// if (group != null) {
|
if (group != null) {
|
||||||
// label68: {
|
label68: {
|
||||||
// Group var10000;
|
Group var10000;
|
||||||
// try {
|
try {
|
||||||
// if (!group.isActive()) {
|
if (!group.isActive()) {
|
||||||
// break label68;
|
break label68;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// var10000 = group;
|
|
||||||
// } catch (JIException var14) {
|
|
||||||
// log.error(code, var14);
|
|
||||||
// break label68;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return var10000;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Server server = (Server)this.servers.get(code);
|
var10000 = group;
|
||||||
// boolean needcreate = false;
|
} catch (JIException var14) {
|
||||||
// String groupName = code;
|
log.error(code, var14);
|
||||||
// if (server == null) {
|
break label68;
|
||||||
// needcreate = true;
|
}
|
||||||
// } else {
|
|
||||||
// try {
|
|
||||||
// group = server.findGroup(groupName);
|
|
||||||
// } catch (UnknownHostException | JIException | UnknownGroupException | NotConnectedException | IllegalArgumentException var13) {
|
|
||||||
// log.error(code, var13);
|
|
||||||
// needcreate = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
return var10000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Server server = (Server)this.servers.get(code);
|
||||||
boolean needcreate = false;
|
boolean needcreate = false;
|
||||||
needcreate = true;
|
|
||||||
String groupName = code;
|
String groupName = code;
|
||||||
Server server = null;
|
if (server == null) {
|
||||||
|
needcreate = true;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
group = server.findGroup(groupName);
|
||||||
|
} catch (UnknownHostException | JIException | UnknownGroupException | NotConnectedException | IllegalArgumentException var13) {
|
||||||
|
log.error(code, var13);
|
||||||
|
needcreate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (needcreate) {
|
if (needcreate) {
|
||||||
OpcServerManageDto dto = (OpcServerManageDto)this.opcServerManageDtos.get(code);
|
OpcServerManageDto dto = (OpcServerManageDto)this.opcServerManageDtos.get(code);
|
||||||
if (dto == null) {
|
if (dto == null) {
|
||||||
throw new BadRequestException(code + "{} 不存在");
|
throw new RuntimeException(code+"不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
|
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); }
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
group = server.addGroup(groupName);
|
group = server.addGroup(groupName);
|
||||||
@@ -124,11 +119,10 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn
|
|||||||
ThreadUtl.sleep(5000L);
|
ThreadUtl.sleep(5000L);
|
||||||
log.warn("获取opc出错重新获取", code, var12);
|
log.warn("获取opc出错重新获取", code, var12);
|
||||||
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
|
server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
group = server.addGroup(groupName);
|
group = server.addGroup(groupName);
|
||||||
} catch (Exception var11) {
|
} catch (Exception var11) {
|
||||||
var11.printStackTrace();
|
throw new RuntimeException(var12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ public class OpcUtl {
|
|||||||
Item item = group.addItem(value.getItem_code());
|
Item item = group.addItem(value.getItem_code());
|
||||||
ws.add(new WriteRequest(item, getVariant(value.getItem_value())));
|
ws.add(new WriteRequest(item, getVariant(value.getItem_value())));
|
||||||
}
|
}
|
||||||
|
|
||||||
writeValue(group, (WriteRequest[])ws.toArray(new WriteRequest[0]));
|
writeValue(group, (WriteRequest[])ws.toArray(new WriteRequest[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user