primer commit
This commit is contained in:
commit
d858235656
14 files changed
+21213
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import json
|
||||
import core
|
||||
import sap_services
|
||||
import logger_utilities
|
||||
|
||||
# Configurar Logger (Redirige stdout a archivo y consola)
|
||||
log_path = logger_utilities.setup_logger()
|
||||
|
||||
|
||||
session = sap_services.login()
|
||||
registro = {
|
||||
'DocEntry' : 111239
|
||||
}
|
||||
|
||||
documento = core.obtener_documento_formato_json(session,registro)
|
||||
|
||||
new_lines = []
|
||||
for index, line in enumerate(documento.get("DocumentLines",[]),start=1):
|
||||
|
||||
batches = line.get("BatchNumbers",[])
|
||||
|
||||
new_batches = []
|
||||
|
||||
if batches:
|
||||
for b in batches:
|
||||
new_batches.append({
|
||||
"BaseLineNumber": line.get("LineNum"),
|
||||
"BatchNumber": b.get("BatchNumber"),
|
||||
"Quantity": 0.00
|
||||
})
|
||||
|
||||
new_lines.append({
|
||||
"LineNum": line.get("LineNum"),
|
||||
"ItemCode": line.get("ItemCode"),
|
||||
"Quantity": line.get("Quantity"),
|
||||
"WarehouseCode": line.get("WarehouseCode"),
|
||||
"BatchNumbers": new_batches
|
||||
})
|
||||
|
||||
|
||||
body = {
|
||||
"DocumentLines": new_lines
|
||||
}
|
||||
|
||||
print (json.dumps(body, indent=2))
|
||||
|
||||
status_code = core.actualizar_detalle_documento(session, documento, body)
|
||||
|
||||
print(status_code)
|
||||
Reference in new issue
Block a user