feat(android): add attachment boxing FJ- scan and submit
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,53 @@ extension _BoxingSubmitPart on _BoxingPageState {
|
||||
Future<bool> _submit() async {
|
||||
if (!_canSubmit) return false;
|
||||
|
||||
final attachCatId = _attachmentCategoryId;
|
||||
if (attachCatId != null) {
|
||||
// Attachment boxing submit
|
||||
setState(() => _isSubmitting = true);
|
||||
final action = await _apiActions.saveAttachmentBox(
|
||||
zongpaiNo: _zongpaiNo!,
|
||||
categoryId: attachCatId,
|
||||
boxNo: int.parse(_boxNoController.text),
|
||||
quantity: int.parse(_quantityController.text),
|
||||
);
|
||||
if (!mounted) return false;
|
||||
setState(() => _isSubmitting = false);
|
||||
|
||||
if (action.success) {
|
||||
_feedbackService.trigger(FeedbackEvent.submitSuccess);
|
||||
// Reset to waiting for next scan
|
||||
setState(() {
|
||||
_zongpaiNo = null;
|
||||
_phase = BoxingPhase.waiting;
|
||||
_attachmentCategoryId = null;
|
||||
_attachmentCategoryName = null;
|
||||
});
|
||||
_showStatusOverride(
|
||||
'附件装箱成功',
|
||||
StatusDotColor.green,
|
||||
const Duration(milliseconds: 1500),
|
||||
);
|
||||
_requestFocus();
|
||||
return true;
|
||||
} else if (action.errorKind == BoxingActionErrorKind.duplicate) {
|
||||
_feedbackService.trigger(FeedbackEvent.duplicateBoxNo);
|
||||
_showStatusOverride(
|
||||
action.errorMessage ?? '该箱号已存在同类型附件',
|
||||
StatusDotColor.red,
|
||||
const Duration(seconds: 2),
|
||||
);
|
||||
} else {
|
||||
_feedbackService.trigger(FeedbackEvent.submitFailure);
|
||||
_showStatusOverride(
|
||||
action.errorMessage ?? '提交失败',
|
||||
StatusDotColor.red,
|
||||
const Duration(seconds: 2),
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
final boxNo = int.parse(_boxNoController.text);
|
||||
final quantity = int.parse(_quantityController.text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user