rambo 1 mēnesi atpakaļ
vecāks
revīzija
c5d81a5210

+ 5 - 1
python/api.py

@@ -34,7 +34,7 @@ from fastapi import BackgroundTasks
 import functools
 import traceback,stat
 import concurrent.futures
-
+from sockets.message_handler import handlerFolderDelete
 def log_exception_with_context(context_message=""):
     """装饰器:为函数添加异常日志上下文"""
 
@@ -1127,6 +1127,10 @@ def get_photo_record_detail(goods_art_no: str = None):
 
 @app.post("/delect_goods_arts", description="通过货号删除记录")
 def delect_goods_arts(params: PhotoRecordDelete):
+    limit_path = "output/{}".format(
+                    time.strftime("%Y-%m-%d", time.localtime(time.time()))
+                )
+    handlerFolderDelete(limit_path,params.goods_art_nos,False)
     session = SqlQuery()
     photos = CRUD(PhotoRecord)
     for item in params.goods_art_nos:

+ 75 - 88
python/mcu/RemoteControlV2.py

@@ -234,105 +234,92 @@ class RemoteControlV2(BaseClass):
         self.msg_type = "blue_tooth"
         self.photo_take_state = 2
 
-    async def handlerTakePhoto(self, smart_shooter=None):
+    async def handlerTakePhoto(self, smart_shooter=None,session=None,record=None):
         """处理单独拍照"""
         await asyncio.sleep(0.1)
-        print("开始单拍0")
-        session = SqlQuery()
-        crud = CRUD(PhotoRecord)
-        record = crud.read(session=session, order_by="id", ascending=False)
-        print("开始单拍0-读取数据库")
-        if record == None:
-            # 发送失败消息
+        print("开始单拍1")
+        if record.image_index == 19:
+            self.msg_type = "photo_take"
             self.sendSocketMessage(
                 code=1,
-                msg="单拍失败,请先输入货号或扫码进行组合拍摄",
+                msg="单拍失败,单个货号最多允许拍摄20张产品图",
                 data=None,
                 device_status=2,
             )
+            self.msg_type = "blue_tooth"
+            return
+        deviceConfig = CRUD(DeviceConfig)
+        deviceConfigData = deviceConfig.read(session=session, conditions={"id": record.action_id})
+        select_tab_id = deviceConfigData.tab_id
+        AllTabConfig = deviceConfig.read_all(session=session, conditions={"tab_id": select_tab_id})
+        action_id = 0
+        if AllTabConfig[len(AllTabConfig) - 1].take_picture == True:
+            action_id = AllTabConfig[0].id
         else:
-            print("开始单拍1")
-            if record.image_index == 19:
-                self.msg_type = "photo_take"
-                self.sendSocketMessage(
-                    code=1,
-                    msg="单拍失败,单个货号最多允许拍摄20张产品图",
-                    data=None,
-                    device_status=2,
-                )
-                self.msg_type = "blue_tooth"
-                return
-            deviceConfig = CRUD(DeviceConfig)
-            deviceConfigData = deviceConfig.read(session=session, conditions={"id": record.action_id})
-            select_tab_id = deviceConfigData.tab_id
-            AllTabConfig = deviceConfig.read_all(session=session, conditions={"tab_id": select_tab_id})
-            action_id = 0
-            if AllTabConfig[len(AllTabConfig) - 1].take_picture == True:
-                action_id = AllTabConfig[0].id
-            else:
-                action_id = AllTabConfig[len(AllTabConfig) - 1].id
-            image_index = record.image_index + 1
-            self.photo_take_state = 1
-            deviceConfig = CRUD(DeviceConfig)
-            deviceConfigData = deviceConfig.read(
-                session=session, conditions={"id": record.action_id}
-            )
-            select_tab_id = deviceConfigData.tab_id
-            AllTabConfig = deviceConfig.read_all(
-                session=session, conditions={"tab_id": select_tab_id}
-            )
-            action_id = 0
-            if AllTabConfig[len(AllTabConfig) - 1].take_picture == True:
-                action_id = AllTabConfig[0].id
+            action_id = AllTabConfig[len(AllTabConfig) - 1].id
+        image_index = record.image_index + 1
+        self.photo_take_state = 1
+        deviceConfig = CRUD(DeviceConfig)
+        deviceConfigData = deviceConfig.read(
+            session=session, conditions={"id": record.action_id}
+        )
+        select_tab_id = deviceConfigData.tab_id
+        AllTabConfig = deviceConfig.read_all(
+            session=session, conditions={"tab_id": select_tab_id}
+        )
+        action_id = 0
+        if AllTabConfig[len(AllTabConfig) - 1].take_picture == True:
+            action_id = AllTabConfig[0].id
+        else:
+            action_id = AllTabConfig[len(AllTabConfig) - 1].id
+        image_index = record.image_index + 1
+        self.photo_take_state = 1
+        state, record_id = await insert_photo_records(
+            record.image_deal_mode,
+            record.goods_art_no,
+            image_index,
+            action_id,
+        )
+        session.close()
+        print("开始单拍1-插入数据")
+        try:
+            if smart_shooter == None:
+                capture_one = DigiCam()
+                watch_dog = FileEventHandler()
+                if watch_dog.observer is None:
+                    captrure_folder_path = capture_one.getCaptureFolderPath()
+                    watch_dog.start_observer(captrure_folder_path)
+                watch_dog.goods_art_no = record.goods_art_no
+                watch_dog.image_index = image_index
+                print("开始单拍1-检查相机")
+                capture_one.run_capture_action("Capture")
+                print("开始单拍1-完成拍照")
             else:
