feat: extend boxing page for accessory boxing support
Add pending accessories section to both single-code and multi-code boxing modes. Accessories display with orange styling and a "加入本箱" button that calls saveBoxRecord with item_type=accessory. Extend API service with PendingAccessory model, itemType fields on data classes, and optional accessory_id parameter on saveBoxRecord. Show accessories with visual indicator (wrench icon + orange background) in boxing detail page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -158,4 +158,47 @@ extension _BoxingSubmitPart on _BoxingPageState {
|
||||
const Duration(milliseconds: 1500),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _submitAccessory(PendingAccessory accessory) async {
|
||||
if (_zongpaiNo == null || _isSubmitting) return;
|
||||
|
||||
final boxNo = int.tryParse(_boxNoController.text);
|
||||
if (boxNo == null || boxNo <= 0) {
|
||||
this._showStatusOverride(
|
||||
'请先输入有效箱号',
|
||||
StatusDotColor.red,
|
||||
const Duration(seconds: 2),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => _isSubmitting = true);
|
||||
|
||||
final action = await _apiActions.saveBoxRecord(
|
||||
zongpaiNo: _zongpaiNo!,
|
||||
boxNo: boxNo,
|
||||
quantity: accessory.quantity,
|
||||
itemType: 'accessory',
|
||||
accessoryId: accessory.accessoryId,
|
||||
);
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() => _isSubmitting = false);
|
||||
|
||||
if (action.success) {
|
||||
_feedbackService.trigger(FeedbackEvent.submitSuccess);
|
||||
// Refresh box info to update pending accessories
|
||||
await this._queryBoxInfo(_zongpaiNo!);
|
||||
if (mounted) {
|
||||
this._showStatusOverride(
|
||||
'${accessory.accessoryType} 已加入箱号 $boxNo',
|
||||
StatusDotColor.green,
|
||||
const Duration(milliseconds: 1500),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
this._showActionError(action, fallback: '附件装箱失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user