Merge branch 'feature/my' of http://1.95.137.212:57001/APP/FlutterApp into feature/my
This commit is contained in:
@@ -95,6 +95,17 @@ class NetMessageDispatcher {
|
|||||||
///取全局的路径规划发送实体 queue
|
///取全局的路径规划发送实体 queue
|
||||||
/// 发送下一个指令 移除上一条数据
|
/// 发送下一个指令 移除上一条数据
|
||||||
var queue = _pathPlanningService.getQueue();
|
var queue = _pathPlanningService.getQueue();
|
||||||
|
// 🔥 关键:必须先检查空队列!
|
||||||
|
if (queue.isEmpty) {
|
||||||
|
devicesCubit.finishWork();
|
||||||
|
Future.delayed(Duration(seconds: 1), () {
|
||||||
|
devicesCubit.resetWorkStatus();
|
||||||
|
});
|
||||||
|
// 手动停止
|
||||||
|
//routePlanningRepository.stopRoutePlanning();
|
||||||
|
debugPrint('⚠️ [Dispatcher] 队列已经为空,跳过本次响应处理');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
///更新完成jwd
|
///更新完成jwd
|
||||||
var deviceAddPathPointModel = queue.first;
|
var deviceAddPathPointModel = queue.first;
|
||||||
var d = deviceAddPathPointModel.latitude;
|
var d = deviceAddPathPointModel.latitude;
|
||||||
@@ -106,20 +117,26 @@ class NetMessageDispatcher {
|
|||||||
debugPrint("准确更新完成的路径点经纬度,$d,$e");
|
debugPrint("准确更新完成的路径点经纬度,$d,$e");
|
||||||
//去除上一条数据
|
//去除上一条数据
|
||||||
queue.removeFirst();
|
queue.removeFirst();
|
||||||
|
|
||||||
|
|
||||||
/// _pathPlanningService.updateQueue(queue as List<DeviceAddPathPointModel>);
|
/// _pathPlanningService.updateQueue(queue as List<DeviceAddPathPointModel>);
|
||||||
_pathPlanningService.updateQueue(queue.toList());
|
_pathPlanningService.updateQueue(queue.toList());
|
||||||
debugPrint('📡 [Dispatcher] 准备触发下一个路径点发送,队列剩余:${queue.length}');
|
DateTime now = DateTime.now();
|
||||||
|
String timeStr = "${now.hour.toString().padLeft(2, '0')}:"
|
||||||
|
"${now.minute.toString().padLeft(2, '0')}:"
|
||||||
|
"${now.second.toString().padLeft(2, '0')}";
|
||||||
|
|
||||||
|
debugPrint('📡${timeStr} [Dispatcher] 准备触发下一个路径点发送,队列剩余:${queue.length}');
|
||||||
///如果还剩0个数据 就停止发送
|
///如果还剩0个数据 就停止发送
|
||||||
if (queue.length==0) {
|
if (queue.length==0) {
|
||||||
debugPrint('⚠️ [Dispatcher] 队列已空,停止发送');
|
debugPrint('⚠️ [Dispatcher] 队列已空,停止发送');
|
||||||
|
|
||||||
// final devicesCubit = sl<DevicesCubit>();
|
// final devicesCubit = sl<DevicesCubit>();
|
||||||
devicesCubit.finishWork();
|
devicesCubit.finishWork();
|
||||||
Future.delayed(Duration(seconds: 1), () {
|
Future.delayed(Duration(seconds: 1), () {
|
||||||
devicesCubit.resetWorkStatus();
|
devicesCubit.resetWorkStatus();
|
||||||
});
|
});
|
||||||
|
// 手动停止
|
||||||
|
routePlanningRepository.stopRoutePlanning();
|
||||||
|
debugPrint('⚠️ [Dispatcher] 队列已空,发送停止指令已发送');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
routePlanningRepository.startRoutePlanning(queue);
|
routePlanningRepository.startRoutePlanning(queue);
|
||||||
|
|||||||
@@ -70,8 +70,11 @@ class PathPlanningService {
|
|||||||
int get length => locationQueue.length;
|
int get length => locationQueue.length;
|
||||||
|
|
||||||
/// 获取当前队列(供 Cubit 使用)
|
/// 获取当前队列(供 Cubit 使用)
|
||||||
Queue<DeviceAddPathPointModel> getQueue() {
|
// Queue<DeviceAddPathPointModel> getQueue() {
|
||||||
return Queue.of(locationQueue);
|
// return Queue.of(locationQueue);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
Queue<DeviceAddPathPointModel> getQueue() {
|
||||||
|
return locationQueue; // 直接返回引用
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user