Browse Source

refactor(Photography): 优化拍摄流程和错误处理

- 修改照片拍摄和文件路径处理逻辑- 优化错误处理和用户提示
- 调整拍摄完成后的状态更新
- 修复单张拍摄日志记录问题
panqiuyao 3 months ago
parent
commit
80a2e47b82
2 changed files with 23 additions and 3 deletions
  1. 21 2
      frontend/src/views/Photography/check.vue
  2. 2 1
      frontend/src/views/Photography/shot.vue

+ 21 - 2
frontend/src/views/Photography/check.vue

@@ -263,7 +263,14 @@ clientStore.ipc.on(icpList.socket.message+'_smart_shooter_photo_take', async (ev
   console.log('_smart_shooter_photo_take');
   console.log(result);
   if(result.code === 0 && result.data?.photo_file_name){
-    createMainImage(result.data?.photo_file_name)
+    imageTplPath.value  = result.data?.photo_file_name
+    hideVideo()
+    step.value = 2
+    loading.value = false;
+  }else {
+    loading.value = false;
+    showVideo()
+    if(result.code !== 0 && result.msg) ElMessage.error(result.msg)
   }
 
 })
@@ -275,6 +282,18 @@ clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, resul
   console.log(result)
 
   if(result.code === 0 && result.data?.file_path){
+    imageTplPath.value  = result.data?.file_path
+    hideVideo()
+    step.value = 2
+    loading.value = false;
+  }else {
+    loading.value = false;
+    showVideo()
+    if(result.code !== 0 && result.msg) ElMessage.error(result.msg)
+  }
+
+
+/*  if(result.code === 0 && result.data?.file_path){
 
     createMainImage(result.data?.file_path)
 
@@ -285,7 +304,7 @@ clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, resul
       loading.value = false;
       showVideo()
     }
-  }
+  }*/
 
 })
 

+ 2 - 1
frontend/src/views/Photography/shot.vue

@@ -900,7 +900,8 @@ clientStore.ipc.on(icpList.socket.message+'_smart_shooter_photo_take', async (ev
 
   //
   if(result.code === 0){
-    if(result.data.goods_art_no ) setLogInfo(route, { action: '单张拍摄完成', goods_art_no: result.data.goods_art_no });
+    if(!result.data.goods_art_no )  return;
+      setLogInfo(route, { action: '单张拍摄完成', goods_art_no: result.data.goods_art_no });
     if (smartShooterTimeout) {
       clearTimeout(smartShooterTimeout);
     }