ソースを参照

目录结构修改

rambo 1 ヶ月 前
コミット
7b6e5952e0

+ 11 - 11
python/custom_plugins/plugins_mode/detail_generate_base.py

@@ -157,8 +157,8 @@ class DetailBase(object):
 
     def run_all(self):
         if self.template_name:
-            self.out_put_dir = "{}/详情模板{}".format(
-                self.out_put_dir, self.template_name
+            self.out_put_dir = "{}/详情图-{}".format(
+                self.out_put_dir, self.goods_no
             )
 
         print("===================detailed_images=================")
@@ -167,8 +167,8 @@ class DetailBase(object):
             self.del_detail_folder()
         detailed_images = self.deal_details()
         self.create_folder(self.out_put_dir)
-        detail_path = "{out_put_dir}/{goods_no}/详情页切片".format(
-            out_put_dir=self.out_put_dir, goods_no=self.goods_no
+        detail_path = "{out_put_dir}/切片图-{template_name}".format(
+            out_put_dir=self.out_put_dir, goods_no=self.goods_no,template_name=self.template_name
         )
         self.create_folder(detail_path)
         self.save_to_png(detailed_images=detailed_images, detail_path=detail_path)
@@ -198,7 +198,7 @@ class DetailBase(object):
                         continue
                     color_name = pic_data["颜色名称"]
 
-                    color_file_path = "{out_put_dir}/{goods_no}/{goods_number}".format(
+                    color_file_path = "{out_put_dir}/{goods_number}".format(
                         out_put_dir=self.out_put_dir,
                         goods_no=self.goods_no,
                         goods_number=pic_data["编号"],
@@ -218,8 +218,8 @@ class DetailBase(object):
                                     new_path,
                                     "NUM{}".format(i["number"]),
                                 )
-        scp_path = "{out_put_dir}/{goods_no}".format(
-            out_put_dir=self.out_put_dir, goods_no=self.goods_no
+        scp_path = "{out_put_dir}".format(
+            out_put_dir=self.out_put_dir
         )
         if self.get_text_value("模特图"):
             model_pic = self.get_text_value("模特图")
@@ -288,8 +288,8 @@ class DetailBase(object):
         #         "goods_art_nos": self.goods_art_nos,
         #     },
         # )
-        detail_path = "{out_put_dir}/{goods_no}/详情页切片".format(
-            out_put_dir=self.out_put_dir, goods_no=self.goods_no
+        detail_path = "{out_put_dir}/{goods_no}/切片图-{template_name}".format(
+            out_put_dir=self.out_put_dir, goods_no=self.goods_no,template_name=self.template_name
         )
         if not os.path.exists(detail_path):
             return
@@ -298,8 +298,8 @@ class DetailBase(object):
             detailed_images.append(PictureProcessing(image_data["file_path"]))
         # 生成拼接图
         img = self.add_pic(detailed_images)
-        join_path = "{out_put_dir}/{goods_no}/详情页".format(
-            out_put_dir=self.out_put_dir, goods_no=self.goods_no
+        join_path = "{out_put_dir}/{goods_no}/详情页-{template_name}".format(
+            out_put_dir=self.out_put_dir, goods_no=self.goods_no,template_name=self.template_name
         )
         # self.create_folder(join_path)
         img.save("{}.jpg".format(join_path), format="JPEG")

+ 16 - 131
python/service/run_main.py

@@ -652,8 +652,11 @@ class RunMain:
             if goods_no not in goods_no_need_temps:
                 continue
             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):
                     print("款号详情图不存在", _path)
@@ -874,7 +877,8 @@ class RunMain:
         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:
             print("==============_goods_no_dict  打印=================")
 
@@ -923,12 +927,16 @@ class RunMain:
                                     if _key in temp_info_data:
                                         temp_info_data[_key] = _key_value
                     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
                     self.detail_deal_one_data(
                         goods_no=goods_no,
@@ -1021,129 +1029,6 @@ class RunMain:
         )
         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):
         # self.show_progress_detail_sign.emit(text)
         # self.windows.show_progress_detail(text)