自主任务接口接入和bug修复和工作记录页面
This commit is contained in:
@@ -24,13 +24,13 @@ extension WorkRunStateX on WorkRunState {
|
||||
this == WorkRunState.failed ? WorkRunState.paused : this;
|
||||
|
||||
String get label => switch (this) {
|
||||
WorkRunState.idle => '准备',
|
||||
WorkRunState.queued => '待执行',
|
||||
WorkRunState.running => '执行中',
|
||||
WorkRunState.paused => '暂停/中断',
|
||||
WorkRunState.finished => '已结束',
|
||||
WorkRunState.failed => '异常中断',
|
||||
};
|
||||
WorkRunState.idle => '准备',
|
||||
WorkRunState.queued => '待执行',
|
||||
WorkRunState.running => '执行中',
|
||||
WorkRunState.paused => '暂停/中断',
|
||||
WorkRunState.finished => '已结束',
|
||||
WorkRunState.failed => '异常中断',
|
||||
};
|
||||
}
|
||||
|
||||
/// 路线库中的一条可执行路线(对应路径规划列表里的一条作业记录)
|
||||
@@ -111,6 +111,8 @@ class WorkTaskSnapshot {
|
||||
this.coveredArea,
|
||||
this.plannedArea,
|
||||
this.extras = const <String, dynamic>{},
|
||||
this.completedPoints = const <LatLng>[],
|
||||
this.executionStarted = false,
|
||||
});
|
||||
|
||||
final String taskId;
|
||||
@@ -129,6 +131,16 @@ class WorkTaskSnapshot {
|
||||
final double? plannedArea;
|
||||
final Map<String, dynamic> extras;
|
||||
|
||||
/// 当前任务的 MQTT 到达点,独立于设备定位轨迹。
|
||||
final List<LatLng> completedPoints;
|
||||
|
||||
/// 已确认开始过本任务(开始流程成功、执行状态或有效到达点)。
|
||||
/// 独立于后台原始状态,允许 NEW 推送延迟;暂停和结束仍由 state 控制。
|
||||
final bool executionStarted;
|
||||
bool get canRecordTrace =>
|
||||
state == WorkRunState.running ||
|
||||
state == WorkRunState.queued && executionStarted;
|
||||
|
||||
bool get isActive =>
|
||||
state == WorkRunState.queued ||
|
||||
state == WorkRunState.running ||
|
||||
@@ -140,6 +152,8 @@ class WorkTaskSnapshot {
|
||||
String? routeId,
|
||||
String? routeName,
|
||||
double? progress,
|
||||
List<LatLng>? completedPoints,
|
||||
bool? executionStarted,
|
||||
}) {
|
||||
return WorkTaskSnapshot(
|
||||
taskId: taskId,
|
||||
@@ -153,6 +167,8 @@ class WorkTaskSnapshot {
|
||||
coveredArea: coveredArea,
|
||||
plannedArea: plannedArea,
|
||||
extras: extras,
|
||||
completedPoints: completedPoints ?? this.completedPoints,
|
||||
executionStarted: executionStarted ?? this.executionStarted,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user