fix: increment new box number from max box number after completing current box
Unify optimization for single-code and multi-code boxing modes: after completing a box, set the next box number to max(existing boxes) + 1, avoiding duplicate box numbers when browsing historical boxes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -701,7 +701,7 @@ class _BoxingPageState extends State<BoxingPage> with WidgetsBindingObserver {
|
||||
} else {
|
||||
setState(() {
|
||||
_phase = _Phase.scanned;
|
||||
_boxNoController.text = (boxNo + 1).toString();
|
||||
_boxNoController.text = (_maxBoxNo + 1).toString();
|
||||
_quantityController.text = remaining.toString();
|
||||
_quantityController.selection = TextSelection(
|
||||
baseOffset: 0,
|
||||
@@ -846,7 +846,6 @@ class _BoxingPageState extends State<BoxingPage> with WidgetsBindingObserver {
|
||||
}
|
||||
|
||||
void _finishManyToOneBox() {
|
||||
final currentBoxNo = int.tryParse(_boxNoController.text.trim());
|
||||
setState(() {
|
||||
_manyToOnePackedItems.clear();
|
||||
_editingPackedItemId = null;
|
||||
@@ -855,9 +854,7 @@ class _BoxingPageState extends State<BoxingPage> with WidgetsBindingObserver {
|
||||
_zongpaiNo = null;
|
||||
_phase = _Phase.waiting;
|
||||
_quantityController.clear();
|
||||
if (currentBoxNo != null && currentBoxNo > 0) {
|
||||
_boxNoController.text = (currentBoxNo + 1).toString();
|
||||
}
|
||||
_boxNoController.text = (_maxBoxNo + 1).toString();
|
||||
_statusOverrideText = null;
|
||||
_statusOverrideDot = null;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user