class StockInDataXuGong { String goodsId = ""; // 物料号 int goodsNum = 0; // 物料数量 String listId = ""; // 单据号 int orderType = 0; // 单据类型 String customerName = ""; // 客户名称 String goodsDesc = ""; // 物料描述 double weight = 0; // 重量 int size = 0; // 尺寸 String unit = ""; // 单位 String spare1 = ""; // 备用1 String spare2 = ""; // 备用2 StockInDataXuGong({ required this.goodsId, required this.goodsNum, required this.orderType, required this.goodsDesc, required this.weight, required this.size, required this.customerName, required this.spare1, required this.spare2, required this.listId, required this.unit, }); // Updated fromJson method factory StockInDataXuGong.fromJson(Map json) { return StockInDataXuGong( customerName: json["customerName"] ?? "", listId: json["listId"] ?? "", goodsId: json["goodsId"] ?? "", goodsNum: json["goodsNum"] ?? 10.0, orderType: json["orderType"] ?? 0, goodsDesc: json["goodsDesc"] ?? "", spare1: json["spare1"] ?? "", spare2: json["spare2"] ?? "", weight: json["weight"] ?? 10.0, size: json["size"] ?? "50", unit: json["unit"] ?? "", ); } // 实现 toJson 方法 Map toJson() { return { "listId": listId, "orderType": orderType, "goodsId": goodsId, "goodsNum": goodsNum, "goodsDesc": goodsDesc, "spare1": spare1, "spare2": spare2, "weight": weight, "customerName": customerName, "size": size, "unit": unit, }; } }