feat: add temp storage shelf (B prefix) UI support

Recognize B-prefix location codes as temp storage shelves. Add purple
color scheme, conflict detection for temp_stored status, and updated
submit/dialog logic for temp storage target handling.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-05-25 22:48:29 +08:00
parent f6bfd8cb10
commit 99ed3bb9ec
9 changed files with 125 additions and 15 deletions

View File

@@ -19,6 +19,14 @@ extension _RegistrationOverviewPart on _RegistrationPageState {
);
}
/// Find all scanned items that are in temp storage.
List<PaichaOverviewItem> _findTempStoredItemsInScanned() {
return registration_calculations.findTempStoredItemsInScanned(
overview: _overview,
zongpaiNos: _zongpaiNos,
);
}
Future<String?> _baseUrl() async {
final configService = AppConfigService();
final baseUrl = await configService.getString('api_url') ?? '';

View File

@@ -48,6 +48,7 @@ extension _RegistrationScanPart on _RegistrationPageState {
_handleZongpaiScan(parsed.value);
case CodeType.locationNormal:
case CodeType.locationTransit:
case CodeType.locationTempStorage:
_handleLocationScan(parsed.value, parsed.type);
case CodeType.invalid:
_feedbackService.trigger(FeedbackEvent.scanInvalid);

View File

@@ -52,4 +52,7 @@ extension _RegistrationStatusPart on _RegistrationPageState {
_zongpaiNos.isNotEmpty && _locationCode != null && !_isSubmitting;
bool get _isTransitTarget => isTransitTarget(_locationType, _locationCode);
bool get _isTempStorageTarget =>
isTempStorageTarget(_locationType, _locationCode);
}

View File

@@ -34,6 +34,23 @@ extension _RegistrationSubmitPart on _RegistrationPageState {
}
}
// For temp storage target: block if any scanned item is transferred or temp_stored
// (on_shelf items are allowed — temp storage acts as shelf change)
if (_isTempStorageTarget) {
final transferredItems = _findTransferredItemsInScanned();
final tempStoredItems = _findTempStoredItemsInScanned();
if (transferredItems.isNotEmpty || tempStoredItems.isNotEmpty) {
setState(() => _isSubmitting = false);
_feedbackService.trigger(FeedbackEvent.submitFailure);
_showLocationConflictDialog(
onShelfItems: [],
transferredItems: transferredItems,
tempStoredItems: tempStoredItems,
);
return;
}
}
if (_mode == RegistrationMode.multiCode && _zongpaiNos.length > 1) {
if (_isTransitTarget && !await _ensureBatchSamePaicha(baseUrl)) {
if (!mounted) return;
@@ -47,7 +64,7 @@ extension _RegistrationSubmitPart on _RegistrationPageState {
return;
}
// Pre-check: block entire batch if any item already has a location binding
if (!_isTransitTarget) {
if (!_isTransitTarget && !_isTempStorageTarget) {
final onShelfItems = _findOnShelfItemsInScanned();
final transferredItems = _findTransferredItemsInScanned();
if (onShelfItems.isNotEmpty || transferredItems.isNotEmpty) {
@@ -117,13 +134,15 @@ extension _RegistrationSubmitPart on _RegistrationPageState {
}
setState(() {
_zongpaiNos.remove(zongpaiNo);
if (_mode == RegistrationMode.singleCode) {
if (_mode == RegistrationMode.singleCode && !_isTempStorageTarget) {
_locationCode = null;
_locationType = null;
}
});
final msg = result.isOffShelfSuccess
? '下架成功'
: _isTempStorageTarget
? '变更货架成功'
: (_mode == RegistrationMode.multiCode ? '多码上架模式,请扫描下一张执行卡' : '上架成功');
_showStatusOverride(
msg,