update cargo type input, add package count and carton count for shipment info

This commit is contained in:
tzw
2025-03-26 15:51:47 +06:30
parent db3e290546
commit 17ca3e2a3f
11 changed files with 156 additions and 53 deletions

View File

@@ -314,4 +314,30 @@ class FcsShipmentModel extends BaseModel {
}
return fcsShipments;
}
Future<int?> getPackageCount({required String fcsShipmentId}) async {
String path = "/$packages_collection";
AggregateQuerySnapshot query = await FirebaseFirestore.instance
.collection(path)
.where("fcs_shipment_id", isEqualTo: fcsShipmentId)
.where("delete_time", isEqualTo: 0)
.count()
.get();
return query.count;
}
Future<int?> getCartonCount({required String fcsShipmentId}) async {
String path = "/$cartons_collection";
AggregateQuerySnapshot query = await FirebaseFirestore.instance
.collection(path)
.where("fcs_shipment_id", isEqualTo: fcsShipmentId)
.where("delete_time", isEqualTo: 0)
.count()
.get();
return query.count;
}
}