feat: allow on_shelf items in transit batch transfer

Transit shelf registration is effectively an off-shelf operation. Allow
not_shelved, on_shelf, and their mix when target is a transit shelf.
Only transferred items are blocked since they are already in transit.

Also fix conflict color logic: transferred items now correctly show as
red (conflict) for both transit and normal shelf targets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-05-21 21:39:44 +08:00
parent 5fc5c7de2b
commit 4e8be6a684
2 changed files with 13 additions and 11 deletions

View File

@@ -19,15 +19,15 @@ extension _RegistrationSubmitPart on _RegistrationPageState {
setState(() => _isSubmitting = true);
// For transit target: block if any scanned item already has a location
// For transit target: block if any scanned item is already transferred
// (on_shelf items are allowed — transit registration acts as off-shelf)
if (_isTransitTarget) {
if (_hasAnyLocatedInScanned()) {
final onShelfItems = _findOnShelfItemsInScanned();
final transferredItems = _findTransferredItemsInScanned();
final transferredItems = _findTransferredItemsInScanned();
if (transferredItems.isNotEmpty) {
setState(() => _isSubmitting = false);
_feedbackService.trigger(FeedbackEvent.submitFailure);
_showLocationConflictDialog(
onShelfItems: onShelfItems,
onShelfItems: [],
transferredItems: transferredItems,
);
return;

View File

@@ -110,9 +110,10 @@ Color registrationBarColor({
required bool isTransitTarget,
}) {
if (isScanned) {
return status == 'on_shelf' && !isTransitTarget
? Colors.red
: const Color(0xFF43A047);
final isConflict = isTransitTarget
? status == 'transferred'
: (status == 'on_shelf' || status == 'transferred');
return isConflict ? Colors.red : const Color(0xFF43A047);
}
switch (status) {
@@ -131,9 +132,10 @@ Color registrationRowBgColor({
required bool isTransitTarget,
}) {
if (isScanned) {
return status == 'on_shelf' && !isTransitTarget
? Colors.red.shade50
: const Color(0xFFF1F8E9);
final isConflict = isTransitTarget
? status == 'transferred'
: (status == 'on_shelf' || status == 'transferred');
return isConflict ? Colors.red.shade50 : const Color(0xFFF1F8E9);
}
switch (status) {