fix: skip shelf-switch warning when no previous shelf scanned in multi-code mode

In multi-code shelving mode, if the user has scanned zongpai numbers
but hasn't scanned any shelf yet, scanning the first shelf should not
trigger the "switch shelf" warning dialog since there is no existing
shelf to switch from.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-05-21 21:02:22 +08:00
parent 4891fe4dfd
commit 5fc5c7de2b

View File

@@ -60,8 +60,10 @@ extension _RegistrationScanPart on _RegistrationPageState {
} }
void _handleLocationScan(String locationCode, CodeType locationType) { void _handleLocationScan(String locationCode, CodeType locationType) {
// In singleCode mode or no existing data, switch directly // In singleCode mode or no existing data or no previous shelf, switch directly
if (_mode == RegistrationMode.singleCode || _zongpaiNos.isEmpty) { if (_mode == RegistrationMode.singleCode ||
_zongpaiNos.isEmpty ||
_locationCode == null) {
_feedbackService.trigger(FeedbackEvent.scanValid); _feedbackService.trigger(FeedbackEvent.scanValid);
setState(() { setState(() {
_locationCode = locationCode; _locationCode = locationCode;