Skip to content

Commit

Permalink
Merge pull request #643 from gisce/b22-use-traceability
Browse files Browse the repository at this point in the history
B2.2: Se utiliza la trazabilidad si existe el campo
  • Loading branch information
ecarreras authored Apr 11, 2024
2 parents ff9803e + e7b7b15 commit 041b4c0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libcnmc/cir_8_2021/FB2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def consumer(self):
fields_to_read = [
'installacio', 'name', 'propietari', 'data_pm', 'cini', 'tipus_element'
]
exist_trafo_field = o.GiscedataCellesCella.fields_get(['trafo_prot_id'])
if exist_trafo_field:
fields_to_read.append('trafo_prot_id')
while True:
try:
# generar linies
Expand All @@ -114,7 +117,11 @@ def consumer(self):
o_ct = self.get_codi_ct(o_ct_id)

o_id_cella = celles['name']
o_maquina = self.get_codi_maquina(o_ct_id, o_id_cella)
if exist_trafo_field and celles['trafo_prot_id']:
trafo = o.GiscedataTransformadorTrafo.read(celles['trafo_prot_id'][0], ['name', 'id_regulatori'])
o_maquina = trafo['id_regulatori'] or trafo['name']
else:
o_maquina = self.get_codi_maquina(o_ct_id, o_id_cella)
o_cini = celles['cini'] or ''
o_propietari = int(celles['propietari'])
if o_propietari == 0:
Expand Down

0 comments on commit 041b4c0

Please sign in to comment.