You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/models/device/device.dart

417 lines
14 KiB
Dart

import 'package:test_sa/models/device/supplier.dart';
import 'package:test_sa/models/device/technical_guidance_book.dart';
import 'package:test_sa/models/lookup.dart';
import '../new_models/building.dart';
import '../new_models/department.dart';
import '../new_models/floor.dart';
import '../new_models/site.dart';
import 'model_definition.dart';
class Device {
Device({
this.id,
this.assetSerialNo,
this.systemID,
this.assetNumber,
this.modelDefinition,
this.supplier,
this.ipAddress,
this.macAddress,
this.portNumber,
this.assetReplace,
this.oldAsset,
this.isParent,
this.parentAsset,
this.assetType,
this.site,
this.building,
this.floor,
this.department,
this.room,
this.testsDay,
this.purchasingPrice,
this.nbv,
this.currency,
this.poNo,
this.invoiceNumber,
this.invoiceDate,
this.replacementDate,
this.originDepartment,
this.originSite,
this.budgetYear,
this.lastPOPrice,
this.commissioningStatus,
this.productionDate,
this.edd,
this.technicalInspectionDate,
this.deliveryInspectionDate,
this.endUserAcceptanceDate,
this.receivingCommittee,
this.siteWarrantyMonths,
this.extendedWarrantyMonths,
this.remainderWarrantyMonths,
this.eomWarrantyMonthsNo,
this.warrantyValue,
this.warrantyEndDate,
this.warrantyContractConditions,
this.technicalGuidanceBooks,
this.comment,
this.tagCode,
this.assetPhoto,
});
Device.fromJson(dynamic json) {
id = json['id'];
assetSerialNo = json['assetSerialNo'];
systemID = json['systemID'];
assetNumber = json['assetNumber'];
modelDefinition = json['modelDefinition'] != null ? ModelDefinition.fromJson(json['modelDefinition']) : null;
supplier = json['supplier'] != null ? Supplier.fromJson(json['supplier']) : null;
ipAddress = json['ipAddress'];
macAddress = json['macAddress'];
portNumber = json['portNumber'];
assetReplace = json['assetReplace'] != null ? Lookup.fromJson(json['assetReplace']) : null;
oldAsset = json['oldAsset'] != null ? AssetInfo.fromJson(json['oldAsset']) : null;
isParent = json['isParent'] != null ? Lookup.fromJson(json['isParent']) : null;
parentAsset = json['parentAsset'] != null ? AssetInfo.fromJson(json['parentAsset']) : null;
assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
site = json['site'] != null ? Site.fromJson(json['site']) : null;
building = json['building'] != null ? Building.fromJson(json['building']) : null;
floor = json['floor'] != null ? Floor.fromJson(json['floor']) : null;
department = json['department'] != null ? Department.fromJson(json['department']) : null;
room = json['room'];
testsDay = json['testsDay'];
purchasingPrice = json['purchasingPrice'];
nbv = json['nbv'];
currency = json['currency'] != null ? Lookup.fromJson(json['currency']) : null;
poNo = json['poNo'];
invoiceNumber = json['invoiceNumber'];
invoiceDate = json['invoiceDate'];
replacementDate = json['replacementDate'];
originDepartment = json['originDepartment'] != null ? Department.fromJson(json['originDepartment']) : null;
originSite = json['originSite'] != null ? Site.fromJson(json['originSite']) : null;
budgetYear = json['budgetYear'];
lastPOPrice = json['lastPOPrice'];
commissioningStatus = json['commissioningStatus'] != null ? Lookup.fromJson(json['commissioningStatus']) : null;
productionDate = json['productionDate'];
edd = json['edd'];
technicalInspectionDate = json['technicalInspectionDate'];
deliveryInspectionDate = json['deliveryInspectionDate'];
endUserAcceptanceDate = json['endUserAcceptanceDate'];
receivingCommittee = json['receivingCommittee'];
siteWarrantyMonths = json['siteWarrantyMonths'] != null ? Lookup.fromJson(json['siteWarrantyMonths']) : null;
extendedWarrantyMonths = json['extendedWarrantyMonths'] != null ? Lookup.fromJson(json['extendedWarrantyMonths']) : null;
remainderWarrantyMonths = json['remainderWarrantyMonths'] != null ? Lookup.fromJson(json['remainderWarrantyMonths']) : null;
eomWarrantyMonthsNo = json['eomWarrantyMonthsNo'];
warrantyValue = json['warrantyValue'];
warrantyEndDate = json['warrantyEndDate'];
warrantyContractConditions = json['warrantyContractConditions'];
if (json['technicalGuidanceBooks'] != null) {
technicalGuidanceBooks = [];
json['technicalGuidanceBooks'].forEach((v) {
technicalGuidanceBooks.add(TechnicalGuidanceBook.fromJson(v));
});
}
comment = json['comment'];
tagCode = json['tagCode'];
}
num id;
String assetSerialNo;
String systemID;
String assetNumber;
ModelDefinition modelDefinition;
Supplier supplier;
String ipAddress;
String macAddress;
String portNumber;
Lookup assetReplace;
AssetInfo oldAsset;
Lookup isParent;
AssetInfo parentAsset;
Lookup assetType;
Site site;
Building building;
Floor floor;
Department department;
String room;
num testsDay;
num purchasingPrice;
String nbv;
Lookup currency;
String poNo;
String invoiceNumber;
String invoiceDate;
String replacementDate;
Department originDepartment;
Site originSite;
num budgetYear;
num lastPOPrice;
Lookup commissioningStatus;
String productionDate;
String edd;
String technicalInspectionDate;
String deliveryInspectionDate;
String endUserAcceptanceDate;
String receivingCommittee;
Lookup siteWarrantyMonths;
Lookup extendedWarrantyMonths;
Lookup remainderWarrantyMonths;
num eomWarrantyMonthsNo;
num warrantyValue;
String warrantyEndDate;
String warrantyContractConditions;
List<TechnicalGuidanceBook> technicalGuidanceBooks;
String comment;
String tagCode;
String assetPhoto;
Device copyWith({
num id,
String assetSerialNo,
String systemID,
String assetNumber,
ModelDefinition modelDefinition,
Supplier supplier,
String ipAddress,
String macAddress,
String portNumber,
Lookup assetReplace,
AssetInfo oldAsset,
Lookup isParent,
AssetInfo parentAsset,
Lookup assetType,
Site site,
Building building,
Floor floor,
Department department,
String room,
num testsDay,
num purchasingPrice,
String nbv,
Lookup currency,
String poNo,
String invoiceNumber,
String invoiceDate,
String replacementDate,
Department originDepartment,
Site originSite,
num budgetYear,
num lastPOPrice,
Lookup commissioningStatus,
String productionDate,
String edd,
String technicalInspectionDate,
String deliveryInspectionDate,
String endUserAcceptanceDate,
String receivingCommittee,
Lookup siteWarrantyMonths,
Lookup extendedWarrantyMonths,
Lookup remainderWarrantyMonths,
num eomWarrantyMonthsNo,
num warrantyValue,
String warrantyEndDate,
String warrantyContractConditions,
List<TechnicalGuidanceBook> technicalGuidanceBooks,
String comment,
String tagCode,
String assetPhoto,
}) =>
Device(
id: id ?? this.id,
assetSerialNo: assetSerialNo ?? this.assetSerialNo,
systemID: systemID ?? this.systemID,
assetNumber: assetNumber ?? this.assetNumber,
modelDefinition: modelDefinition ?? this.modelDefinition,
supplier: supplier ?? this.supplier,
ipAddress: ipAddress ?? this.ipAddress,
macAddress: macAddress ?? this.macAddress,
portNumber: portNumber ?? this.portNumber,
assetReplace: assetReplace ?? this.assetReplace,
oldAsset: oldAsset ?? this.oldAsset,
isParent: isParent ?? this.isParent,
parentAsset: parentAsset ?? this.parentAsset,
assetType: assetType ?? this.assetType,
site: site ?? this.site,
building: building ?? this.building,
floor: floor ?? this.floor,
department: department ?? this.department,
room: room ?? this.room,
testsDay: testsDay ?? this.testsDay,
purchasingPrice: purchasingPrice ?? this.purchasingPrice,
nbv: nbv ?? this.nbv,
currency: currency ?? this.currency,
poNo: poNo ?? this.poNo,
invoiceNumber: invoiceNumber ?? this.invoiceNumber,
invoiceDate: invoiceDate ?? this.invoiceDate,
replacementDate: replacementDate ?? this.replacementDate,
originDepartment: originDepartment ?? this.originDepartment,
originSite: originSite ?? this.originSite,
budgetYear: budgetYear ?? this.budgetYear,
lastPOPrice: lastPOPrice ?? this.lastPOPrice,
commissioningStatus: commissioningStatus ?? this.commissioningStatus,
productionDate: productionDate ?? this.productionDate,
edd: edd ?? this.edd,
technicalInspectionDate: technicalInspectionDate ?? this.technicalInspectionDate,
deliveryInspectionDate: deliveryInspectionDate ?? this.deliveryInspectionDate,
endUserAcceptanceDate: endUserAcceptanceDate ?? this.endUserAcceptanceDate,
receivingCommittee: receivingCommittee ?? this.receivingCommittee,
siteWarrantyMonths: siteWarrantyMonths ?? this.siteWarrantyMonths,
extendedWarrantyMonths: extendedWarrantyMonths ?? this.extendedWarrantyMonths,
remainderWarrantyMonths: remainderWarrantyMonths ?? this.remainderWarrantyMonths,
eomWarrantyMonthsNo: eomWarrantyMonthsNo ?? this.eomWarrantyMonthsNo,
warrantyValue: warrantyValue ?? this.warrantyValue,
warrantyEndDate: warrantyEndDate ?? this.warrantyEndDate,
warrantyContractConditions: warrantyContractConditions ?? this.warrantyContractConditions,
technicalGuidanceBooks: technicalGuidanceBooks ?? this.technicalGuidanceBooks,
comment: comment ?? this.comment,
tagCode: tagCode ?? this.tagCode,
assetPhoto: assetPhoto ?? this.assetPhoto,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['assetSerialNo'] = assetSerialNo;
map['systemID'] = systemID;
map['assetNumber'] = assetNumber;
if (modelDefinition != null) {
map['modelDefinition'] = modelDefinition.toJson();
}
if (supplier != null) {
map['supplier'] = supplier.toJson();
}
map['ipAddress'] = ipAddress;
map['macAddress'] = macAddress;
map['portNumber'] = portNumber;
if (assetReplace != null) {
map['assetReplace'] = assetReplace.toJson();
}
if (oldAsset != null) {
map['oldAsset'] = oldAsset.toJson();
}
if (isParent != null) {
map['isParent'] = isParent.toJson();
}
if (parentAsset != null) {
map['parentAsset'] = parentAsset.toJson();
}
if (assetType != null) {
map['assetType'] = assetType.toJson();
}
if (site != null) {
map['site'] = site.toJson();
}
if (building != null) {
map['building'] = building.toJson();
}
if (floor != null) {
map['floor'] = floor.toJson();
}
if (department != null) {
map['department'] = department.toJson();
}
map['room'] = room;
map['testsDay'] = testsDay;
map['purchasingPrice'] = purchasingPrice;
map['nbv'] = nbv;
if (currency != null) {
map['currency'] = currency.toJson();
}
map['poNo'] = poNo;
map['invoiceNumber'] = invoiceNumber;
map['invoiceDate'] = invoiceDate;
map['replacementDate'] = replacementDate;
if (originDepartment != null) {
map['originDepartment'] = originDepartment.toJson();
}
if (originSite != null) {
map['originSite'] = originSite.toJson();
}
map['budgetYear'] = budgetYear;
map['lastPOPrice'] = lastPOPrice;
if (commissioningStatus != null) {
map['commissioningStatus'] = commissioningStatus.toJson();
}
map['productionDate'] = productionDate;
map['edd'] = edd;
map['technicalInspectionDate'] = technicalInspectionDate;
map['deliveryInspectionDate'] = deliveryInspectionDate;
map['endUserAcceptanceDate'] = endUserAcceptanceDate;
map['receivingCommittee'] = receivingCommittee;
if (siteWarrantyMonths != null) {
map['siteWarrantyMonths'] = siteWarrantyMonths.toJson();
}
if (extendedWarrantyMonths != null) {
map['extendedWarrantyMonths'] = extendedWarrantyMonths.toJson();
}
if (remainderWarrantyMonths != null) {
map['remainderWarrantyMonths'] = remainderWarrantyMonths.toJson();
}
map['eomWarrantyMonthsNo'] = eomWarrantyMonthsNo;
map['warrantyValue'] = warrantyValue;
map['warrantyEndDate'] = warrantyEndDate;
map['warrantyContractConditions'] = warrantyContractConditions;
if (technicalGuidanceBooks != null) {
map['technicalGuidanceBooks'] = technicalGuidanceBooks.map((v) => v.toJson()).toList();
}
map['comment'] = comment;
map['tagCode'] = tagCode;
map['assetPhoto'] = assetPhoto;
return map;
}
}
class AssetInfo {
AssetInfo({
this.id,
this.assetSerialNo,
this.assetNumber,
this.tagCode,
this.systemId,
this.assetName,
});
AssetInfo.fromJson(dynamic json) {
id = json['id'];
assetSerialNo = json['assetSerialNo'];
assetNumber = json['assetNumber'];
tagCode = json['tagCode'];
systemId = json['systemId'];
assetName = json['assetName'];
}
num id;
String assetSerialNo;
String assetNumber;
String tagCode;
String systemId;
String assetName;
AssetInfo copyWith({
num id,
String assetSerialNo,
String assetNumber,
String tagCode,
String systemId,
String assetName,
}) =>
AssetInfo(
id: id ?? this.id,
assetSerialNo: assetSerialNo ?? this.assetSerialNo,
assetNumber: assetNumber ?? this.assetNumber,
tagCode: tagCode ?? this.tagCode,
systemId: systemId ?? this.systemId,
assetName: assetName ?? this.assetName,
);
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = id;
map['assetSerialNo'] = assetSerialNo;
map['assetNumber'] = assetNumber;
map['tagCode'] = tagCode;
map['systemId'] = systemId;
map['assetName'] = assetName;
return map;
}
}