车辆重置

This commit is contained in:
2022-03-20 00:12:04 +08:00
parent c1ce765634
commit c8119c5bd0
2 changed files with 52 additions and 0 deletions

View File

@@ -423,6 +423,15 @@ public class ScheduledTask extends BaseService {
}
//监听车辆是否在线
public void listenVehicleOnline() throws IOException {
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>()
.eq(VehicleInfo.STATUS, 2));
for (VehicleInfo vehicleInfo:vehicleInfoList
) {
}
}
/**
* 获取变量值
* @param nameSpace nameSpace前缀
@@ -465,4 +474,33 @@ public class ScheduledTask extends BaseService {
}
return Double.valueOf(JSONObject.parseObject(result).get("result").toString());
}
private Boolean rgvOnline(Long vehicleId) throws IOException {
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
// TODO: 2022/3/19 小车的命名空间
String identifier=null;
if (vehicleId==1){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform4ToWCS.";
}
if (vehicleId==2){
identifier="S7-1200 station_2.Boutique.DB500_PLCToWCS.Platform4ToWCS.";
}
Map<String, Object> json = new HashMap();
json.put("nameSpace", 6);
json.put("plcName", "plc1");
json.put("identifier",identifier+"Online");
String result = null;
try {
result = HttpClient.httpPost("http://192.168.6.51:8009/opcua/read", JSON.toJSONString(json));
} catch (IOException e) {
e.printStackTrace();
logger.info("获取小车1当前是否在线失败");
}
Boolean aBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
if (!aBoolean){
webSocketServer.sendtoAll(vehicleInfo.getVehicleName()+"当前不在线,请人工确认车辆状态,如不能恢复未在线状态,请尽快手动移动车辆到轨道尽头,以避免车辆阻碍任务执行!");
return false;
}
return true;
}
}