feat: 重构局域网数据同步与物理药瓶生命周期(Bottle Entity),实现开新瓶、软删除与多端精确余量核算

This commit is contained in:
shen
2026-10-27 22:42:44 -07:00
parent 065e219a83
commit 89ab13ecf5
9 changed files with 699 additions and 208 deletions
+8 -2
View File
@@ -313,14 +313,20 @@ class ActiveSessionService extends ChangeNotifier {
}
}
final activeFlix = storageService.getActiveFlixotideBottle();
final activeVent = storageService.getActiveVentolinBottle();
final record = DoseRecord(
id: const Uuid().v4(),
startTime: _sessionStartTime ?? DateTime.now(),
endTime: _sessionEndTime ?? DateTime.now(),
startTime: (_sessionStartTime ?? DateTime.now()).toUtc(),
endTime: (_sessionEndTime ?? DateTime.now()).toUtc(),
flixotidePuffs: totalFlixotide,
ventolinPuffs: totalVentolin,
flixotideBottleId: totalFlixotide > 0 ? activeFlix?.id : null,
ventolinBottleId: totalVentolin > 0 ? activeVent?.id : null,
rinsedMouth: _rinsedMouth,
washedFace: _washedFace,
updatedAt: DateTime.now().toUtc(),
);
await storageService.addRecord(record);