فهرست منبع

mod:货号重复 + 运行调试

panqiuyao 8 ماه پیش
والد
کامیت
7267afedd9
4فایلهای تغییر یافته به همراه55 افزوده شده و 49 حذف شده
  1. 10 19
      frontend/src/composables/userCheck.ts
  2. 1 1
      frontend/src/router/index.ts
  3. 30 16
      frontend/src/views/Photography/shot.vue
  4. 14 13
      frontend/src/views/Setting/index.vue

+ 10 - 19
frontend/src/composables/userCheck.ts

@@ -2,8 +2,16 @@
 import { ElMessageBox  } from 'element-plus';
 export function useCheckInfo() {
 
-    console.log(localStorage.getItem('check'));
-    if(localStorage.getItem('check') === 'false'){
+        if(localStorage.getItem('check') === 'false'){
+            ShowError()
+        }
+        window.addEventListener('storage',(e)=>{
+            if(e.key === 'check' && e.newValue === false && e.oldValue === true){
+                ShowError()
+            }
+        })
+        function ShowError(){
+
             ElMessageBox({
                 title:"链接出错!",
                 message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
@@ -15,23 +23,6 @@ export function useCheckInfo() {
                 showClose:false
             })
         }
-        window.addEventListener('storage',(e)=>{
-            console.log('addEventListener')
-            console.log(e)
-            if(e.key === 'check' && e.newValue === false && e.oldValue === true){
-                ElMessageBox({
-                    title:"链接出错!",
-                    message:'设备连接出错,请在主窗口中重新连接设备后,在重新打开此窗口后进行操作',
-                    showCancelButton:false,
-                    showConfirmButton:false,
-                    closeOnClickModal:false,
-                    closeOnPressEscape:false,
-                    closeOnHashChange:false,
-                    showClose:false
-                })
-
-            }
-        })
 
 
 }

+ 1 - 1
frontend/src/router/index.ts

@@ -5,7 +5,7 @@ import { authGuard } from './plugins/authGuard'
 const routes: RouteRecordRaw[] = [
     {
         path: "/",
-        redirect: "/home"
+        redirect: "/photography/check"
     },
     {
         path: "/home",

+ 30 - 16
frontend/src/views/Photography/shot.vue

@@ -193,7 +193,10 @@ const socketStore = socket()
  * 保存货号模板到货号变量中。
  */
 function saveGoodsArtNo(){
-  if(goods_art_no_tpl.value) goods_art_no.value = goods_art_no_tpl.value
+  if(goods_art_no_tpl.value){
+    goods_art_no.value = goods_art_no_tpl.value
+    ElMessage.success('商品货号'+goods_art_no.value+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
+  }
 }
 
 /**
@@ -235,11 +238,25 @@ async function runGoods(data) {
   })
 
   ElMessage.success('开始拍摄,请稍后')
-  console.log('aa4')
   runLoading.value = true;
   runAction.value = data
   goods_art_no.value = ''
   goods_art_no_tpl.value = ''
+
+
+  clientStore.ipc.on(icpList.socket.message + '_run_mcu', (event, result) => {
+
+    clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
+    console.log('_run_mcu');
+    console.log(result);
+    if(result.code !== 0 && result.msg){
+      ElMessage.error(result.msg)
+      runLoading.value = false
+      return;
+    }
+  })
+
+
 }
 
 /**
@@ -307,20 +324,15 @@ onMounted(async () => {
 
     console.log('_blue_tooth_scan')
     if (result.code === 0 && result.data?.data) {
-      if(result.data?.data.goods_art_no) runGoods(result.data?.data)
-      if(!result.data?.data.goods_art_no && goods_art_no.value){
-        console.log('aa')
-        console.log('手工')
-        console.log({
-          ...result.data?.data,
-          goods_art_no: goods_art_no.value
-        })
-        runGoods({
-          ...result.data?.data,
-          goods_art_no: goods_art_no.value
-        })
-        console.log('aa1')
+      console.log(goods_art_no.value);
+      if(!goods_art_no.value){
+          ElMessage.error('请先扫描货号或者手动输入货号!')
+          return;
       }
+      runGoods({
+        ...result.data?.data,
+        goods_art_no: goods_art_no.value
+      })
 
     }
   });
@@ -383,7 +395,8 @@ const checkInfoStore = checkInfo()
 checkInfoStore.set_blue_tooth_scan_NO('')
 watchEffect(async ()=>{
   if(checkInfoStore.blue_tooth_scan_NO){
-    ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请根据左右脚按遥控器上的左右脚按键启动拍摄')
+    ElMessage.success('商品货号'+checkInfoStore.blue_tooth_scan_NO+'获取成功,请在遥控器上按下左或右脚按键,启动拍摄')
+    goods_art_no.value = checkInfoStore.blue_tooth_scan_NO
     checkInfoStore.set_blue_tooth_scan_NO('')
   }
 })
@@ -395,6 +408,7 @@ watchEffect(async ()=>{
 onBeforeUnmount(() => {
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_blue_tooth_scan');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_image_process');
+  clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take_finish');
 

+ 14 - 13
frontend/src/views/Setting/index.vue

@@ -823,7 +823,7 @@ function testShoesFlip(){
     socketStore.sendMessage({
       type: 'run_mcu_single',
       data: {
-``        camera_height: Number(editRowData.value.camera_height),
+        camera_height: Number(editRowData.value.camera_height),
         camera_angle:  Number(editRowData.value.camera_angle),
         led_switch:editRowData.value.led_switch,
         id:0,
@@ -843,19 +843,20 @@ function testShoesFlip(){
 
 
     clientStore.ipc.on(icpList.socket.message+'_run_mcu_single_finish', async (event, result) => {
-
-/*
-      clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
-      clientStore.ipc.send(icpList.camera.takePictures,false);
-      clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
-        setTimeout(()=>{
-          imageUrlkey.value++;
-          preview(imageUrl.value+'?key='+imageUrlkey.value)
-          captureLoading.value = false;
-        },5000)
+      console.log('_run_mcu_single_finish')
+      setTimeout(()=>{
         clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
-      })
-*/
+        clientStore.ipc.send(icpList.camera.takePictures,false);
+        clientStore.ipc.on(icpList.camera.takePictures, async (event, result) => {
+          setTimeout(()=>{
+            imageUrlkey.value++;
+            console.log('preview')
+            preview(imageUrl.value+'?key='+imageUrlkey.value)
+            captureLoading.value = false;
+          },8000)
+          clientStore.ipc.removeAllListeners(icpList.camera.takePictures);
+        })
+      },1000)
 
 
     })