feat: GetCarStateInfo 无报警时在 CurrState 显示交管阻挡
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,12 +15,12 @@ using MDCSToolBox.Clumsy.Movements;
|
|||||||
using Nancy;
|
using Nancy;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using SimpleLite;
|
using Simple3;
|
||||||
using SimpleLite.RCS;
|
using Simple3.RCS;
|
||||||
using SimpleLite.RCS.CarTypes;
|
using Simple3.RCS.CarTypes;
|
||||||
using SimpleLite.CADTools;
|
using Simple3.CADTools;
|
||||||
using SimpleLite.Props;
|
using Simple3.Props;
|
||||||
using SimpleLite.UI;
|
using Simple3.UI;
|
||||||
using SimpleCore;
|
using SimpleCore;
|
||||||
using SimpleCore.Library;
|
using SimpleCore.Library;
|
||||||
using SimpleCore.PropType;
|
using SimpleCore.PropType;
|
||||||
@@ -38,7 +38,7 @@ namespace StandardScene
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 【过渡期遗留】老平台 Nancy HTTP 接口(40+ 端点)。导航耦合极弱:仅二维码 QrMap(数据仍存
|
/// 【过渡期遗留】老平台 Nancy HTTP 接口(40+ 端点)。导航耦合极弱:仅二维码 QrMap(数据仍存
|
||||||
/// 本类静态字段,由 scene.qrlidar 插件的 SyncQrMap 工具写入)与 getLidarMap。
|
/// 本类静态字段,由 scene.qrlidar 插件的 SyncQrMap 工具写入)与 getLidarMap。
|
||||||
/// 拆分计划 §4.7:暂留 Core 维持现场兼容,后续逐步迁往 SimpleLite 的 EmbedIO 接口(MIGU-API),
|
/// 拆分计划 §4.7:暂留 Core 维持现场兼容,后续逐步迁往 Simple3 的 EmbedIO 接口(MIGU-API),
|
||||||
/// 新功能请勿在此追加端点。
|
/// 新功能请勿在此追加端点。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ApiController : NancyModule
|
public class ApiController : NancyModule
|
||||||
@@ -2600,13 +2600,10 @@ namespace StandardScene
|
|||||||
}
|
}
|
||||||
|
|
||||||
var currentSite = SimpleLib.GetSite(singleCar.status.holdingLocks.FirstOrDefault());
|
var currentSite = SimpleLib.GetSite(singleCar.status.holdingLocks.FirstOrDefault());
|
||||||
// HashSet<Tuple<int, int>> blockedBy = singleCar.status.blockedBy;
|
|
||||||
var blockedBy = singleCar.status.blockedBy.ToHashSet();
|
var blockedBy = singleCar.status.blockedBy.ToHashSet();
|
||||||
List<BlockedByItem> blockedByItems = new List<BlockedByItem>();
|
List<BlockedByItem> blockedByItems = new List<BlockedByItem>();
|
||||||
//var BlockedBy = string.Empty;
|
|
||||||
for (int i = 0; i < blockedBy.Count; i++)
|
for (int i = 0; i < blockedBy.Count; i++)
|
||||||
{
|
{
|
||||||
//BlockedBy += $"({blockedBy.ElementAt(i).Item1 + "," + blockedBy.ElementAt(i).Item2});";
|
|
||||||
blockedByItems.Add(
|
blockedByItems.Add(
|
||||||
new BlockedByItem
|
new BlockedByItem
|
||||||
{
|
{
|
||||||
@@ -2615,7 +2612,29 @@ namespace StandardScene
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//BlockedBy = BlockedBy.TrimEnd(';');
|
|
||||||
|
// 交管阻挡:报警优先;否则 CurrState 显示「被{name}车交管」(多车全部列出)
|
||||||
|
var hasAlarm =
|
||||||
|
singleCar.status.enums.TryGetValue("AlarmInfo", out var alarmInfo)
|
||||||
|
&& !string.IsNullOrWhiteSpace(alarmInfo);
|
||||||
|
if (!hasAlarm)
|
||||||
|
{
|
||||||
|
var blockerNames = blockedBy
|
||||||
|
.Where(p => p.Item1 >= 0)
|
||||||
|
.Select(p => p.Item1)
|
||||||
|
.Distinct()
|
||||||
|
.Select(id =>
|
||||||
|
{
|
||||||
|
var blocker = SimpleLib.GetCar(id);
|
||||||
|
return blocker != null && !string.IsNullOrWhiteSpace(blocker.name)
|
||||||
|
? blocker.name
|
||||||
|
: id.ToString();
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
if (blockerNames.Count > 0)
|
||||||
|
carState = $"被{string.Join("、", blockerNames)}车交管";
|
||||||
|
}
|
||||||
|
|
||||||
return new CarStateInfo()
|
return new CarStateInfo()
|
||||||
{
|
{
|
||||||
Code = carCode,
|
Code = carCode,
|
||||||
|
|||||||
Reference in New Issue
Block a user