终于解决了 第二次作业之后的 路径不清除的问题 ,一直保留着上一次作业发送的完成点
This commit is contained in:
@@ -47,7 +47,6 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
final ILoggerService _logger = GetIt.I<ILoggerService>();
|
||||
|
||||
|
||||
DevicesCubit(
|
||||
this.repository,
|
||||
this._getUserDeviceUseCase,
|
||||
@@ -232,7 +231,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
// 🔥 关键修复 2:发起新连接
|
||||
// connect 方法内部会自动调用 _sendAuthPacket -> 获取设备列表 -> 自动订阅当前选中的设备
|
||||
// debugPrint('🔌 开始重新新连接 TCP,将自动订阅新设备:${device.deviceName}');
|
||||
// debugPrint('🔌 开始重新新连接 TCP,将自动订阅新设备:${device.deviceName}');
|
||||
_logger.logWithLevel('🔌 启动重新新连接 TCP,将自动订阅新设备:${device.deviceName}');
|
||||
await _tcpClient.connectBySwitch(host: TCPConsts.TCP_IP, port: TCPConsts.TCP_PORT, deviceName: device.deviceName);
|
||||
// 🔥 关键修复 3:重置设备状态 Bloc,清除旧设备图表数据
|
||||
@@ -354,12 +353,12 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
// 开始路径规划
|
||||
Future<void> startRoutePlanning(Queue<DeviceAddPathPointModel> locationQueue) async {
|
||||
/// print("cubit层开始路径规划");
|
||||
/// print("cubit层开始路径规划");
|
||||
_logger.logWithLevel('开始路径规划');
|
||||
// 清空全局 Service 中的队列
|
||||
// _routePlanningUseCase.clearLocationQueue();
|
||||
final List<DeviceAddPathPointModel> pathList = locationQueue.toList();
|
||||
// print('✅ 队列转换为 List,长度:${pathList.length}');
|
||||
// print('✅ 队列转换为 List,长度:${pathList.length}');
|
||||
_logger.logWithLevel('队列转换为 List,长度:${pathList.length}');
|
||||
|
||||
_pathPlanningService.updateQueue(pathList);
|
||||
@@ -397,6 +396,7 @@ 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)));
|
||||
@@ -418,7 +418,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
void setArrivedLocation(double latitude, double longitude) {
|
||||
emit(state.copyWith(arriLatitude: latitude, arriLongitude: longitude));
|
||||
// print('✅ [DevicesCubit] 监听更新已完成到达位置:Lat=$latitude, Lng=$longitude');
|
||||
// print('✅ [DevicesCubit] 监听更新已完成到达位置:Lat=$latitude, Lng=$longitude');
|
||||
_logger.logWithLevel('✅ [DevicesCubit] 监听更新已完成到达位置:Lat=$latitude, Lng=$longitude');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user