XuGongTeJi_flutter/lib/model/bo/stock_in_data_xugong.dart

128 lines
3.8 KiB
Dart
Raw Normal View History

2025-02-23 16:19:27 +08:00
import 'package:intl/intl.dart';
2025-02-19 18:52:05 +08:00
class StockInDataXuGong {
2025-02-23 16:19:27 +08:00
String recordId = "";
String listId = "";
2025-02-22 15:56:40 +08:00
String orderType = ""; // 单据类型
2025-02-23 16:19:27 +08:00
String customerId = "";
String orderId = "test"; // 单据号
String vehicleNo = "";
String goodsId = ""; // 物料号
int goodsNum = 0; // 物料数量
String goodsCode = "";
2025-02-22 15:56:40 +08:00
String goodsDesc = ""; // 物料描述
2025-02-23 16:19:27 +08:00
String unit = "";
String spare1 = ""; // 备用1
String spare2 = ""; // 备用2
int status = 0;
int storageType = 0;
String createPerson = "empty";
String remark = "test";
DateTime createTime = DateTime.now();
DateTime updateTime = DateTime.now();
2025-02-22 15:56:40 +08:00
double weight = 0; // 重量
2025-02-23 16:19:27 +08:00
String customerName = ""; // 客户名称
2025-02-22 15:56:40 +08:00
String size = ""; // 尺寸
String containerNo = ""; // 容器号
2025-02-19 18:52:05 +08:00
StockInDataXuGong({
2025-02-23 16:19:27 +08:00
required this.recordId,
2025-02-19 18:52:05 +08:00
required this.goodsId,
required this.goodsNum,
2025-02-23 16:19:27 +08:00
required this.orderId,
2025-02-19 18:52:05 +08:00
required this.orderType,
required this.goodsDesc,
required this.weight,
required this.size,
2025-02-23 16:19:27 +08:00
required this.customerName,
required this.containerNo,
2025-02-19 18:52:05 +08:00
required this.spare1,
required this.spare2,
2025-02-23 16:19:27 +08:00
required this.vehicleNo,
required this.customerId,
required this.goodsCode,
required this.listId,
required this.unit,
required this.status,
required this.storageType,
required this.createPerson,
required this.remark,
required this.createTime,
required this.updateTime,
2025-02-19 18:52:05 +08:00
});
2025-02-22 15:56:40 +08:00
// Updated fromJson method
factory StockInDataXuGong.fromJson(Map<String, dynamic> json) {
return StockInDataXuGong(
2025-02-23 16:19:27 +08:00
containerNo: json["containerNo"] ?? "0",
customerName: json["customerName"] ?? "",
listId: json["listId"] ?? "",
customerId: json["customerId"] ?? "",
recordId: json["recordId"] ?? "",
goodsId: json["goodsId"] ?? "",
// 物料号
vehicleNo: json["vehicleNo"] ?? "",
// 物料号
goodsNum: json["goodsNum"] ?? 10.0,
// 物料数量
orderId: json["orderId"] ?? "",
// 单据号
orderType: json["orderType"] ?? "",
// 单据类型
goodsCode: json["goodsCode"] ?? "",
// customerName: json["customerName"] ?? "", // 客户名称
goodsDesc: json["goodsDesc"] ?? "",
// 物料描述
// weight: json["weight"]?.toDouble() ?? 0.0, // 重量
// size: json["size"] ?? "", // 尺寸
// containerNo: json["containerNo"] ?? "",
// 容器号
spare1: json["spare1"] ?? "",
// 备用1
spare2: json["spare2"] ?? "",
// 备用2
unit: json["unit"] ?? "",
status: json["status"] ?? 0,
storageType: json["storageType"] ?? 0,
createPerson: json["createPerson"] ?? "",
remark: json["remark"] ?? "",
createTime: json["createTime"] ?? DateTime.now(),
updateTime: json["updateTime"] ?? DateTime.now(),
weight: json["weight"] ?? 10.0,
size: json["size"] ?? "50",
2025-02-22 15:56:40 +08:00
);
}
2025-02-23 16:19:27 +08:00
// 实现 toJson 方法
Map<String, dynamic> toJson() {
String formattedCreateDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(createTime);
String formattedUpdateDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(updateTime);
return {
"recordId": recordId,
"listId": listId,
"orderType": orderType,
"customerId": customerId,
"orderId": orderId,
"vehicleNo": vehicleNo,
"goodsId": goodsId,
"goodsNum": goodsNum,
"goodsCode": goodsCode,
"goodsDesc": goodsDesc,
"unit": unit,
"spare1": spare1,
"spare2": spare2,
"status": status,
"storageType": storageType,
"createPerson": createPerson,
"remark": remark,
"createTime": formattedCreateDate,
"updateTime": formattedUpdateDate,
"weight": weight,
"customerName": customerName,
"size": size,
"containerNo": containerNo,
};
}
2025-02-20 13:23:50 +08:00
}