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