|
@@ -652,8 +652,11 @@ class RunMain:
|
|
|
if goods_no not in goods_no_need_temps:
|
|
if goods_no not in goods_no_need_temps:
|
|
|
continue
|
|
continue
|
|
|
for __temp_name in goods_no_need_temps[goods_no]:
|
|
for __temp_name in goods_no_need_temps[goods_no]:
|
|
|
- _path = "{}/{}/{}/{}".format(
|
|
|
|
|
- image_dir, "软件-详情图生成", __temp_name, goods_no
|
|
|
|
|
|
|
+ # _path = "{}/{}/{}/{}".format(
|
|
|
|
|
+ # image_dir, "软件-详情图生成", __temp_name, goods_no
|
|
|
|
|
+ # )
|
|
|
|
|
+ _path = "{}/{}".format(
|
|
|
|
|
+ image_dir, f"详情图-{goods_no}"
|
|
|
)
|
|
)
|
|
|
if not os.path.exists(_path):
|
|
if not os.path.exists(_path):
|
|
|
print("款号详情图不存在", _path)
|
|
print("款号详情图不存在", _path)
|
|
@@ -874,7 +877,8 @@ class RunMain:
|
|
|
image_dir = config_data["image_dir"]
|
|
image_dir = config_data["image_dir"]
|
|
|
|
|
|
|
|
# 详情图生成结果文件夹
|
|
# 详情图生成结果文件夹
|
|
|
- out_put_dir = "{}\软件-详情图生成".format(image_dir)
|
|
|
|
|
|
|
+ # out_put_dir = "{}\软件-详情图生成".format(image_dir)
|
|
|
|
|
+ out_put_dir = "{}".format(image_dir)
|
|
|
if settings.IS_TEST:
|
|
if settings.IS_TEST:
|
|
|
print("==============_goods_no_dict 打印=================")
|
|
print("==============_goods_no_dict 打印=================")
|
|
|
|
|
|
|
@@ -923,12 +927,16 @@ class RunMain:
|
|
|
if _key in temp_info_data:
|
|
if _key in temp_info_data:
|
|
|
temp_info_data[_key] = _key_value
|
|
temp_info_data[_key] = _key_value
|
|
|
print("goods_no:{},_temp_name:{}".format(goods_no, _temp_name))
|
|
print("goods_no:{},_temp_name:{}".format(goods_no, _temp_name))
|
|
|
- out_put_dir_resp = "{}/详情模板{}/{}".format(
|
|
|
|
|
- out_put_dir, _temp_name, goods_no
|
|
|
|
|
- )
|
|
|
|
|
- all_detail_path_list.append(
|
|
|
|
|
- "{}/详情模板{}/{}".format(out_put_dir, _temp_name, goods_no)
|
|
|
|
|
|
|
+ # out_put_dir_resp = "{}/详情模板{}/{}".format(
|
|
|
|
|
+ # out_put_dir, _temp_name, goods_no
|
|
|
|
|
+ # )
|
|
|
|
|
+ out_put_dir_resp = "{}/详情图-{}".format(
|
|
|
|
|
+ out_put_dir, goods_no
|
|
|
)
|
|
)
|
|
|
|
|
+ # all_detail_path_list.append(
|
|
|
|
|
+ # "{}/详情模板{}/{}".format(out_put_dir, _temp_name, goods_no)
|
|
|
|
|
+ # )
|
|
|
|
|
+ all_detail_path_list.append(out_put_dir_resp)
|
|
|
# continue
|
|
# continue
|
|
|
self.detail_deal_one_data(
|
|
self.detail_deal_one_data(
|
|
|
goods_no=goods_no,
|
|
goods_no=goods_no,
|
|
@@ -1021,129 +1029,6 @@ class RunMain:
|
|
|
)
|
|
)
|
|
|
return config_data
|
|
return config_data
|
|
|
|
|
|
|
|
- def detail_run_by_thread11111(
|
|
|
|
|
- self,
|
|
|
|
|
- config_data,
|
|
|
|
|
- _goods_no_dict,
|
|
|
|
|
- temp_name,
|
|
|
|
|
- temp_name_list,
|
|
|
|
|
- assigned_page_dict,
|
|
|
|
|
- excel_temp_goods_no_data,
|
|
|
|
|
- finally_goods_no_need_temps,
|
|
|
|
|
- ):
|
|
|
|
|
- """
|
|
|
|
|
- excel_temp_goods_no_data: {}, # 表格数据可能存在多模板,数据结构为一个款号下的多个模板的数据列表
|
|
|
|
|
- finally_goods_no_need_temps: {}, # 每个款号需要生成的模板数据
|
|
|
|
|
- """
|
|
|
|
|
-
|
|
|
|
|
- # 开始处理
|
|
|
|
|
- self.n = 0
|
|
|
|
|
- self.total_num = len(_goods_no_dict)
|
|
|
|
|
- self.fail_num = 0
|
|
|
|
|
- is_use_excel = config_data["is_use_excel"]
|
|
|
|
|
- image_dir = config_data["image_dir"]
|
|
|
|
|
-
|
|
|
|
|
- # 详情图生成结果文件夹
|
|
|
|
|
- out_put_dir = "{}\软件-详情图生成".format(image_dir)
|
|
|
|
|
- if settings.IS_TEST:
|
|
|
|
|
- print("==============_goods_no_dict 打印=================")
|
|
|
|
|
-
|
|
|
|
|
- print(json.dumps(_goods_no_dict))
|
|
|
|
|
-
|
|
|
|
|
- print("==============_goods_no_dict 打印-end=================")
|
|
|
|
|
-
|
|
|
|
|
- if settings.IS_TEST:
|
|
|
|
|
- max_workers = 1
|
|
|
|
|
- else:
|
|
|
|
|
- max_workers = 1
|
|
|
|
|
-
|
|
|
|
|
- all_detail_path_list = []
|
|
|
|
|
-
|
|
|
|
|
- with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
|
|
|
|
|
- futures = []
|
|
|
|
|
- for goods_no, temp_name_list in finally_goods_no_need_temps.items():
|
|
|
|
|
- for _temp_name in temp_name_list:
|
|
|
|
|
- # if _temp_name != "xiaosushuoxie-4":
|
|
|
|
|
- # continue
|
|
|
|
|
-
|
|
|
|
|
- assigned_page_list = []
|
|
|
|
|
- if _temp_name in assigned_page_dict:
|
|
|
|
|
- assigned_page_list = assigned_page_dict[_temp_name]
|
|
|
|
|
- # 如果为使用表格,则获取表格中的数据作为款号的基础数据
|
|
|
|
|
- temp_info_data = copy.copy(_goods_no_dict[goods_no])
|
|
|
|
|
- if is_use_excel:
|
|
|
|
|
- # 将表格中的数据进行替换
|
|
|
|
|
- if goods_no in excel_temp_goods_no_data:
|
|
|
|
|
- if _temp_name in excel_temp_goods_no_data[goods_no]:
|
|
|
|
|
- # 将表格中的特定的模板的行,替换到goods_no的data中,因为不同的模板有数据特殊性
|
|
|
|
|
- print("xxxxxx====>", excel_temp_goods_no_data[goods_no])
|
|
|
|
|
- for _key, _key_value in excel_temp_goods_no_data[
|
|
|
|
|
- goods_no
|
|
|
|
|
- ][_temp_name].items():
|
|
|
|
|
- if _key in temp_info_data:
|
|
|
|
|
- temp_info_data[_key] = _key_value
|
|
|
|
|
-
|
|
|
|
|
- print("temp_info_data11111111111111111111111")
|
|
|
|
|
- print("goods_no:{},_temp_name:{}".format(goods_no, _temp_name))
|
|
|
|
|
- all_detail_path_list.append(
|
|
|
|
|
- "{}/{}/".format(out_put_dir, _temp_name, goods_no)
|
|
|
|
|
- )
|
|
|
|
|
- # continue
|
|
|
|
|
- futures.append(
|
|
|
|
|
- executor.submit(
|
|
|
|
|
- self.detail_deal_one_data,
|
|
|
|
|
- goods_no=goods_no,
|
|
|
|
|
- value=temp_info_data,
|
|
|
|
|
- out_put_dir=out_put_dir,
|
|
|
|
|
- temp_name=_temp_name,
|
|
|
|
|
- assigned_page_list=assigned_page_list,
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- # for goods_no, value in _goods_no_dict.items():
|
|
|
|
|
- # _temp_name = temp_name
|
|
|
|
|
- # # 使用自定义的表格数据
|
|
|
|
|
- # if self.isUseTemplate is False:
|
|
|
|
|
- # if "模板名称" in value:
|
|
|
|
|
- # if value["模板名称"] in temp_name_list:
|
|
|
|
|
- # _temp_name = value["模板名称"]
|
|
|
|
|
- # assigned_page_list = []
|
|
|
|
|
- # if _temp_name in assigned_page_dict:
|
|
|
|
|
- # assigned_page_list = assigned_page_dict[_temp_name]
|
|
|
|
|
- #
|
|
|
|
|
- # futures.append(executor.submit(
|
|
|
|
|
- # self.deal_one_data,
|
|
|
|
|
- # goods_no=goods_no,
|
|
|
|
|
- # value=value,
|
|
|
|
|
- # out_put_dir=out_put_dir,
|
|
|
|
|
- # temp_name=_temp_name,
|
|
|
|
|
- # assigned_page_list=assigned_page_list,
|
|
|
|
|
- # ))
|
|
|
|
|
-
|
|
|
|
|
- # 使用 wait 方法等待所有任务完成
|
|
|
|
|
- done, not_done = concurrent.futures.wait(futures)
|
|
|
|
|
-
|
|
|
|
|
- # 处理完成的任务
|
|
|
|
|
- for future in done:
|
|
|
|
|
- if settings.IS_TEST:
|
|
|
|
|
- result = future.result()
|
|
|
|
|
-
|
|
|
|
|
- # ==============完成处理==============
|
|
|
|
|
- self.set_state(state_value=2)
|
|
|
|
|
- if self.total_num:
|
|
|
|
|
- if self.fail_num:
|
|
|
|
|
- self.show_progress_detail(
|
|
|
|
|
- "处理完成,-----------处理失败数据:{}个款".format(self.fail_num)
|
|
|
|
|
- )
|
|
|
|
|
- else:
|
|
|
|
|
- self.show_progress_detail("处理完成")
|
|
|
|
|
- else:
|
|
|
|
|
- self.show_progress_detail("没有任何数据")
|
|
|
|
|
-
|
|
|
|
|
- config_data["sign_text"] = "已结束详情处理"
|
|
|
|
|
- config_data["all_detail_path_list"] = all_detail_path_list
|
|
|
|
|
- self.run_end_sign.emit(config_data)
|
|
|
|
|
-
|
|
|
|
|
def show_progress_detail(self, text):
|
|
def show_progress_detail(self, text):
|
|
|
# self.show_progress_detail_sign.emit(text)
|
|
# self.show_progress_detail_sign.emit(text)
|
|
|
# self.windows.show_progress_detail(text)
|
|
# self.windows.show_progress_detail(text)
|