feat(android): add FJ- attachment code type to CodeParser
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,9 @@ 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 _attachmentRegex = RegExp(
|
||||
r'^FJ-(\d{2}(B|C|T)\d+|\d{2}(BW|CW)\d{4})$',
|
||||
);
|
||||
|
||||
static ParseResult parse(String code) {
|
||||
final trimmed = code.trim();
|
||||
@@ -10,6 +13,10 @@ class CodeParser {
|
||||
return ParseResult(type: CodeType.invalid, value: code);
|
||||
}
|
||||
final normalized = trimmed.toUpperCase();
|
||||
if (_attachmentRegex.hasMatch(normalized)) {
|
||||
final zongpai = normalized.substring(3); // strip "FJ-"
|
||||
return ParseResult(type: CodeType.attachmentCode, value: zongpai);
|
||||
}
|
||||
if (_transitRegex.hasMatch(normalized)) {
|
||||
return ParseResult(type: CodeType.locationTransit, value: normalized);
|
||||
}
|
||||
@@ -36,6 +43,7 @@ class CodeParser {
|
||||
|
||||
enum CodeType {
|
||||
zongpaiNo,
|
||||
attachmentCode,
|
||||
locationNormal,
|
||||
locationTransit,
|
||||
locationTempStorage,
|
||||
|
||||
Reference in New Issue
Block a user