-                action_id = AllTabConfig[len(AllTabConfig) - 1].id
-            image_index = record.image_index + 1
-            self.photo_take_state = 1
-            state, record_id = await insert_photo_records(
-                record.image_deal_mode,
-                record.goods_art_no,
-                image_index,
-                action_id,
-            )
-            print("开始单拍1-插入数据")
-            try:
-                if smart_shooter == None:
-                    capture_one = DigiCam()
-                    watch_dog = FileEventHandler()
-                    if watch_dog.observer is None:
-                        captrure_folder_path = capture_one.getCaptureFolderPath()
-                        watch_dog.start_observer(captrure_folder_path)
-                    watch_dog.goods_art_no = record.goods_art_no
-                    watch_dog.image_index = image_index
-                    print("开始单拍1-检查相机")
-                    capture_one.run_capture_action("Capture")
-                    print("开始单拍1-完成拍照")
-                else:
-                    loop = asyncio.get_event_loop()
-                    loop.create_task(
-                        smart_shooter.CameraShooter(
-                            msg_type="handler_take_picture",
-                            goods_art_no=record.goods_art_no,
-                            id=record_id,
-                        ),
-                        name="CameraShooter",
-                    )
-                await asyncio.sleep(1)
-                self.msg_type = "photo_take"
-                self.sendSocketMessage(
-                    code=0,
-                    msg="{} 执行完成~".format(
-                        "执行右脚程序"
-                        if record.image_deal_mode == 1
-                        else "执行左脚程序"
+                loop = asyncio.get_event_loop()
+                loop.create_task(
+                    smart_shooter.CameraShooter(
+                        msg_type="handler_take_picture",
+                        goods_art_no=record.goods_art_no,
+                        id=record_id,
                     ),
-                    data={"goods_art_no": record.goods_art_no, "id": record_id},
-                    device_status=2,
+                    name="CameraShooter",
                 )
-                self.msg_type = "blue_tooth"
-            except Exception as e:
-                print(f"错误:{e}")
-                self.sendSocketMessage(1, "处理失败,请重试", device_status=-1)
+            await asyncio.sleep(1)
+            self.msg_type = "photo_take"
+            self.sendSocketMessage(
+                code=0,
+                msg="{} 执行完成~".format(
+                    "执行右脚程序"
+                    if record.image_deal_mode == 1
+                    else "执行左脚程序"
+                ),
+                data={"goods_art_no": record.goods_art_no, "id": record_id},
+                device_status=2,
+            )
+            self.msg_type = "blue_tooth"
+        except Exception as e:
+            print(f"错误:{e}")
+            self.sendSocketMessage(1, "处理失败,请重试", device_status=-1)
         self.photo_take_state = 0
 
     async def analysis_received_data(self):

+ 12 - 7
python/service/base_deal.py

@@ -350,6 +350,10 @@ class BaseDealImage(object):
             "***************all_original_images*********************",
             all_original_images,
         )
+        is_flip_800image = settings.getSysConfigs(
+            "basic_configs", "is_flip_800image", 1
+        )
+        image_deal_mode = int(is_flip_800image)
         for image_dict in all_original_images:
             if windows:
                 if windows.state != 1:
@@ -373,13 +377,14 @@ class BaseDealImage(object):
                 f"*****************此处判断鞋子是否为左右脚====>{image_index}<======={is_image_deal_mode}=======>**********************"
             )
             # 此处判断鞋子是否为左右脚
