完善耐久采集
This commit is contained in:
@ -11,7 +11,6 @@ class IsoDataProcess(QThread):
|
||||
super().__init__()
|
||||
self.dir_path = dir_path
|
||||
self.idx = 2
|
||||
self.logger = clibs.logger
|
||||
|
||||
@staticmethod
|
||||
def p_iso(file, p_files, ws, tmpfile):
|
||||
@ -144,7 +143,7 @@ class IsoDataProcess(QThread):
|
||||
def initialization(self):
|
||||
dirs, files = clibs.traversal_files(self.dir_path)
|
||||
if len(dirs) != 0:
|
||||
self.logger("ERROR", "iso", f"init: 工作目录下不可以有文件夹!", "red")
|
||||
clibs.logger("ERROR", "iso", f"init: 工作目录下不可以有文件夹!", "red")
|
||||
|
||||
for file in files:
|
||||
file = file.lower()
|
||||
@ -157,7 +156,7 @@ class IsoDataProcess(QThread):
|
||||
elif file.endswith("iso.pdf"):
|
||||
pass
|
||||
else:
|
||||
self.logger("ERROR", "iso", f"init: 工作目录下只允许有如下四个文件,不区分大小写,pdf文件最少有一个!<br>1. iso-results.xlsx<br>2. ISO.pdf<br>3. ISO-V100.pdf<br>4. ISO-V1000.pdf", "red")
|
||||
clibs.logger("ERROR", "iso", f"init: 工作目录下只允许有如下四个文件,不区分大小写,pdf文件最少有一个!<br>1. iso-results.xlsx<br>2. ISO.pdf<br>3. ISO-V100.pdf<br>4. ISO-V1000.pdf", "red")
|
||||
|
||||
return files
|
||||
|
||||
@ -175,24 +174,24 @@ class IsoDataProcess(QThread):
|
||||
for i in range(3, 50):
|
||||
ws.cell(row=i, column=7).value = None
|
||||
except Exception as err:
|
||||
self.logger("ERROR", "iso", f"main: 无法打开文件 {filename}<br>{err}", "red")
|
||||
clibs.logger("ERROR", "iso", f"main: 无法打开文件 {filename}<br>{err}", "red")
|
||||
|
||||
p_files = []
|
||||
for file in files:
|
||||
if file.split("/")[-1].lower() == "iso.pdf":
|
||||
self.logger("INFO", "iso", f"正在处理{file}......")
|
||||
clibs.logger("INFO", "iso", f"正在处理{file}......")
|
||||
self.p_iso(file, p_files, ws, tmpfile)
|
||||
self.logger("INFO", "iso", f"文件{file}已处理完毕。")
|
||||
clibs.logger("INFO", "iso", f"文件{file}已处理完毕。")
|
||||
|
||||
elif file.split("/")[-1].lower() == "iso-v100.pdf":
|
||||
self.logger("INFO", "iso", f"正在处理{file}......")
|
||||
clibs.logger("INFO", "iso", f"正在处理{file}......")
|
||||
self.p_iso_100(file, p_files, ws, tmpfile)
|
||||
self.logger("INFO", "iso", f"文件{file}已处理完毕。")
|
||||
clibs.logger("INFO", "iso", f"文件{file}已处理完毕。")
|
||||
|
||||
elif file.split("/")[-1].lower() == "iso-v1000.pdf":
|
||||
self.logger("INFO", "iso", f"正在处理{file}......")
|
||||
clibs.logger("INFO", "iso", f"正在处理{file}......")
|
||||
self.p_iso_1000(file, p_files, ws, tmpfile)
|
||||
self.logger("INFO", "iso", f"文件{file}已处理完毕。")
|
||||
clibs.logger("INFO", "iso", f"文件{file}已处理完毕。")
|
||||
|
||||
else:
|
||||
pass
|
||||
@ -200,11 +199,11 @@ class IsoDataProcess(QThread):
|
||||
wb.close()
|
||||
|
||||
if len(p_files) == 0:
|
||||
self.logger("ERROR", "iso", f"目录 {self.dir_path} 下没有需要处理的文件,需要确认......", "red")
|
||||
clibs.logger("ERROR", "iso", f"目录 {self.dir_path} 下没有需要处理的文件,需要确认......", "red")
|
||||
else:
|
||||
os.remove(tmpfile)
|
||||
|
||||
self.logger("INFO", "current-processing", "-" * 60 + "<br>全部处理完毕<br>", "purple")
|
||||
clibs.logger("INFO", "current-processing", "-" * 60 + "<br>全部处理完毕<br>", "purple")
|
||||
time_total = time.time() - time_start
|
||||
msg = f"数据处理时间:{time_total // 3600:02.0f} h {time_total % 3600 // 60:02.0f} m {time_total % 60:02.0f} s"
|
||||
self.logger("INFO", "current-processing", msg)
|
||||
clibs.logger("INFO", "current-processing", msg)
|
||||
|
Reference in New Issue
Block a user