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

@@ -1,14 +1,8 @@
// lib/services/code_parser.dart
class CodeParser {
static final _zongpaiRegex = RegExp(
r'^\d{2}(B|C|T)\d+$|^\d{2}(BW|CW)\d{4}$',
);
static final _locationRegex = RegExp(
r'^[A-Z0-9]+-[A-Z0-9]+-[A-Z0-9]+$',
);
static final _transitRegex = RegExp(
r'^TRANS-',
);
static final _zongpaiRegex = RegExp(r'^\d{2}(B|C|T)\d+$|^\d{2}(BW|CW)\d{4}$');
static final _locationRegex = RegExp(r'^[A-Z0-9]+-[A-Z0-9]+-[A-Z0-9]+$');
static final _transitRegex = RegExp(r'^TRANS-');
static ParseResult parse(String code) {
final trimmed = code.trim();
@@ -23,16 +17,30 @@ class CodeParser {
return ParseResult(type: CodeType.zongpaiNo, value: normalized);
}
if (_locationRegex.hasMatch(normalized)) {
if (normalized.startsWith('B')) {
return ParseResult(
type: CodeType.locationTempStorage,
value: normalized,
);
}
return ParseResult(type: CodeType.locationNormal, value: normalized);
}
return ParseResult(type: CodeType.invalid, value: code);
}
static bool isLocation(CodeType type) =>
type == CodeType.locationNormal || type == CodeType.locationTransit;
type == CodeType.locationNormal ||
type == CodeType.locationTransit ||
type == CodeType.locationTempStorage;
}
enum CodeType { zongpaiNo, locationNormal, locationTransit, invalid }
enum CodeType {
zongpaiNo,
locationNormal,
locationTransit,
locationTempStorage,
invalid,
}
class ParseResult {
final CodeType type;

View File

@@ -8,13 +8,20 @@ bool isTransitTarget(CodeType? locationType, String? locationCode) {
(locationCode?.startsWith('TRANS-') ?? false);
}
bool isTempStorageTarget(CodeType? locationType, String? locationCode) {
return locationType == CodeType.locationTempStorage ||
(locationCode?.startsWith('B') ?? false);
}
String registrationSubmitLabel({
required bool isTransitTarget,
required bool isMultiCode,
required int zongpaiCount,
}) {
if (!isTransitTarget) {
return isMultiCode && zongpaiCount > 1 ? '批量上架($zongpaiCount 条)' : '确 认 上 架';
return isMultiCode && zongpaiCount > 1
? '批量上架($zongpaiCount 条)'
: '确 认 上 架';
}
return isMultiCode && zongpaiCount > 1 ? '批量转运并凑箱($zongpaiCount 条)' : '转运并装箱';
}