-            if image_index == 1:
-                is_image_deal_mode = 0
-                print("开始识别左右脚=========>")
-                if OnePicDeal(self.token).check_shoe_is_right(
-                    image_path=original_move_bg_image_path
-                ):
-                    is_image_deal_mode = 1  # 1表示要镜像,0表示不做镜像
+            if image_deal_mode == 1:
+                if image_index == 1:
+                    is_image_deal_mode = 0
+                    print("开始识别左右脚=========>")
+                    if OnePicDeal(self.token).check_shoe_is_right(
+                        image_path=original_move_bg_image_path
+                    ):
+                        is_image_deal_mode = 1  # 1表示要镜像,0表示不做镜像
             print(
                 "*************************进行800image 生成********************************************"
             )

+ 150 - 35
python/service/grenerate_main_image_test.py

@@ -350,7 +350,87 @@ class GeneratePic(object):
         time.sleep(3)
         if output_queue is not None:
             output_queue.put(True)
+    def paste_img(self,image, top_img, base="nw", value=(0, 0), ):
+            """
+            {
+                "command": "paste_img",
+                "im": 需要粘贴的图片
+                "pos": {"plugins_mode": "relative",  # pixel
+                        "base": "center",  # nw,nc,ne,ec ... 各个方向参考点
+                        "value": (100, 100),
+                        "percentage": (0.5, 0.5),
+                        },
+                "margins": (0, 0, 0, 0),  # 上下左右边距
+            }
+            """
+            value = (int(value[0]), int(value[1]))
+            # 处理默认值
+            base = "nw" if not base else base
+            top, down, left, right = 0, 0, 0, 0
+
+            # 基于右边,上下居中
+            if base == "ec" or base == "ce":
+                p_x = int(image.width - (top_img.width + value[0]))
+                p_y = int((image.height - top_img.height) / 2) + value[1]
+
+            # 基于顶部,左右居中
+            if base == "nc" or base == "cn":
+                # 顶部对齐
+                deviation_x, deviation_y = int((image.width - top_img.width) / 2), int(
+                    (image.height - top_img.height) / 2
+                )
+                p_x = deviation_x + value[0] + left
+                p_y = value[1]
+
+            # 基于右上角
+            if base == "en" or base == "ne":
+                p_x = int(image.width - (top_img.width + value[0])) + left
+                p_y = value[1]
+
+            # 基于左上角
+            if base == "nw" or base == "wn":
+                deviation_x, deviation_y = 0, 0
+                p_x, p_y = value
+
+            # 基于底部,左右居中
+            if base == "cs" or base == "sc":
+                deviation_x, deviation_y = int((image.width - top_img.width) / 2), int(
+                    (image.height - top_img.height) / 2
+                )
+
+                p_y = image.height - (top_img.height + value[1] + down)
+                p_x = deviation_x + value[0] + left
+
+            # 上下左右居中
+            if base == "center" or base == "cc":
+                deviation_x, deviation_y = int((image.width - top_img.width) / 2), int(
+                    (image.height - top_img.height) / 2
+                )
+                p_x = deviation_x + value[0] + left
+                p_y = deviation_y + value[1] + top
+
+            # 基于左下角
+            if base == "sw" or base == "ws":
+                # deviation_x, deviation_y = 0, int((img.height - img_1.height))
+                p_x = value[0] + left
+                p_y = image.height - (top_img.height + value[1] + down)
+
+            # 基于左边,上下居中
+            if base == "wc" or base == "cw":
+                p_x = value[0] + left
+                p_y = int((image.height - top_img.height) / 2) + value[1] + top
 
