add shipment in processing, update package, processing and receiving
This commit is contained in:
@@ -18,6 +18,7 @@ class FcsShipment {
|
||||
String? reportName;
|
||||
int packageCount;
|
||||
int cartonCount;
|
||||
DateTime? processingDate;
|
||||
|
||||
FcsShipment(
|
||||
{this.id,
|
||||
@@ -36,7 +37,8 @@ class FcsShipment {
|
||||
this.destinationPortName,
|
||||
this.reportName,
|
||||
this.packageCount = 0,
|
||||
this.cartonCount = 0});
|
||||
this.cartonCount = 0,
|
||||
this.processingDate});
|
||||
|
||||
factory FcsShipment.fromMap(Map<String, dynamic> map, String docID) {
|
||||
var cutoffDate =
|
||||
@@ -44,6 +46,10 @@ class FcsShipment {
|
||||
var arrivalDate =
|
||||
map['eta_date'] == null ? null : (map['eta_date'] as Timestamp);
|
||||
|
||||
var processingDate = map['processing_date'] == null
|
||||
? null
|
||||
: (map['processing_date'] as Timestamp);
|
||||
|
||||
return FcsShipment(
|
||||
id: docID,
|
||||
cutoffDate: cutoffDate?.toDate(),
|
||||
@@ -59,7 +65,8 @@ class FcsShipment {
|
||||
destinationPortId: map['destination_port_id'],
|
||||
destinationPortName: map['destination_port_name'],
|
||||
packageCount: map['package_count'] ?? 0,
|
||||
cartonCount: map['carton_count'] ?? 0);
|
||||
cartonCount: map['carton_count'] ?? 0,
|
||||
processingDate: processingDate?.toDate());
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
|
||||
@@ -7,21 +7,25 @@ import 'package:fcs/domain/vo/shipment_status.dart';
|
||||
class Package {
|
||||
String? id;
|
||||
String? trackingID;
|
||||
String? userID;
|
||||
String? fcsID;
|
||||
String? userName;
|
||||
String? phoneNumber;
|
||||
DateTime? currentStatusDate;
|
||||
List<String> photoUrls;
|
||||
List<ShipmentStatus> shipmentHistory;
|
||||
List<String> cartonIds;
|
||||
String? desc;
|
||||
|
||||
String? status;
|
||||
|
||||
String? shipmentId;
|
||||
String? shipmentNumber;
|
||||
|
||||
String? userID;
|
||||
String? fcsID;
|
||||
String? userName;
|
||||
String? phoneNumber;
|
||||
|
||||
String? senderFCSID;
|
||||
String? senderName;
|
||||
String? senderPhoneNumber;
|
||||
|
||||
String? boxNumber;
|
||||
String? cargoDesc;
|
||||
String? market;
|
||||
@@ -50,6 +54,7 @@ class Package {
|
||||
this.userName,
|
||||
this.fcsID,
|
||||
this.phoneNumber,
|
||||
this.shipmentId,
|
||||
this.shipmentNumber,
|
||||
this.senderFCSID,
|
||||
this.senderName,
|
||||
@@ -77,9 +82,11 @@ class Package {
|
||||
var currentStatusDate =
|
||||
map['status_date'] != null ? (map['status_date'] as Timestamp) : null;
|
||||
|
||||
List<ShipmentStatus> shipmentStatus = List.from(map['all_status'])
|
||||
.map((e) => ShipmentStatus.fromMap(Map<String, dynamic>.from(e)))
|
||||
.toList();
|
||||
List<ShipmentStatus> shipmentStatus = map['all_status'] == null
|
||||
? []
|
||||
: List.from(map['all_status'])
|
||||
.map((e) => ShipmentStatus.fromMap(Map<String, dynamic>.from(e)))
|
||||
.toList();
|
||||
List<String> photoUrls =
|
||||
map['photo_urls'] == null ? [] : List.from(map['photo_urls']);
|
||||
var deliveryAddress = map['delivery_address'];
|
||||
@@ -96,14 +103,16 @@ class Package {
|
||||
fcsID: map['fcs_id'],
|
||||
trackingID: map['tracking_id'],
|
||||
market: map['market'],
|
||||
userName: map['user_name'],
|
||||
phoneNumber: map['phone_number'],
|
||||
userName: map['user_name'] ?? "",
|
||||
phoneNumber: map['phone_number'] ?? "",
|
||||
remark: map['remark'],
|
||||
desc: map['desc'] ?? "",
|
||||
desc: map['desc'],
|
||||
status: map['status'],
|
||||
senderFCSID: map['sender_fcs_id'],
|
||||
senderName: map['sender_name'],
|
||||
senderPhoneNumber: map['sender_phone_number'],
|
||||
senderName: map['sender_name'] ?? "",
|
||||
senderPhoneNumber: map['sender_phone_number'] ?? "",
|
||||
shipmentId: map['shipment_id'],
|
||||
shipmentNumber: map['shipment_number'],
|
||||
deliveryAddress: da,
|
||||
currentStatusDate: currentStatusDate?.toDate().toLocal(),
|
||||
photoUrls: photoUrls,
|
||||
@@ -136,19 +145,20 @@ class Package {
|
||||
currentStatusDate: DateTime.parse(json['status_date']));
|
||||
}
|
||||
|
||||
bool isChangedForEdit(Package package) {
|
||||
return package.trackingID != this.trackingID ||
|
||||
package.remark != this.remark ||
|
||||
package.fcsID != this.fcsID;
|
||||
bool isChangedForEditReceiving(Package package) {
|
||||
return package.trackingID != trackingID ||
|
||||
package.remark != remark ||
|
||||
package.fcsID != fcsID;
|
||||
}
|
||||
|
||||
bool isChangedForEditProcessing(Package package) {
|
||||
return package.fcsID != this.fcsID ||
|
||||
package.senderFCSID != this.senderFCSID ||
|
||||
package.market != this.market ||
|
||||
package.desc != this.desc ||
|
||||
package.remark != this.remark ||
|
||||
package.photoUrls != this.photoUrls;
|
||||
return package.fcsID != fcsID ||
|
||||
package.senderFCSID != senderFCSID ||
|
||||
package.market != market ||
|
||||
package.desc != desc ||
|
||||
package.remark != remark ||
|
||||
package.photoUrls != photoUrls ||
|
||||
package.shipmentId != shipmentId;
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user