diff --git a/API-V2-elab.py b/API-V2-elab.py index dd0306666a1b6da18a608f7622acd8f25aa3f610..c27d12edd924cdd7b1714870a6f0123c83d33d01 100644 --- a/API-V2-elab.py +++ b/API-V2-elab.py @@ -63,7 +63,7 @@ elab_id=647 cers = ["75556_0001","75557_0001","75558_0001","75559_0001"] # Beispiel: cers = ["75511_0001","75512_0001"] TL1_2= "TLA" #### FM1 oder TLA -year = "2024" +year = str(config["KS-Daten"]["Jahr"]) kk= "KK" commentar = '' diff --git a/attachment_cer.py b/attachment_cer.py index aa7867ea2467fd74aea747e1541fce492de465dc..794545fde7578fc36c1c6b5f1dbdf6b579f7c4ea 100644 --- a/attachment_cer.py +++ b/attachment_cer.py @@ -9,17 +9,37 @@ from pathlib import Path import os import couchdb +import argparse +import json couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') db = couch['vl_db'] # existing -path= Path(config["Pfad"]["Kalibrierschein"]) +config_file = "config.json" +with open(config_file) as fp: + config = json.load(fp) + +cmd_parser = argparse.ArgumentParser(description= "Schreibt erstellen kalibrierschein (TeX und PDF) in die CouchDB") +cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>", nargs= "*") +cmd_parser.add_argument("-y", "--year", type= int, metavar= "<Messjahr>") +args = cmd_parser.parse_args() +path= Path(config["Pfad"]["Kalibrierschein"]) year = str(config["KS-Daten"]["Jahr"]) -cers = ["75559"] # Beispiel: cers = ["75511_0001","75512_0001"] -#cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"] +if args.year is not None: + year = str(args.year) +cers = [""] * len(args.cal_no) +#print(args.cal_no) + +for pos in range(len(args.cal_no)): + cers[pos] = str(args.cal_no[pos]) +print(cers) + +#cers = ["75559"] # Beispiel: cers = ["75511_0001","75512_0001"] +#cers = ["75562","75563"] # Beispiel: cers = ["75511_0001","75512_0001"] +exit() ################### die Kalibrierscheine werden an das cer-json-dokument angehangen ################## i = 0 while i < len(cers): @@ -65,6 +85,6 @@ while i < len(cers): ks_tex.unlink(missing_ok= True) ks_aux.unlink(missing_ok= True) ks_log.unlink(missing_ok= True) - ks_gz.unlink(missing_ok= True) + ks_gz.unlink(missing_ok= True) i += 1 diff --git a/file-to-couchdb_TLA.py b/file-to-couchdb_TLA.py index f58df25eaec0a98ed54df0fb88c5413707779ca7..81d3b4fcc0ca9079b14804d7180f458ab6ca76b9 100644 --- a/file-to-couchdb_TLA.py +++ b/file-to-couchdb_TLA.py @@ -17,6 +17,7 @@ import json import couchdb from pathlib import Path import os +import argparse #import pathlib couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') db = couch['vl_db'] # existing @@ -34,13 +35,27 @@ with open(config_file) as fp: # for entry in config[section].keys(): # print(entry, "=", config[section][entry]) -cal_cert = "75559" +cmd_parser = argparse.ArgumentParser(description= "Verarbeitet Messdaten aus TLA und speichert sie als CouchDB-Dokument") +cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>") +cmd_parser.add_argument("-y", "--year", type= int, metavar= "<Messjahr>") +cmd_parser.add_argument("-n", "--number", type= int, metavar= "<laufende Nummer>") +args = cmd_parser.parse_args() + + +#cal_cert = "75559" year = str(config["KS-Daten"]["Jahr"]) no = str(config["KS-Daten"]["lfd. Nr."]).zfill(4) + +#if args.cal_no is not None: +cal_cert = str(args.cal_no) +if args.year is not None: + year = str(args.year) +if args.number is not None: + no = str(args.number).zfill(4) + #print("year:", year) #print("no:", no) - json_file = "cal-" + year + "-tl2-kk-" + cal_cert + "_" + no doc = db.get(json_file) diff --git a/writeLaTeX-ks-TLA.py b/writeLaTeX-ks-TLA.py index c9aa0414255bd929412664b6d3a8c571fcbfad31..a581cf3a4cd898c7bfa4d81632d6c54668736f35 100644 --- a/writeLaTeX-ks-TLA.py +++ b/writeLaTeX-ks-TLA.py @@ -2,12 +2,29 @@ import time import couchdb from datetime import date from pathlib import Path +import argparse +import json couch = couchdb.Server('http://a73434.berlin.ptb.de:5984') db = couch['vl_db'] # existing -cal_cert = "75559" +config_file = "config.json" +with open(config_file) as fp: + config = json.load(fp) + +cmd_parser = argparse.ArgumentParser(description= "Erstellt TeX-Dokument als Zwischenschritt zum PDF-Kalibrierschein") +cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>") +cmd_parser.add_argument("-y", "--year", type= int, metavar= "<Messjahr>") +cmd_parser.add_argument("-n", "--number", type= int, metavar= "<laufende Nummer>") +args = cmd_parser.parse_args() + +#cal_cert = "75559" year = str(config["KS-Daten"]["Jahr"]) no = str(config["KS-Daten"]["lfd. Nr."]).zfill(4) +cal_cert = str(args.cal_no) +if args.year is not None: + year = str(args.year) +if args.number is not None: + no = str(args.number).zfill(4) year_cer = year[2:]