chore: initial commit del proyecto SCAII_Sync_Client
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
35
registros/scaii/reg_504.py
Normal file
35
registros/scaii/reg_504.py
Normal file
@@ -0,0 +1,35 @@
|
||||
from typing import List, Dict, Any
|
||||
|
||||
class Generador504SCAII:
|
||||
@staticmethod
|
||||
def preparar_listado_json(id_pedimento: int, contenedores_raw: str) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Procesa el string de contenedores (CONT1|TIPO1,CONT2|TIPO2)
|
||||
y genera una lista de registros para la API.
|
||||
"""
|
||||
registros = []
|
||||
|
||||
if not contenedores_raw or contenedores_raw.strip() == "":
|
||||
return registros
|
||||
|
||||
# En WinDev: FOR EACH STRING sContenedores OF DS_Facturas.c1 SEPARATED BY ","
|
||||
bloques = contenedores_raw.split(",")
|
||||
|
||||
for bloque in bloques:
|
||||
if not bloque.strip():
|
||||
continue
|
||||
|
||||
# En WinDev: (sNumeroContenedor,sTipoContenedor) = StringSplit(sContenedores,"|")
|
||||
partes = bloque.split("|")
|
||||
num_contenedor = partes[0].strip() if len(partes) > 0 else ""
|
||||
tipo_contenedor = partes[1].strip() if len(partes) > 1 else " "
|
||||
|
||||
if num_contenedor:
|
||||
registros.append({
|
||||
"id_pedimento_501": id_pedimento,
|
||||
"numero_contenedor_504": num_contenedor,
|
||||
"tipo_contenedor_504": tipo_contenedor,
|
||||
"status_504": "1"
|
||||
})
|
||||
|
||||
return registros
|
||||
Reference in New Issue
Block a user