This commit is contained in:
Abraham
2025-07-31 10:45:17 -07:00
parent 8bbe7a53ff
commit 5f08a7556f
2 changed files with 43 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
import 'dart:convert';
class ComponenteEnRack {
final String id;
final String rackId;
final String componenteId;
final int? posicionU;
final DateTime fechaRegistro;
ComponenteEnRack({
required this.id,
required this.rackId,
required this.componenteId,
this.posicionU,
required this.fechaRegistro,
});
factory ComponenteEnRack.fromMap(Map<String, dynamic> map) {
return ComponenteEnRack(
id: map['id'] ?? '',
rackId: map['rack_id'] ?? '',
componenteId: map['componente_id'] ?? '',
posicionU: map['posicion_u'],
fechaRegistro: DateTime.parse(map['fecha_registro']),
);
}
Map<String, dynamic> toMap() {
return {
'id': id,
'rack_id': rackId,
'componente_id': componenteId,
'posicion_u': posicionU,
'fecha_registro': fechaRegistro.toIso8601String(),
};
}
factory ComponenteEnRack.fromJson(String source) =>
ComponenteEnRack.fromMap(json.decode(source));
String toJson() => json.encode(toMap());
}

View File

@@ -162,7 +162,7 @@ class ComponentesProvider extends ChangeNotifier {
'p_negocio_id': negocioId,
}).select();
print('Respuesta RPC recibida: $response');
/* print('Respuesta RPC recibida: $response'); */
if (response != null) {
topologiaCompleta = TopologiaCompleta.fromJson(response);