增加注释
This commit is contained in:
parent
83b16bac0e
commit
7e9d362d98
|
@ -320,7 +320,12 @@ async def generate_report(base_info, baogao_info):
|
||||||
"""
|
"""
|
||||||
需要获取:
|
需要获取:
|
||||||
Y1、Y2、Y3叶片的缺陷数量,缺陷字典{图片名:图片路径}
|
Y1、Y2、Y3叶片的缺陷数量,缺陷字典{图片名:图片路径}
|
||||||
|
和数据库连接需要的新增异常处理:
|
||||||
|
目前逻辑为找到图片后,找缺陷类型的图片,通过图片id查找对应缺陷记录
|
||||||
|
如果没有找到,要返回对应异常,即已选出(标注)缺陷图,但未填写对应缺陷信息的异常返回。
|
||||||
|
最后将无异常的图片入队缺陷字典(同数量),有异常的图片再另存。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
Y1_quexian_num, Y1_quexian_dict = 0, {}
|
Y1_quexian_num, Y1_quexian_dict = 0, {}
|
||||||
Y2_quexian_num, Y2_quexian_dict = 0, {}
|
Y2_quexian_num, Y2_quexian_dict = 0, {}
|
||||||
Y3_quexian_num, Y3_quexian_dict = 0, {}
|
Y3_quexian_num, Y3_quexian_dict = 0, {}
|
||||||
|
@ -350,49 +355,52 @@ async def generate_report(base_info, baogao_info):
|
||||||
total_table_num += 1
|
total_table_num += 1
|
||||||
head_num += 1
|
head_num += 1
|
||||||
|
|
||||||
# #主要部位图片展示表/检查内容表
|
#主要部位图片展示表/检查内容表
|
||||||
# #获取典型图信息
|
#获取典型图信息
|
||||||
# search_file_list = ["外汇总","内汇总","防汇总"]
|
search_file_list = ["外汇总","内汇总","防汇总"]
|
||||||
# picture_Y1_num, Y1_dict = collect_defect_data(Y1, Picture_dir, ifwaibu, ifneibu, search_file_list, iffanglei)
|
try:
|
||||||
# picture_Y2_num, Y2_dict = collect_defect_data(Y2, Picture_dir, ifwaibu, ifneibu, search_file_list, iffanglei)
|
picture_Y1_num, Y1_dict = collect_defect_data(Y1, Picture_dir, ifwaibu, ifneibu, search_file_list, iffanglei)
|
||||||
# picture_Y3_num, Y3_dict = collect_defect_data(Y3, Picture_dir, ifwaibu, ifneibu, search_file_list, iffanglei)
|
picture_Y2_num, Y2_dict = collect_defect_data(Y2, Picture_dir, ifwaibu, ifneibu, search_file_list, iffanglei)
|
||||||
# print(f"图片、文字数量:{picture_Y1_num} {picture_Y2_num} {picture_Y3_num}")
|
picture_Y3_num, Y3_dict = collect_defect_data(Y3, Picture_dir, ifwaibu, ifneibu, search_file_list, iffanglei)
|
||||||
# JIANCHA_NEIRONG_TOTAL_NUM = picture_Y1_num+ picture_Y2_num + picture_Y3_num
|
except Exception as e:
|
||||||
# col ,row = 3, 0
|
print(f"获取缺陷图失败:{e}")
|
||||||
# JIANCHA_NEIRONG_PICTURES_TABLE = os.path.join(muban_dir,"check2.docx")
|
print(f"图片、文字数量:{picture_Y1_num} {picture_Y2_num} {picture_Y3_num}")
|
||||||
# JIANCHA_NEIRONG_Y1_DIR = os.path.join(muban_dir,"check_content.docx")
|
JIANCHA_NEIRONG_TOTAL_NUM = picture_Y1_num+ picture_Y2_num + picture_Y3_num
|
||||||
# JIANCHA_NEIRONG_Y1 = list(list("" for _ in range(3)) for j in range(1))
|
col ,row = 3, 0
|
||||||
# JIANCHA_NEIRONG_Y1[0][0] = f"叶片1:{Y1}检查内容"
|
JIANCHA_NEIRONG_PICTURES_TABLE = os.path.join(muban_dir,"check2.docx")
|
||||||
# print(f"Y1标题内容:{JIANCHA_NEIRONG_Y1}")
|
JIANCHA_NEIRONG_Y1_DIR = os.path.join(muban_dir,"check_content.docx")
|
||||||
# JIANCHA_NEIRONG_Y2_DIR = os.path.join(muban_dir,"check3.docx")
|
JIANCHA_NEIRONG_Y1 = list(list("" for _ in range(3)) for j in range(1))
|
||||||
# JIANCHA_NEIRONG_Y2 = list(list("" for _ in range(3)) for j in range(1))
|
JIANCHA_NEIRONG_Y1[0][0] = f"叶片1:{Y1}检查内容"
|
||||||
# JIANCHA_NEIRONG_Y2[0][0] = f"叶片2:{Y2}检查内容"
|
print(f"Y1标题内容:{JIANCHA_NEIRONG_Y1}")
|
||||||
# print(f"Y2标题内容:{JIANCHA_NEIRONG_Y2}")
|
JIANCHA_NEIRONG_Y2_DIR = os.path.join(muban_dir,"check3.docx")
|
||||||
# JIANCHA_NEIRONG_Y3_DIR = os.path.join(muban_dir,"check3.docx")
|
JIANCHA_NEIRONG_Y2 = list(list("" for _ in range(3)) for j in range(1))
|
||||||
# JIANCHA_NEIRONG_Y3 = list(list("" for _ in range(3)) for j in range(1))
|
JIANCHA_NEIRONG_Y2[0][0] = f"叶片2:{Y2}检查内容"
|
||||||
# JIANCHA_NEIRONG_Y3[0][0] = f"叶片3:{Y3}检查内容"
|
print(f"Y2标题内容:{JIANCHA_NEIRONG_Y2}")
|
||||||
# print(f"Y3标题内容:{JIANCHA_NEIRONG_Y3}")
|
JIANCHA_NEIRONG_Y3_DIR = os.path.join(muban_dir,"check3.docx")
|
||||||
# print(f"当前表格序号为 {total_table_num}")
|
JIANCHA_NEIRONG_Y3 = list(list("" for _ in range(3)) for j in range(1))
|
||||||
# print(key_words)
|
JIANCHA_NEIRONG_Y3[0][0] = f"叶片3:{Y3}检查内容"
|
||||||
# output_doc, message = await add_table_to_document(output_dir, JIANCHA_NEIRONG_Y1_DIR,1,3,total_table_num,JIANCHA_NEIRONG_Y1,True, 1)
|
print(f"Y3标题内容:{JIANCHA_NEIRONG_Y3}")
|
||||||
# print(message)
|
print(f"当前表格序号为 {total_table_num}")
|
||||||
# total_table_num += 1
|
print(key_words)
|
||||||
|
output_doc, message = await add_table_to_document(output_dir, JIANCHA_NEIRONG_Y1_DIR,1,3,total_table_num,JIANCHA_NEIRONG_Y1,True, 1)
|
||||||
|
print(message)
|
||||||
|
total_table_num += 1
|
||||||
|
|
||||||
# total_table_num = await process_images_table(Y1_dict, output_dir, total_table_num, JIANCHA_NEIRONG_PICTURES_TABLE, key_words)
|
total_table_num = await process_images_table(Y1_dict, output_dir, total_table_num, JIANCHA_NEIRONG_PICTURES_TABLE, key_words)
|
||||||
|
|
||||||
# output_doc, message = await add_table_to_document(output_dir, JIANCHA_NEIRONG_Y2_DIR,1,3,total_table_num,JIANCHA_NEIRONG_Y2,True, 1)
|
output_doc, message = await add_table_to_document(output_dir, JIANCHA_NEIRONG_Y2_DIR,1,3,total_table_num,JIANCHA_NEIRONG_Y2,True, 1)
|
||||||
# print(message)
|
print(message)
|
||||||
# total_table_num += 1
|
total_table_num += 1
|
||||||
|
|
||||||
# total_table_num = await process_images_table(Y2_dict, output_dir, total_table_num, JIANCHA_NEIRONG_PICTURES_TABLE, key_words)
|
total_table_num = await process_images_table(Y2_dict, output_dir, total_table_num, JIANCHA_NEIRONG_PICTURES_TABLE, key_words)
|
||||||
|
|
||||||
# output_doc, message = await add_table_to_document(output_dir, JIANCHA_NEIRONG_Y3_DIR,1,3,total_table_num,JIANCHA_NEIRONG_Y3,True, 1)
|
output_doc, message = await add_table_to_document(output_dir, JIANCHA_NEIRONG_Y3_DIR,1,3,total_table_num,JIANCHA_NEIRONG_Y3,True, 1)
|
||||||
# print(message)
|
print(message)
|
||||||
# total_table_num += 1
|
total_table_num += 1
|
||||||
|
|
||||||
# total_table_num = await process_images_table(Y3_dict, output_dir, total_table_num, JIANCHA_NEIRONG_PICTURES_TABLE, key_words)
|
total_table_num = await process_images_table(Y3_dict, output_dir, total_table_num, JIANCHA_NEIRONG_PICTURES_TABLE, key_words)
|
||||||
# print(await search_and_replace(output_dir, jiegou_xuhao, num_to_chinese[head_num]))
|
print(await search_and_replace(output_dir, jiegou_xuhao, num_to_chinese[head_num]))
|
||||||
# head_num += 1
|
head_num += 1
|
||||||
|
|
||||||
# #缺陷详情
|
# #缺陷详情
|
||||||
# QUEXIAN_XIANGQING_DIR = os.path.join(muban_dir,"check_check.docx")
|
# QUEXIAN_XIANGQING_DIR = os.path.join(muban_dir,"check_check.docx")
|
||||||
|
@ -469,7 +477,6 @@ def main():
|
||||||
json_data1 = {
|
json_data1 = {
|
||||||
"turbine_id" : "183463dbf40d9278549a76b82b175dd9",
|
"turbine_id" : "183463dbf40d9278549a76b82b175dd9",
|
||||||
}
|
}
|
||||||
|
|
||||||
json_data2 = {
|
json_data2 = {
|
||||||
'shengcheng_dir': r".\output",
|
'shengcheng_dir': r".\output",
|
||||||
'muban_dir': r".\muban",
|
'muban_dir': r".\muban",
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue