完成路及规划的作业的开始工作成功.
完成路径规划的暂停功能的对接 完成路径规划的继续功能的对接 完成路径规划的停止功能的对接
This commit is contained in:
@@ -351,13 +351,20 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
// 开始路径规划
|
||||
Future<void> startRoutePlanning(Queue<DeviceAddPathPointModel> locationQueue) async {
|
||||
print("cubit层开始路径规划");
|
||||
// 清空全局 Service 中的队列
|
||||
// _routePlanningUseCase.clearLocationQueue();
|
||||
_pathPlanningService.updateQueue(locationQueue as List<DeviceAddPathPointModel>);
|
||||
final List<DeviceAddPathPointModel> pathList = locationQueue.toList();
|
||||
print('✅ 队列转换为 List,长度:${pathList.length}');
|
||||
|
||||
_pathPlanningService.updateQueue(pathList);
|
||||
print('✅ 队列更新成功');
|
||||
|
||||
// 开始路径规划
|
||||
emit(state.copyWith(isLoading: true));
|
||||
//传入全局的Service 中路径规划队列
|
||||
Queue<DeviceAddPathPointModel> queue = _pathPlanningService.getQueue() ;
|
||||
print('📦 从 Service 获取的队列长度:${queue.length}');
|
||||
final result = await _routePlanningUseCase.startRoutePlanning(queue);
|
||||
result.fold(
|
||||
(failure) => emit(state.copyWith(isLoading: false, errorMessage: failure.message ?? '路径规划启动失败')),
|
||||
@@ -386,4 +393,9 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
final result = await _routePlanningUseCase.stopRoutePlanning();
|
||||
result.fold((failure) => emit(state.copyWith(isLoading: false, errorMessage: failure.message ?? '停止失败')), (_) => emit(state.copyWith(isLoading: false)));
|
||||
}
|
||||
|
||||
void updateAppState(AppState appState) {
|
||||
emit(state.copyWith(appState: appState));
|
||||
(_routePlanningUseCase as dynamic).repository.setAppState(appState);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user