完善自主作业下发、暂停恢复和轨迹保留
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
/// 暂停/恢复由装配层连接现有任务控制器,业务状态层不依赖具体 Cubit。
|
||||
typedef WorkTaskControl =
|
||||
Future<WorkResult<bool>> Function({
|
||||
required String deviceId,
|
||||
required int taskId,
|
||||
required bool resume,
|
||||
});
|
||||
|
||||
/// 跨环境统一的作业运行态:UI 只认这一套枚举。
|
||||
/// 各环境自己的任务状态码(NEW/EXECUTING/PAUSE/… 或别的后端字段)
|
||||
/// 由各自的 gateway 实现映射到这里,页面不感知原始状态码。
|
||||
@@ -112,6 +120,8 @@ class WorkTaskSnapshot {
|
||||
this.plannedArea,
|
||||
this.extras = const <String, dynamic>{},
|
||||
this.completedPoints = const <LatLng>[],
|
||||
this.recordedPoints = const <LatLng>[],
|
||||
this.plannedRoute = const <LatLng>[],
|
||||
this.executionStarted = false,
|
||||
});
|
||||
|
||||
@@ -133,6 +143,9 @@ class WorkTaskSnapshot {
|
||||
|
||||
/// 当前任务的 MQTT 到达点,独立于设备定位轨迹。
|
||||
final List<LatLng> completedPoints;
|
||||
/// 页面重建后仍需恢复的实际行走轨迹与设备下发的规划路线。
|
||||
final List<LatLng> recordedPoints;
|
||||
final List<LatLng> plannedRoute;
|
||||
|
||||
/// 已确认开始过本任务(开始流程成功、执行状态或有效到达点)。
|
||||
/// 独立于后台原始状态,允许 NEW 推送延迟;暂停和结束仍由 state 控制。
|
||||
@@ -153,6 +166,8 @@ class WorkTaskSnapshot {
|
||||
String? routeName,
|
||||
double? progress,
|
||||
List<LatLng>? completedPoints,
|
||||
List<LatLng>? recordedPoints,
|
||||
List<LatLng>? plannedRoute,
|
||||
bool? executionStarted,
|
||||
}) {
|
||||
return WorkTaskSnapshot(
|
||||
@@ -168,6 +183,8 @@ class WorkTaskSnapshot {
|
||||
plannedArea: plannedArea,
|
||||
extras: extras,
|
||||
completedPoints: completedPoints ?? this.completedPoints,
|
||||
recordedPoints: recordedPoints ?? this.recordedPoints,
|
||||
plannedRoute: plannedRoute ?? this.plannedRoute,
|
||||
executionStarted: executionStarted ?? this.executionStarted,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,16 @@ abstract interface class WorkTaskQueueSource {
|
||||
Stream<WorkTaskSnapshot?> watchTaskChanges({required String deviceId});
|
||||
}
|
||||
|
||||
/// 地图只回传几何,保存与恢复由既有任务状态层负责。
|
||||
abstract interface class WorkTaskGeometrySource {
|
||||
void recordTaskGeometry({
|
||||
required String deviceId,
|
||||
required String taskId,
|
||||
List<LatLng>? recordedPoints,
|
||||
List<LatLng>? plannedRoute,
|
||||
});
|
||||
}
|
||||
|
||||
/// 自主作业的业务门面。
|
||||
///
|
||||
/// 一套页面功能,多套环境实现:
|
||||
|
||||
Reference in New Issue
Block a user