feat(boxing): update many-to-one packing flow

This commit is contained in:
Misaka_Company
2026-05-13 15:14:14 +08:00
parent b32c9c5aad
commit 396a19ff43
3 changed files with 817 additions and 112 deletions

View File

@@ -54,12 +54,14 @@ class BoxItemData {
final String zongpaiNo;
final String? workOrderNo;
final int quantity;
final int? totalQuantity;
BoxItemData({
this.boxItemId,
required this.zongpaiNo,
this.workOrderNo,
required this.quantity,
this.totalQuantity,
});
factory BoxItemData.fromJson(Map<String, dynamic> json) {
@@ -68,6 +70,7 @@ class BoxItemData {
zongpaiNo: json['zongpai_no'] as String,
workOrderNo: json['work_order_no']?.toString(),
quantity: json['quantity'] as int,
totalQuantity: json['total_quantity'] as int?,
);
}
}
@@ -172,8 +175,10 @@ class BoxSaveResult {
final bool success;
final bool isDuplicate;
final String? errorMessage;
final String? errorCode;
final int? boxItemId;
final String? paichanNo;
final String? zongpaiNo;
final int? boxNo;
final int? quantity;
@@ -181,8 +186,10 @@ class BoxSaveResult {
required this.success,
this.isDuplicate = false,
this.errorMessage,
this.errorCode,
this.boxItemId,
this.paichanNo,
this.zongpaiNo,
this.boxNo,
this.quantity,
});
@@ -192,6 +199,7 @@ class BoxSaveResult {
success: true,
boxItemId: json['box_item_id'] as int?,
paichanNo: json['paichan_no'] as String?,
zongpaiNo: json['zongpai_no'] as String?,
boxNo: json['box_no'] as int?,
quantity: json['quantity'] as int?,
);
@@ -201,7 +209,10 @@ class BoxSaveResult {
return BoxSaveResult(
success: false,
isDuplicate: true,
errorCode: json['error_code']?.toString(),
errorMessage: json['message']?.toString(),
paichanNo: json['paichan_no'] as String?,
zongpaiNo: json['zongpai_no'] as String?,
boxNo: json['box_no'] as int?,
);
}
@@ -358,6 +369,7 @@ class ApiService {
required int boxItemId,
required int boxNo,
required int quantity,
String boxMode = 'one-to-many',
}) async {
final uri = Uri.parse('$baseUrl/CargoTrace/box/$boxItemId');
try {
@@ -368,7 +380,7 @@ class ApiService {
body: jsonEncode({
'box_no': boxNo,
'quantity': quantity,
'box_mode': 'one-to-many',
'box_mode': boxMode,
}),
)
.timeout(timeout);