ce1cbf404c
后端: - fix(backend): InventoryLog 增加 Product/Warehouse 关联,Logs 接口加 Preload 修复流水记录显示"-" - feat(backend): 新增 /inventory/batches 批次追踪接口 - feat(backend): 新增财务记录、编号规则接口(finance、number_rule handler) - fix(backend): service/stock_test.go 修复 model.Date 类型错误 前端: - feat(client): 入库/出库管理 Tab 调换顺序(审核在前),审核 Tab 加新建按钮,列表 Tab 无按钮 - feat(client): 入库单/出库单增加详情弹窗,显示完整单据信息和商品明细 - feat(client): 完善出库单新建表单(StockOutFormScreen),支持选客户/仓库/商品 - fix(client): StockInItem/StockOutItem.fromJson 修复读取嵌套 product 对象而非平铺字段 - feat(client): 批次追踪页面(BatchTrackingScreen)及侧边栏入口 - feat(client): 财务管理、盘点、编号规则接入真实后端 API - fix(client): 入库/出库审核通过后 invalidate inventoryListProvider 刷新库存 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
97 lines
3.1 KiB
Dart
97 lines
3.1 KiB
Dart
class StockOutItem {
|
|
final int? orderId;
|
|
final int productId;
|
|
final double quantity;
|
|
final double unitPrice;
|
|
final double totalPrice;
|
|
final String? productName;
|
|
final String? productCode;
|
|
final String? productSpec;
|
|
final String? productUnit;
|
|
|
|
const StockOutItem({
|
|
this.orderId,
|
|
required this.productId,
|
|
required this.quantity,
|
|
required this.unitPrice,
|
|
required this.totalPrice,
|
|
this.productName,
|
|
this.productCode,
|
|
this.productSpec,
|
|
this.productUnit,
|
|
});
|
|
|
|
factory StockOutItem.fromJson(Map<String, dynamic> json) => StockOutItem(
|
|
orderId: json['order_id'] != null
|
|
? (json['order_id'] as num).toInt()
|
|
: null,
|
|
productId: (json['product_id'] as num).toInt(),
|
|
quantity: (json['quantity'] as num).toDouble(),
|
|
unitPrice: (json['unit_price'] as num).toDouble(),
|
|
totalPrice: (json['total_price'] as num).toDouble(),
|
|
productName: (json['product'] as Map<String, dynamic>?)?['name'] as String?,
|
|
productCode: (json['product'] as Map<String, dynamic>?)?['code'] as String?,
|
|
productSpec: (json['product'] as Map<String, dynamic>?)?['spec'] as String?,
|
|
productUnit: (json['product'] as Map<String, dynamic>?)?['unit'] as String?,
|
|
);
|
|
}
|
|
|
|
class StockOutOrder {
|
|
final int id;
|
|
final String orderNo;
|
|
final String? type;
|
|
final int warehouseId;
|
|
final String? warehouseName;
|
|
final int? partnerId;
|
|
final String? partnerName;
|
|
final int? operatorId;
|
|
final String status; // draft | pending | approved | rejected
|
|
final String? orderDate;
|
|
final double? totalAmount;
|
|
final String? remark;
|
|
final List<StockOutItem> items;
|
|
|
|
const StockOutOrder({
|
|
required this.id,
|
|
required this.orderNo,
|
|
this.type,
|
|
required this.warehouseId,
|
|
this.warehouseName,
|
|
this.partnerId,
|
|
this.partnerName,
|
|
this.operatorId,
|
|
required this.status,
|
|
this.orderDate,
|
|
this.totalAmount,
|
|
this.remark,
|
|
this.items = const [],
|
|
});
|
|
|
|
factory StockOutOrder.fromJson(Map<String, dynamic> json) => StockOutOrder(
|
|
id: (json['id'] as num).toInt(),
|
|
orderNo: json['order_no'] as String,
|
|
type: json['type'] as String?,
|
|
warehouseId: (json['warehouse_id'] as num).toInt(),
|
|
warehouseName: (json['warehouse'] as Map<String, dynamic>?)?['name'] as String?,
|
|
partnerId: json['partner_id'] != null
|
|
? (json['partner_id'] as num).toInt()
|
|
: null,
|
|
partnerName: (json['partner'] as Map<String, dynamic>?)?['name'] as String?,
|
|
operatorId: json['operator_id'] != null
|
|
? (json['operator_id'] as num).toInt()
|
|
: null,
|
|
status: json['status'] as String,
|
|
orderDate: json['order_date'] as String?,
|
|
totalAmount: json['total_amount'] != null
|
|
? (json['total_amount'] as num).toDouble()
|
|
: null,
|
|
remark: json['remark'] as String?,
|
|
items: json['items'] != null
|
|
? (json['items'] as List)
|
|
.map((e) =>
|
|
StockOutItem.fromJson(e as Map<String, dynamic>))
|
|
.toList()
|
|
: [],
|
|
);
|
|
}
|