+            # 基于右下角
+            if base == "es" or base == "se":
+                p_x = int(image.width - (top_img.width + value[0])) + left
+                p_y = image.height - (top_img.height + value[1] + down) + top
+
+            try:
+                image.paste(top_img, box=(p_x, p_y), mask=top_img)
+            except:
+                image.paste(top_img, box=(p_x, p_y), mask=top_img.convert("RGBA"))
+
+            return image
     @time_it
     def run(
         self,
@@ -386,7 +466,10 @@ class GeneratePic(object):
             output_queue = kwargs["output_queue"]
         else:
             output_queue = None
-
+        # image_deal_mode = 0#不翻转图像
+        padding_800image = settings.getSysConfigs(
+            "basic_configs", "padding_800image", 100
+        )
         # ==========先进行剪切原图
         _s = time.time()
         orign_im = Image.open(image_path)  # 原始图
@@ -482,46 +565,70 @@ class GeneratePic(object):
         # 不生成主图时直接退出
         if not out_path:
             return True
-
-        # im_shadow.show()
-        # =====================主图物体的缩放依据大小
-        if max_box:
-            im_shadow = to_resize(_im=im_shadow, width=max_box[0], high=max_box[1])
-            cut_image = to_resize(_im=cut_image, width=max_box[0], high=max_box[1])
-        else:
-            if resize_mode is None:
-                im_shadow = to_resize(_im=im_shadow, width=1400, high=1400)
-                cut_image = to_resize(_im=cut_image, width=1400, high=1400)
-
-            elif resize_mode == 1:
-                im_shadow = to_resize(_im=im_shadow, width=1400, high=1400)
-                cut_image = to_resize(_im=cut_image, width=1400, high=1400)
-
-            elif resize_mode == 2:
-                # todo 兼容长筒靴等,将图片大小限制在一个指定的box内
-                im_shadow = to_resize(_im=im_shadow, width=650)
-                cut_image = to_resize(_im=cut_image, width=650)
-                # 再次检查需要约束缩小到一定高度,适应长筒靴
-                _im_x, _im_y = cut_image.size
-                if _im_y > 1400:
-                    im_shadow = to_resize(_im=im_shadow, high=1400)
-                    cut_image = to_resize(_im=cut_image, high=1400)
-
-                # if im_shadow.height <= im_shadow.width * 1.2:
-                #     im_shadow = to_resize(_im=im_shadow, width=650)
-                #     cut_image = to_resize(_im=cut_image, width=650)
-                # else:
-                #     im_shadow = to_resize(_im=im_shadow, high=1400)
-                #     cut_image = to_resize(_im=cut_image, high=1400)
-
         if image_deal_mode == 1:
             # 翻转
             im_shadow = im_shadow.transpose(Image.FLIP_LEFT_RIGHT)
             cut_image = cut_image.transpose(Image.FLIP_LEFT_RIGHT)
+        image_margin = int(padding_800image)
+        bg_size = (1600, 1600)
+        _offset_x, _offset_y = 0, 0
+        scale_rate = 1
+        # im_shadow.show()
+        # =====================主图物体的缩放依据大小
+        if image_margin is not None:
+            _bbox = cut_image.getbbox()
+            _x, _y = _bbox[0], _bbox[1]
+            _w, _h = _bbox[2] - _bbox[0], _bbox[3] - _bbox[1]
+            # 中心偏移量
+            offset_x, offset_y = _x - (cut_image.width - _w) / 2, _y - (cut_image.height - _h) / 2,
+            # print("中心偏移量:", offset_x, offset_y)
+            # 透明底最小矩形
+            scale_rate = self.get_scale(base_by_box=(bg_size[0] - image_margin * 2, bg_size[1] - image_margin * 2), image_size=(_w, _h))
+            # 计算缩放比例,以及顶点相对位置
+            # print("缩放比例:", scale_rate)
+            # 偏移量
+            _offset_x, _offset_y = offset_x * scale_rate, offset_y * scale_rate
+            # print("偏移量:", _offset_x, _offset_y)
+            # 阴影图缩放尺寸
+            cut_image = to_resize(_im=cut_image, width=cut_image.width * scale_rate)
+            im_shadow = to_resize(_im=im_shadow, width=im_shadow.width * scale_rate)
 
-        # 创建底层背景
-        image_bg = Image.new("RGB", (1600, 1600), (255, 255, 255))
+        else:
+            if max_box:
+                im_shadow = to_resize(_im=im_shadow, width=max_box[0], high=max_box[1])
+                cut_image = to_resize(_im=cut_image, width=max_box[0], high=max_box[1])
+            else:
+                size_defind = 1400
+                if resize_mode is None:
+                    im_shadow = to_resize(_im=im_shadow, width=size_defind, high=size_defind)
+                    cut_image = to_resize(_im=cut_image, width=size_defind, high=size_defind)
+
+                elif resize_mode == 1:
+                    im_shadow = to_resize(_im=im_shadow, width=size_defind, high=size_defind)
+                    cut_image = to_resize(_im=cut_image, width=size_defind, high=size_defind)
+
+                elif resize_mode == 2:
+                    # todo 兼容长筒靴等,将图片大小限制在一个指定的box内
+                    im_shadow = to_resize(_im=im_shadow, width=650)
+                    cut_image = to_resize(_im=cut_image, width=650)
+                    # 再次检查需要约束缩小到一定高度,适应长筒靴
+                    _im_x, _im_y = cut_image.size
+                    if _im_y > 1400:
+                        im_shadow = to_resize(_im=im_shadow, high=1400)
+                        cut_image = to_resize(_im=cut_image, high=1400)
+
+                    # if im_shadow.height <= im_shadow.width * 1.2:
+                    #     im_shadow = to_resize(_im=im_shadow, width=650)
+                    #     cut_image = to_resize(_im=cut_image, width=650)
+                    # else:
+                    #     im_shadow = to_resize(_im=im_shadow, high=1400)
+                    #     cut_image = to_resize(_im=cut_image, high=1400)
 
+
+        # 创建底层背景
+        image_bg = Image.new("RGB", bg_size, (255, 255, 255))
+        image_bg = self.paste_img(image=image_bg, top_img=im_shadow, base="cc", value=(_offset_x * -1, _offset_y * -1))
+        image_bg = self.paste_img(image=image_bg, top_img=cut_image, base="cc", value=(_offset_x * -1, _offset_y * -1))
         image_bg_x, image_bg_y = image_bg.size
         image_x, image_y = im_shadow.size
 
@@ -635,3 +742,11 @@ class GeneratePic(object):
         if output_queue is not None:
             output_queue.put(True)
         return True
+    def get_scale(self,base_by_box, image_size):
+        box_width, box_height = int(base_by_box[0]), int(base_by_box[1])
+        width, height = image_size[0], image_size[1]
+        if box_width / box_height < width / height:
+            scale = box_width / width
+        else:
+            scale = box_height / height
+        return scale

+ 87 - 33
python/sockets/message_handler.py

@@ -53,7 +53,43 @@ async def handlerCutOut(
         )
         await manager.send_personal_message(data, websocket)
 
-
+def handlerFolderDelete(limit_path,goods_art_no_arrays,is_write_txt_log):
+    check_path(limit_path)
+    move_folder_array = check_move_goods_art_no_folder(
+                "output", goods_art_no_arrays, limit_path
+            )
+    for goods_art_revice in goods_art_no_arrays:
+                cutout_goods = f"{limit_path}/{goods_art_revice}"
+                if os.path.exists(cutout_goods):
+                    # 寻找当前被扣图的货号在现有目录中是否存在,如果存在先删除
+                    # 重新执行抠图操作
+                    try:
+                        shutil.rmtree(cutout_goods, onerror=settings.handle_remove_readonly)
+                        del move_folder_array[goods_art_revice]
+                    except PermissionError as e:
+                        logger.info(f"抠图前目录删除出现问题:{str(e)};{goods_art_revice};{cutout_goods}")
+                        if is_write_txt_log:
+                            error_file_path = f"{cutout_goods}/异常说明-出现目录丢失或缺少图片请点开查看原因.txt"
+                            with open(error_file_path, 'w', encoding='utf-8') as f:
+                                f.write("目录删除失败\n")
+                                f.write(f"原因: 文件被占用或没有删除权限\n")
+                                f.write(f"错误信息: {str(e)}\n")
+                                f.write(f"时间: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
+                                f.write(f"请关闭可能正在使用此目录的程序后,为当前货号点击重拍后重试\n")
+                        else:
+                            raise UnicornException(f"目录检查出现问题:{str(e)},请关闭错误提示中的被占用文件")
+                    except Exception as e:
+                        logger.info(f"抠图前目录删除出现问题:{str(e)};{goods_art_revice};{cutout_goods}")
+                        if is_write_txt_log:
+                            error_file_path = f"{cutout_goods}/异常说明-出现目录丢失或缺少图片请点开查看原因.txt"
+                            with open(error_file_path, 'w', encoding='utf-8') as f:
+                                f.write("目录删除失败\n")
+                                f.write(f"原因: {str(e)}\n")
+                                f.write(f"时间: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
+                                f.write(f"请检查目录状态后,为当前货号点击重拍后重试\n")
+                        else:
+                            raise UnicornException(f"目录检查出现问题:{str(e)},请关闭错误提示中的被占用文件")
+    return move_folder_array                  
 # socket消息发送逻辑处理方法
 async def handlerSend(
     manager: ConnectionManager,
@@ -200,8 +236,33 @@ async def handlerSend(
             blue_tooth = BlueToothMode(
                 websocket_manager=manager, smart_shooter=smart_shooter
             )
+            session = SqlQuery()
+            crud = CRUD(PhotoRecord)
+            record = crud.read(session=session, order_by="id", ascending=False)
+            if record == None:
+            # 发送失败消息
+                data = manager.jsonMessage(
+                            code=1,
+                            msg="单拍失败,请先输入货号或扫码进行组合拍摄",
+                            msg_type=msg_type,
+                        )
+                await manager.send_personal_message(data, websocket)
+                return
+            try:
+                limit_path = "output/{}".format(
+                    time.strftime("%Y-%m-%d", time.localtime(time.time()))
+                )
+                move_folder_array = handlerFolderDelete(limit_path,[record.goods_art_no],False)
+            except UnicornException as e:
+                data = manager.jsonMessage(
+                        code=1,
+                        msg=e.msg,
+                        msg_type=msg_type,
+                    )
+                await manager.send_personal_message(data, websocket)
+                return
             loop.create_task(
-                blue_tooth.remote_control_v2.handlerTakePhoto(smart_shooter),
+                blue_tooth.remote_control_v2.handlerTakePhoto(smart_shooter,session,record),
                 name="run_mcu_config",
             )
             await asyncio.sleep(2.5)
@@ -350,6 +411,20 @@ async def handlerSend(
             # 兼容主图测试
             id = data.get("id", 0)
             goods_art_no = data.get("goods_art_no", "")
+            if goods_art_no:
+                try:
+                    limit_path = "output/{}".format(
+                        time.strftime("%Y-%m-%d", time.localtime(time.time()))
+                    )
+                    move_folder_array = handlerFolderDelete(limit_path,[goods_art_no],False)
+                except UnicornException as e:
+                    data = manager.jsonMessage(
+                            code=1,
+                            msg=e.msg,
+                            msg_type=msg_type,
+                        )
+                    await manager.send_personal_message(data, websocket)
+                    return
             is_af = True
             loop.create_task(
                 smart_shooter.CameraShooter(
@@ -400,38 +475,17 @@ async def handlerSend(
             limit_path = "output/{}".format(
                 time.strftime("%Y-%m-%d", time.localtime(time.time()))
             )
-            check_path(limit_path)
+            try:
+                move_folder_array = handlerFolderDelete(limit_path,goods_art_no_arrays,True)
+            except UnicornException as e:
+                data = manager.jsonMessage(
+                        code=1,
+                        msg=e.msg,
+                        msg_type=msg_type,
+                    )
+                await manager.send_personal_message(data, websocket)
+                return
             # 该数组表示是否需要后面的移动文件夹操作,减少重复抠图,提升抠图时间和速度
-            move_folder_array = check_move_goods_art_no_folder(
-                "output", goods_art_no_arrays, limit_path
-            )
-            for goods_art_revice in goods_art_no_arrays:
-                cutout_goods = f"{limit_path}/{goods_art_revice}"
-                if os.path.exists(cutout_goods):
-                    # 寻找当前被扣图的货号在现有目录中是否存在,如果存在先删除
-                    # 重新执行抠图操作
-                    try:
-                        shutil.rmtree(cutout_goods, onerror=settings.handle_remove_readonly)
-                        del move_folder_array[goods_art_revice]
-                    except PermissionError as e:
-                        logger.info(f"抠图前目录删除出现问题:{str(e)};{goods_art_revice};{cutout_goods}")
-                        error_file_path = f"{cutout_goods}/异常说明-出现目录丢失或缺少图片请点开查看原因.txt"
-                        with open(error_file_path, 'w', encoding='utf-8') as f:
-                            f.write("目录删除失败\n")
-                            f.write(f"原因: 文件被占用或没有删除权限\n")
-                            f.write(f"错误信息: {str(e)}\n")
-                            f.write(f"时间: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
-                            f.write(f"请关闭可能正在使用此目录的程序后,为当前货号点击重拍后重试\n")
-                        continue
-                    except Exception as e:
-                        logger.info(f"抠图前目录删除出现问题:{str(e)};{goods_art_revice};{cutout_goods}")
-                        error_file_path = f"{cutout_goods}/异常说明-出现目录丢失或缺少图片请点开查看原因.txt"
-                        with open(error_file_path, 'w', encoding='utf-8') as f:
-                            f.write("目录删除失败\n")
-                            f.write(f"原因: {str(e)}\n")
-                            f.write(f"时间: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
-                            f.write(f"请检查目录状态后,为当前货号点击重拍后重试\n")
-                        continue
             session = SqlQuery()
             for goods_art_no in goods_art_no_arrays:
                 pr = CRUD(PhotoRecord)