电梯Agv心跳代码调整
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Dynamic;
|
||||
using DingTalk.Api.Request;
|
||||
using JNPF;
|
||||
using JNPF.Common.Extension;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -324,11 +325,29 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
return (sysStatus: sysStatus, runStatus: runStatus, floorNo: floorNo, doorStatus: doorStatus, agvStatus: agvStatus);
|
||||
return (sysStatus, runStatus, floorNo, doorStatus, agvStatus);
|
||||
|
||||
}
|
||||
|
||||
public async Task<Dictionary<string, int>> GetELevatorStatusMap(string devName, IEnumerable<string> tags, CancellationToken token)
|
||||
{
|
||||
Task<string> GetTag(string tag)
|
||||
{
|
||||
var dicCommand = new Dictionary<string, string>
|
||||
{
|
||||
["DevName"] = devName,
|
||||
["token"] = _elevatorCtlCfg.token,
|
||||
["TagName"] = tag
|
||||
};
|
||||
|
||||
return HttpClientHelper.GetAsync(_elevatorCtlCfg.GetTagUrl, pars: dicCommand);
|
||||
}
|
||||
|
||||
var tasks = tags.Select(tag => GetTag(tag));
|
||||
var results = await Task.WhenAll(tasks);
|
||||
var statusMap = results?.Select(x => JObject.Parse(x)).ToDictionary(x => x.Value<string>("Name"), x => x.Value<int>("V")) ?? default;
|
||||
return statusMap;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user