Files
fcs/lib/domain/entities/box.dart
Thinzar Win 4862f1123d update boxes
2020-10-14 16:53:16 +06:30

96 lines
2.0 KiB
Dart

import 'package:fcs/domain/vo/shipment_status.dart';
import 'package:fcs/domain/vo/delivery_address.dart';
import 'cargo.dart';
import 'package.dart';
class Box {
String id;
String shipmentNumber;
String senderFCSID;
String senderName;
String receiverFCSID;
String receiverName;
String receiverAddress;
String receiverNumber;
String boxNumber;
String status;
String cargoDesc;
String desc;
int width;
int height;
int length;
int shipmentWeight;
bool isChecked;
String cartonType;
String fcsID;
String userName;
int rate;
int weight;
String packageType;
String pickUpID;
List<String> photos;
String remark;
DateTime arrivedDate;
List<Package> packages;
List<Cargo> cargoTypes;
DeliveryAddress shippingAddress;
int get amount => rate != null && weight != null ? rate * weight : 0;
String get packageNumber =>
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
double get price => rate.toDouble() * weight;
double getShipmentWeight(double volumetricRatio) {
if (length == null ||
length <= 0 ||
width == null ||
width <= 0 ||
height == null ||
height <= 0 ||
volumetricRatio == null ||
volumetricRatio <= 0) return 0;
return (length * width * height) / volumetricRatio;
}
List<ShipmentStatus> shipmentHistory;
Box(
{this.id,
this.shipmentNumber,
this.senderFCSID,
this.senderName,
this.receiverFCSID,
this.receiverName,
this.receiverNumber,
this.receiverAddress,
this.boxNumber,
this.desc,
this.width,
this.height,
this.length,
this.shipmentWeight,
this.isChecked = false,
this.cartonType,
this.fcsID,
this.userName,
this.rate,
this.weight,
this.packageType,
this.pickUpID,
this.remark,
this.status,
this.arrivedDate,
this.cargoDesc,
this.shipmentHistory,
this.packages,
this.cargoTypes,
this.shippingAddress});
}