feat: enhance boxing module with box mode support and fix Android build
- Add box_mode parameter to box submission API for one-to-one/one-to-many/many-to-one modes - Allow re-scan override in one2one mode without clearing state - Improve duplicate detection messages per boxing mode - Disable Kotlin incremental compilation to fix cross-drive build failure Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -155,8 +155,10 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
// 其他模式:等待扫码阶段才处理
|
||||
if (_phase != _Phase.waiting) return;
|
||||
// 一码一箱:允许覆盖,直接查询新二维码(不提前清空状态,避免闪烁)
|
||||
if (_mode != BoxingMode.one2one && _phase != _Phase.waiting) {
|
||||
return;
|
||||
}
|
||||
|
||||
_queryBoxInfo(zongpai);
|
||||
}
|
||||
@@ -276,11 +278,17 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
|
||||
setState(() => _isSubmitting = true);
|
||||
|
||||
final modeStr = switch (_mode) {
|
||||
BoxingMode.one2one => 'one-to-one',
|
||||
BoxingMode.one2many => 'one-to-many',
|
||||
BoxingMode.many2one => 'many-to-one',
|
||||
};
|
||||
final result = await _apiService.saveBoxRecord(
|
||||
baseUrl: baseUrl,
|
||||
zongpaiNo: _zongpaiNo!,
|
||||
boxNo: boxNo,
|
||||
quantity: quantity,
|
||||
boxMode: modeStr,
|
||||
);
|
||||
|
||||
if (!mounted) return;
|
||||
@@ -290,10 +298,14 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
if (result.success) {
|
||||
_onSubmitSuccess(boxNo, quantity);
|
||||
} else if (result.isDuplicate) {
|
||||
_showFeedback(
|
||||
'排产号 ${result.paichanNo ?? ""} 下箱号 ${result.boxNo ?? ""} 已存在',
|
||||
isError: true,
|
||||
);
|
||||
if (_mode == BoxingMode.one2one) {
|
||||
_showFeedback('该总排号已绑定箱号 ${result.boxNo ?? "?"},请勿重复装箱', isError: true);
|
||||
} else {
|
||||
_showFeedback(
|
||||
'排产号 ${result.paichanNo ?? ""} 下箱号 ${result.boxNo ?? ""} 已存在',
|
||||
isError: true,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
_showFeedback(result.errorMessage ?? '提交失败', isError: true);
|
||||
}
|
||||
@@ -305,10 +317,12 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
_lastQuantity = quantity;
|
||||
// 刷新已有箱号列表(将新记录加入本地列表)
|
||||
_existingBoxes = List.from(_existingBoxes)
|
||||
..add(BoxDetailData(
|
||||
boxNo: boxNo,
|
||||
items: [BoxItemData(zongpaiNo: _zongpaiNo!, quantity: quantity)],
|
||||
));
|
||||
..add(
|
||||
BoxDetailData(
|
||||
boxNo: boxNo,
|
||||
items: [BoxItemData(zongpaiNo: _zongpaiNo!, quantity: quantity)],
|
||||
),
|
||||
);
|
||||
_maxBoxNo = _maxBoxNo > boxNo ? _maxBoxNo : boxNo;
|
||||
});
|
||||
|
||||
@@ -440,10 +454,7 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
child: TextButton.icon(
|
||||
onPressed: _cycleMode,
|
||||
icon: const Icon(Icons.swap_horiz, size: 18),
|
||||
label: Text(
|
||||
_modeLabel,
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
label: Text(_modeLabel, style: const TextStyle(fontSize: 13)),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: _mode == BoxingMode.many2one
|
||||
? Colors.orange
|
||||
@@ -704,7 +715,9 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: _maxBoxNo > 0 ? Colors.amber.shade800 : Colors.grey,
|
||||
color: _maxBoxNo > 0
|
||||
? Colors.amber.shade800
|
||||
: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -824,8 +837,9 @@ class _BoxingPageState extends State<BoxingPage> {
|
||||
child: ElevatedButton(
|
||||
onPressed: _canSubmit ? _submit : null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
_canSubmit ? Theme.of(context).colorScheme.primary : Colors.grey.shade300,
|
||||
backgroundColor: _canSubmit
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.grey.shade300,
|
||||
foregroundColor: _canSubmit ? Colors.white : Colors.grey.shade600,
|
||||
),
|
||||
child: _isSubmitting
|
||||
|
||||
Reference in New Issue
Block a user