Use existing excel files

This commit is contained in:
hodasemi 2024-04-20 08:36:44 +02:00
parent 1952f4c55d
commit 0dd46385cd
2 changed files with 19 additions and 17 deletions

View file

@ -101,14 +101,16 @@ mod test {
use std::collections::HashMap;
#[test_case("resources/CEPI-method_Laufzettel_Part I_V22.9_Adapack_Muster 1.xlsx")]
#[test_case("resources/CEPI-method_Laufzettel_Part I_V23.02_Cascogne_Muster1.xlsx")]
#[test_case("resources/CEPI-method_Laufzettel_Part I_V23.03_Intertape Packaging_Muster 1.xlsx")]
#[test_case("resources/CEPI-method_Laufzettel_Part I_V23.04_Cats Flexible Packaging_M1.xlsx")]
#[test_case("../laufzettel/CEPI-method_Laufzettel_Part I_V22.8_Metsä Board_Muster1.xlsx")]
#[test_case("../laufzettel/CEPI-method_Laufzettel_Part I_V22.9_Adapack_Muster 1.xlsx")]
#[test_case("../laufzettel/CEPI-method_Laufzettel_Part I_V23.02_Cascogne_Muster1.xlsx")]
#[test_case(
"../laufzettel/CEPI-method_Laufzettel_Part I_V23.04_Cats Flexible Packaging_M1.xlsx"
)]
fn verify_cepi(file: &str) -> Result<()> {
let cepi_reader = PythonObject::new("python-cepi/cepi_read_function.py")?;
let cepi_reader = PythonObject::new("../python-cepi-master/cepi_read_function.py")?;
cepi_reader.execute_script(
let result = cepi_reader.execute_script(
"read",
&file,
|r: HashMap<String, HashMap<String, String>>| Ok(r),

View file

@ -175,7 +175,7 @@ def read(filepath):
m[68] = 10
m[69] = 10
m[69] = 10
def shift_pH_lf(k,m):
m[71] = 10
m[72] = 10
@ -204,7 +204,7 @@ def read(filepath):
k.append(0)
m.append(0)
k[120] = -4
k[122] = -4
k[122] = -4
k[123] = -1
k[125] = -1
k[124] = -5
@ -213,7 +213,7 @@ def read(filepath):
m[122] = -1
m[125] = -1
m[126] = -1
if version == "V22.1" or version == "V22.2" or version == "V22.3":
for i in range(0, 62):
#normal till ARS 2
@ -243,18 +243,18 @@ def read(filepath):
shift_ars2(k,m)
shift_pH_lf(k,m)
for i in range(75,93):
k.append(-4)
m.append(0)
for i in range(93,107):
k.append(-2)
m.append(0)
correct_bkt_vb_old(k,m)
#verified
elif version == "V22.7":
for i in range(0, 107):
k.append(0)
@ -310,12 +310,12 @@ def read(filepath):
#verified
#If version not supported
else:
#If version not supported
else:
version = ""
print("Version nicht unterstützt")
return results
#load all sheets
ubersicht = workbook["Übersicht"]
@ -346,7 +346,7 @@ def read(filepath):
results["übersicht"]["firma"] = cell(ubersicht, 9, 3, 8)
prob_nr = ubersicht.cell(row=10, column=3).value
prob_bez = ubersicht.cell(row=10, column=4).value
if prob_nr == None:
if prob_nr == None:
prob_nr = " "
if prob_bez == None:
prob_bez = " "
@ -543,7 +543,7 @@ def sheet_test(path):
print(list)
else:
print("ok.")
if __name__ == "__main__":
print(read("C:/Users/T.Priebe/Documents/3/ExcelCepi/examples/CEPI-method_Laufzettel_Part I_V23.07.xlsx"))