aaa
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/// Request model for getting product details in a warehouse
|
||||
///
|
||||
/// Used to fetch product stage information for a specific warehouse and product
|
||||
class ProductDetailRequestModel {
|
||||
final int warehouseId;
|
||||
final int productId;
|
||||
|
||||
const ProductDetailRequestModel({
|
||||
required this.warehouseId,
|
||||
required this.productId,
|
||||
});
|
||||
|
||||
/// Convert to JSON for API request
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'WareHouseId': warehouseId,
|
||||
'ProductId': productId,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProductDetailRequestModel(warehouseId: $warehouseId, productId: $productId)';
|
||||
}
|
||||
}
|
||||
67
lib/features/products/data/models/product_stage_model.dart
Normal file
67
lib/features/products/data/models/product_stage_model.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import '../../domain/entities/product_stage_entity.dart';
|
||||
|
||||
/// Product stage model for data layer
|
||||
/// Represents a product at a specific production stage
|
||||
class ProductStageModel extends ProductStageEntity {
|
||||
const ProductStageModel({
|
||||
required super.productId,
|
||||
required super.productStageId,
|
||||
required super.actionTypeId,
|
||||
required super.passedQuantity,
|
||||
required super.issuedQuantity,
|
||||
required super.issuedQuantityWeight,
|
||||
required super.passedQuantityWeight,
|
||||
required super.stageName,
|
||||
required super.createdDate,
|
||||
});
|
||||
|
||||
/// Create ProductStageModel from JSON
|
||||
factory ProductStageModel.fromJson(Map<String, dynamic> json) {
|
||||
return ProductStageModel(
|
||||
productId: json['ProductId'] as int,
|
||||
productStageId: json['ProductStageId'] as int?,
|
||||
actionTypeId: json['ActionTypeId'] as int?,
|
||||
passedQuantity: json['PassedQuantity'] as int,
|
||||
issuedQuantity: json['IssuedQuantity'] as int,
|
||||
issuedQuantityWeight: (json['IssuedQuantityWeight'] as num).toDouble(),
|
||||
passedQuantityWeight: (json['PassedQuantityWeight'] as num).toDouble(),
|
||||
stageName: json['StageName'] as String?,
|
||||
createdDate: json['CreatedDate'] as String,
|
||||
);
|
||||
}
|
||||
|
||||
/// Convert to JSON
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'ProductId': productId,
|
||||
'ProductStageId': productStageId,
|
||||
'ActionTypeId': actionTypeId,
|
||||
'PassedQuantity': passedQuantity,
|
||||
'IssuedQuantity': issuedQuantity,
|
||||
'IssuedQuantityWeight': issuedQuantityWeight,
|
||||
'PassedQuantityWeight': passedQuantityWeight,
|
||||
'StageName': stageName,
|
||||
'CreatedDate': createdDate,
|
||||
};
|
||||
}
|
||||
|
||||
/// Convert to entity
|
||||
ProductStageEntity toEntity() {
|
||||
return ProductStageEntity(
|
||||
productId: productId,
|
||||
productStageId: productStageId,
|
||||
actionTypeId: actionTypeId,
|
||||
passedQuantity: passedQuantity,
|
||||
issuedQuantity: issuedQuantity,
|
||||
issuedQuantityWeight: issuedQuantityWeight,
|
||||
passedQuantityWeight: passedQuantityWeight,
|
||||
stageName: stageName,
|
||||
createdDate: createdDate,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ProductStageModel(productId: $productId, stageName: $stageName, passedQuantity: $passedQuantity)';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user