refactor: 去掉 Kiva 循环测试与 SetDisplayInfo,强制结束/返厂加平台确认

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
黄兆尉
2026-08-26 11:21:48 +08:00
co-authored by Cursor
parent 9b667d0f05
commit 0e1156bc5a
+14 -89
View File
@@ -1,11 +1,11 @@
using LessokajiWeaverUtilities.Utilities;
using LessokajiWeaverUtilities.Utilities;
using Newtonsoft.Json;
using SimpleLite;
using SimpleLite.RCS;
using SimpleLite.RCS.CarTypes;
using SimpleLite.CADTools;
using SimpleLite.Props;
using SimpleLite.UI;
using Simple3;
using Simple3.RCS;
using Simple3.RCS.CarTypes;
using Simple3.CADTools;
using Simple3.Props;
using Simple3.UI;
using SimpleCore;
using SimpleCore.Compiler;
using SimpleCore.Extras;
@@ -261,85 +261,6 @@ namespace StandardScene.CarTypes
}
}
private bool LoopTestRunning = false;
[MethodMember(Name = "循环测试")]
[I18N.DocumentTranslation(Name = "Loop Test", locale = "en")]
public async void LoopTest()
{
LoopTestRunning = true;
var a = SimpleLib.GetAllSites().First(s => s.name == "A");
var b = SimpleLib.GetAllSites().First(s => s.name == "B");
var plan1 = new SegmentPlan() { usingCar = this };
plan1.fields["action"] = "fetch";
plan1.FindRoute(SimpleLib.GetSite(GetLastSite()), a);
await plan1.Compile("fetch").Queue();
var plan2 = new SegmentPlan() { usingCar = this };
plan2.fields["action"] = "go";
plan2.FindRoute(SimpleLib.GetSite(GetLastSite()), b);
await plan2.Compile("go").Queue();
var plan3 = new SegmentPlan() { usingCar = this };
plan3.fields["action"] = "put";
plan3.FindRoute(SimpleLib.GetSite(GetLastSite()), a);
await plan3.Compile("put").Queue();
var plan4 = new SegmentPlan() { usingCar = this };
plan4.fields["action"] = "go";
plan4.FindRoute(SimpleLib.GetSite(GetLastSite()), b);
await plan4.Compile("go").Queue();
}
[MethodMember(Name = "循环停止测试")]
[I18N.DocumentTranslation(Name = "Stop Loop Test", locale = "en")]
public void LoopTestStop()
{
LoopTestRunning = false;
}
public override string SetDisplayInfo()
{
try
{
var str = $"{name}({id})\n";
status.enums.TryGetValue("ChassisMode", out var manual);
var ms = manual == "0" ? "自动" : "手动";
status.enums.TryGetValue("Soc", out var soc);
str = $"{str}{ms}|soc:{soc}";
var alarmStr = Commons.GetCarStatus(this, "AlarmInfo");
if (alarmStr != "")
str = $"{str}|{alarmStr}";
//if (status.enums.TryGetValue("mAlarm", out var mAlarm) && mAlarm != "")
// str = $"{str}|M:{mAlarm}";
//var hasC = status.enums.TryGetValue("cAlarm", out var cAlarm) && cAlarm != "";
//if (mAlarm != "" && hasC)
// str = $"{str}|";
//if (hasC)
// str = $"{str}C:{cAlarm}";
//var L_step = status.enums.TryGetValue("ls", out var ls) && ls != "";
//if (L_step)
//{
// str = $"{str}|ls:{ls}";
//}
if (status.enums.TryGetValue("ElectricCurrent", out var electricCurrent) &&
!string.IsNullOrEmpty(electricCurrent))
{
var charging = float.Parse(electricCurrent) * 0.01f > 0 ? "充电中" : "未充电";
str = $"{str}|charge:{charging}";
}
var thresSpeed = Commons.CarValue(this, "ThresSpeed");
str = $"{str}{((thresSpeed <= 0) ? "|" : "")}";
return str;
}
catch (Exception e)
{
Console.WriteLine(e);
return "bad car";
}
}
[MethodMember(Name = "进入小车管理界面", Description = "在浏览器中打开小车 Web 页面")]
public void OpenVehicleManagementPage()
@@ -353,7 +274,7 @@ namespace StandardScene.CarTypes
[MethodMember(Name = "模拟电量", Description = "/")]
public void SimarSoc()
{
if (InputBox.ShowDialog("模拟电量", "模拟电量Soc", "0", InputBox.Buttons.OkCancel) == SimpleLite.DialogResult.Cancel) return;
if (InputBox.ShowDialog("模拟电量", "模拟电量Soc", "0", InputBox.Buttons.OkCancel) == Simple3.DialogResult.Cancel) return;
string value = InputBox.ResultValue;
try
{
@@ -373,7 +294,9 @@ namespace StandardScene.CarTypes
[MethodMember(Name = "立即强制结束new", Description = "立刻终止小车运行,重启C,并让小车下线")]
[MethodMember(Name = "立即强制结束new", Description = "立刻终止小车运行,重启C,并让小车下线",
RequiresPlatformConfirm = true,
ConfirmMessage = "确定强制结束该车上的作业并下线?")]
[I18N.DocumentTranslation(Name = "Force Stop new", Description = "Stop car & reset clumsy", locale = "en")]
public new async void ForceStop()
{
@@ -419,7 +342,9 @@ namespace StandardScene.CarTypes
}
}
[MethodMember(Name = "返厂检修new", Description = "不再刷新小车状态,当然也不再被调度")]
[MethodMember(Name = "返厂检修new", Description = "不再刷新小车状态,当然也不再被调度",
RequiresPlatformConfirm = true,
ConfirmMessage = "小车确实已经离开路径了么?确认返厂检修?")]
[I18N.DocumentTranslation(Name = "Blown new", Description = "Car no longer refresh status and scheduling", locale = "en")]
public new void Blown()
{