Merge branch 'feature/my' of http://1.95.137.212:57001/APP/FlutterApp into feature/my
This commit is contained in:
@@ -4,7 +4,9 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:maibu_satabot_v2/features/devices/data/models/device_add_path_point_model.dart';
|
import 'package:maibu_satabot_v2/features/devices/data/models/device_add_path_point_model.dart';
|
||||||
|
|
||||||
import '../../features/devices/domain/repositories/route_planning_repository.dart';
|
import '../../features/devices/domain/repositories/route_planning_repository.dart';
|
||||||
|
import '../../features/devices/presentation/bloc/devices_cubit.dart';
|
||||||
import '../../features/devices/services/path_planning_service.dart';
|
import '../../features/devices/services/path_planning_service.dart';
|
||||||
|
import '../di/injection.dart';
|
||||||
import 'protocol_decoder.dart';
|
import 'protocol_decoder.dart';
|
||||||
import 'tcp/tcp_client.dart';
|
import 'tcp/tcp_client.dart';
|
||||||
// import '../../features/auth/data/models/user_model.dart';
|
// import '../../features/auth/data/models/user_model.dart';
|
||||||
@@ -101,6 +103,13 @@ class NetMessageDispatcher {
|
|||||||
/// _pathPlanningService.updateQueue(queue as List<DeviceAddPathPointModel>);
|
/// _pathPlanningService.updateQueue(queue as List<DeviceAddPathPointModel>);
|
||||||
_pathPlanningService.updateQueue(queue.toList());
|
_pathPlanningService.updateQueue(queue.toList());
|
||||||
debugPrint('📡 [Dispatcher] 准备触发下一个路径点发送,队列剩余:${queue.length}');
|
debugPrint('📡 [Dispatcher] 准备触发下一个路径点发送,队列剩余:${queue.length}');
|
||||||
|
///如果还剩0个数据 就停止发送
|
||||||
|
if (queue.length==0) {
|
||||||
|
debugPrint('⚠️ [Dispatcher] 队列已空,停止发送');
|
||||||
|
final devicesCubit = sl<DevicesCubit>();
|
||||||
|
devicesCubit.finishWork();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
routePlanningRepository.startRoutePlanning(queue);
|
routePlanningRepository.startRoutePlanning(queue);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -398,4 +398,13 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
emit(state.copyWith(appState: appState));
|
emit(state.copyWith(appState: appState));
|
||||||
(_routePlanningUseCase as dynamic).repository.setAppState(appState);
|
(_routePlanningUseCase as dynamic).repository.setAppState(appState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void finishWork() {
|
||||||
|
emit(state.copyWith(isFinshWork: true));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 重置完成状态
|
||||||
|
void resetWorkStatus() {
|
||||||
|
emit(state.copyWith(isFinshWork: false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class DevicesState extends Equatable {
|
|||||||
final List<Map<String, dynamic>>? pathData;
|
final List<Map<String, dynamic>>? pathData;
|
||||||
final List<DeviceAddPathPointModel>? generatedPath; // 新增字段
|
final List<DeviceAddPathPointModel>? generatedPath; // 新增字段
|
||||||
final AppState appState;
|
final AppState appState;
|
||||||
|
final bool isFinshWork;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ class DevicesState extends Equatable {
|
|||||||
this.pathData,
|
this.pathData,
|
||||||
this.generatedPath,
|
this.generatedPath,
|
||||||
this.appState = AppState.none,
|
this.appState = AppState.none,
|
||||||
|
this.isFinshWork = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 使用 copyWith 方便局部更新状态
|
// 使用 copyWith 方便局部更新状态
|
||||||
@@ -57,6 +59,7 @@ class DevicesState extends Equatable {
|
|||||||
List<Map<String, dynamic>>? pathData,
|
List<Map<String, dynamic>>? pathData,
|
||||||
List<DeviceAddPathPointModel>? generatedPath,
|
List<DeviceAddPathPointModel>? generatedPath,
|
||||||
AppState? appState,
|
AppState? appState,
|
||||||
|
bool? isFinshWork,
|
||||||
}) {
|
}) {
|
||||||
return DevicesState(
|
return DevicesState(
|
||||||
devices: devices ?? this.devices,
|
devices: devices ?? this.devices,
|
||||||
@@ -70,6 +73,7 @@ class DevicesState extends Equatable {
|
|||||||
operationType: operationType ?? this.operationType, // 更新操作类型
|
operationType: operationType ?? this.operationType, // 更新操作类型
|
||||||
generatedPath: generatedPath ?? this.generatedPath, // 更新生成的路径数据
|
generatedPath: generatedPath ?? this.generatedPath, // 更新生成的路径数据
|
||||||
appState: appState ?? this.appState, // 更新应用状态
|
appState: appState ?? this.appState, // 更新应用状态
|
||||||
|
isFinshWork: isFinshWork ?? this.isFinshWork,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,5 +87,6 @@ class DevicesState extends Equatable {
|
|||||||
operationType,
|
operationType,
|
||||||
generatedPath,
|
generatedPath,
|
||||||
appState,
|
appState,
|
||||||
|
isFinshWork
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user