修复完成作业停止之后再开始作业
This commit is contained in:
@@ -181,6 +181,13 @@ class PathPlanner {
|
||||
_isStopped = true;
|
||||
_isPaused = false; // 清除暂停状态
|
||||
|
||||
// 🔥 核心修复:清空队列
|
||||
print("🗑️ 清空待发送队列,剩余 ${locationQueue.length} 个点");
|
||||
locationQueue.clear();
|
||||
|
||||
|
||||
|
||||
|
||||
var entity = new RoutePlanSendEntity(
|
||||
commandType: 0x01,
|
||||
pointCounts: 0,
|
||||
|
||||
@@ -391,6 +391,8 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
Future<void> stopRoutePlanning() async {
|
||||
emit(state.copyWith(isLoading: true));
|
||||
final result = await _routePlanningUseCase.stopRoutePlanning();
|
||||
// 🔥 重置 PathPlanningService 中的全局的队列
|
||||
_pathPlanningService.clear();
|
||||
result.fold((failure) => emit(state.copyWith(isLoading: false, errorMessage: failure.message ?? '停止失败')), (_) => emit(state.copyWith(isLoading: false)));
|
||||
}
|
||||
|
||||
|
||||
@@ -73,4 +73,5 @@ class PathPlanningService {
|
||||
Queue<DeviceAddPathPointModel> getQueue() {
|
||||
return Queue.of(locationQueue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user