Преглед изворни кода

Merge branch 'master' of http://gitlab.pubdata.cn/liangyibo/CameraMachine

rambo пре 7 месеци
родитељ
комит
8e1773921c

+ 2 - 2
frontend/src/components/header-bar/index.vue

@@ -79,7 +79,7 @@ const menuType = reactive({
     click: openRemoteControl
   },
   developer: {
-    name: '开发者设置',
+    name: '初始设备调频设置',
     icon: iconsz,
     click: openDeveloper
   }
@@ -151,7 +151,7 @@ function openDeveloper(){
 
   clientStore.ipc.removeAllListeners(icpList.utils.openMain);
   let params = {
-    title: '开发者设置',
+    title: '初始设备调频设置',
     width: 900,
     height: 700,
     frame: true,

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

@@ -68,13 +68,13 @@ const routes: RouteRecordRaw[] = [
         name: "developer",
         component: () => import("@/views/Developer/index.vue"),
         meta: {
-            title: '开发者设置'
+            title: '初始设备调频设置'
         }
     },
 ];
 
 const router = createRouter({
-    history: createWebHistory(), // 修改: 将 createWebHistory 改为 createWebHashHistory
+    history: createWebHashHistory(), // 修改: 将 createWebHistory 改为 createWebHashHistory
     routes
 });
 

+ 1 - 2
frontend/src/utils/appfun.ts

@@ -8,6 +8,5 @@ export  function getFilePath (file_path){
 
 //获取路由地址
 export  function getRouterUrl (href){
-    return window.location.origin+href
+    return window.location.origin+window.location.pathname+href
 }
-

+ 1 - 1
frontend/src/views/Developer/cmd.vue

@@ -2,7 +2,7 @@
 
 
   <headerBar
-    title="开发者配置"
+    title="初始设备调频设置"
   />
 
   <el-row class="mar-top-10" >

+ 1 - 1
frontend/src/views/Developer/index.vue

@@ -1,7 +1,7 @@
 <template>
 
   <headerBar
-    title="开发者配置"
+    title="初始设备调频设置"
   />
 
 

+ 1 - 1
frontend/src/views/Developer/mcu.vue

@@ -2,7 +2,7 @@
 
 
   <headerBar
-    title="开发者配置"
+    title="初始设备调频设置"
   />
 
   <div class="page">

+ 46 - 9
frontend/src/views/Developer/normal.vue

@@ -2,7 +2,7 @@
 
 
   <headerBar
-    title="开发者配置"
+    title="初始设备调频设置"
   />
 
   <div class="page">
@@ -10,20 +10,20 @@
     <el-col :span="24"><h3>相机设置</h3></el-col>
   </el-row>
   <el-row>
-    <el-col :span="6">电机偏移mm:</el-col>
+    <el-col :span="6">相机高度mm:</el-col>
     <el-col :span="12"><el-input
-        @change="changeNum('相机电机','move_deviation','camera_high_motor_deviation',0, 400)"
-        :min="0" :max="400"
+        @change="changeNum('相机电机','move_deviation','camera_high_motor_deviation',0, 50)"
+        :min="0" :max="50"
         :step="1"
         v-model="editRowData.camera_high_motor_deviation" type="number"/>
-         <div class="error-msg">最小0,最大400</div>
+         <div class="error-msg">最小0,最大50</div>
     </el-col>
     <el-col :span="6"><el-button
-        @click="changeNum('相机电机','set_deviation','camera_high_motor_deviation',0, 400)"
+        @click="changeNum('相机电机','set_deviation','camera_high_motor_deviation',0, 50)"
     >设定</el-button></el-col>
   </el-row>
   <el-row class="mar-top-10">
-    <el-col :span="6">舵机偏移(度):</el-col>
+    <el-col :span="6">相机角度(度):</el-col>
 
     <el-col :span="12"><el-input
         @change="changeNum('相机舵机','move_deviation','camera_steering_deviation',-90, 90)"
@@ -61,7 +61,7 @@
         v-model="editRowData.turntable_front_end_deviation" type="number"/>
       <div class="error-msg">最小0,最大950</div>
     </el-col>
-    <el-col :span="6"><el-button @click="changeNum('转盘前后电机','set_deviation','turntable_front_end_deviation',0, 950)">设定</el-button></el-col>
+    <el-col :span="6"><!--<el-button @click="changeNum('转盘前后电机','set_deviation','turntable_front_end_deviation',0, 950)">设定</el-button>--></el-col>
   </el-row>
 
 
@@ -118,8 +118,9 @@
 
   <el-row align="middle" justify="middle" class="mar-top-20 bottom-wrap">
     <el-col :span="24">
-      <el-button type="primary" @click="get_deviation">读取偏移量</el-button>
       <el-button type="primary" @click="connect_mcu__init">设备初始化</el-button>
+      <el-button type="primary" @click="get_deviation">读取偏移量并运行</el-button>
+      <el-button type="primary" @click="AllChangeNum">整体设定</el-button>
     </el-col>
   </el-row>
   </div>
@@ -177,6 +178,17 @@ async function  get_deviation(){
         editRowData.value.overturn_steering_high = result.data.overturn_steering_high
         editRowData.value.overturn_steering_up_speed = result.data.overturn_steering_up_speed
         editRowData.value.overturn_steering_down_speed = result.data.overturn_steering_down_speed
+
+
+
+        changeNum('相机电机','move_deviation','camera_high_motor_deviation',0, 50)
+        changeNum('相机舵机','move_deviation','camera_steering_deviation',-90, 90)
+        changeNum('转盘舵机','move_deviation','turntable_steering_deviation',-720, 720)
+        changeNum('转盘前后电机','move_deviation','turntable_front_end_deviation',0, 950)
+        changeNum('翻板舵机中位','move_deviation','overturn_steering_middle',0, 180)
+    //    changeNum('翻板舵机高位','move_deviation','overturn_steering_high',0, 180)
+    //    changeNum('翻板舵机上升速度','move_deviation','overturn_steering_up_speed',0, 10)
+     //   changeNum('翻板舵机下降速度','move_deviation','overturn_steering_down_speed',0, 10)
       }else if(result.msg){
         ElMessage.error(result.msg)
       }
@@ -200,7 +212,19 @@ async function  connect_mcu__init(){
   }
 }
 
+const allTipsCount = ref(0)
+async  function  AllChangeNum (){
+  allTipsCount.value = 7
+  changeNum('相机电机','set_deviation','camera_high_motor_deviation',0, 50)
+  changeNum('相机舵机','set_deviation','camera_steering_deviation',-90, 90)
+  changeNum('转盘舵机','set_deviation','turntable_steering_deviation',-720, 720)
+//  changeNum('转盘前后电机','set_deviation','turntable_front_end_deviation',0, 950)
+  changeNum('翻板舵机中位','set_deviation','overturn_steering_middle',0, 180)
+  changeNum('翻板舵机高位','set_deviation','overturn_steering_high',0, 180)
+  changeNum('翻板舵机上升速度','set_deviation','overturn_steering_up_speed',0, 10)
+  changeNum('翻板舵机下降速度','set_deviation','overturn_steering_down_speed',0, 10)
 
+}
 
 
 //设置 移动 调整
@@ -228,6 +252,19 @@ async function changeNum(action_name, type, key, min, max) {
     console.log('set_deviation')
     console.log(result)
     if(result.code === 0){
+      if(result.msg === "相机舵机 设置成功"){
+
+        editRowData.value.camera_steering_deviation = 0
+      }
+      if(allTipsCount.value === 1){
+        allTipsCount.value--;
+        ElMessage.success('设定成功')
+        return;
+      }
+      if(allTipsCount.value > 0){
+        allTipsCount.value--;
+        return;
+      }
       ElMessage.success(result.msg)
     }else if(result.msg){
       ElMessage.error(result.msg)

+ 30 - 33
frontend/src/views/Photography/check.vue

@@ -126,12 +126,12 @@ const step = ref(1)
 function checkConfirm(init){
   step.value =1
   if(menu.length === 0){
-    if(useUserInfoStore.userInfo.brand_company_code === '1300'){
+    menu.push({
+      type:'developer'
+    })
+  /*  if(useUserInfoStore.userInfo.brand_company_code === '1300'){
 
-      menu.push({
-        type:'developer'
-      })
-    }
+    }*/
   }
   if(!init) previewKey.value++;
 
@@ -203,45 +203,42 @@ function takePictures() {
       }
     });
 
-    clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, result) => {
-      console.log('_run_mcu_single_check')
-      console.log(result)
-      if(result.code === 0 && result.data?.file_path){
-
-
-
-        clientStore.ipc.removeAllListeners(icpList.takePhoto.createMainImage);
-        clientStore.ipc.send(icpList.takePhoto.createMainImage,{
-          file_path:result.data.file_path
-        });
-        clientStore.ipc.on(icpList.takePhoto.createMainImage, async (event, result) => {
-          console.log('icpList.utils.createMainImage');
 
-          if(result.code === 0 && result.data?.main_out_path){
-            imageTplPath.value  = result.data?.main_out_path
-            hideVideo()
-            step.value = 2
-            loading.value = false;
-          }else if(result.msg){
-            if(result.code !== 0) ElMessage.error(result.msg)
-
-          }
-
-
-        });
 
+  }
+}
 
+clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, result) => {
+  console.log('_run_mcu_single_check')
+  console.log(result)
+  if(result.code === 0 && result.data?.file_path){
+    clientStore.ipc.removeAllListeners(icpList.takePhoto.createMainImage);
+    clientStore.ipc.send(icpList.takePhoto.createMainImage,{
+      file_path:result.data.file_path
+    });
+    clientStore.ipc.on(icpList.takePhoto.createMainImage, async (event, result) => {
+      console.log('icpList.utils.createMainImage');
+      console.log(result);
+      if(result.code === 0 && result.data?.main_out_path){
+        imageTplPath.value  = result.data?.main_out_path
+        hideVideo()
+        step.value = 2
+        loading.value = false;
       }else if(result.msg){
-
         if(result.code !== 0) ElMessage.error(result.msg)
       }
+      clientStore.ipc.removeAllListeners(icpList.takePhoto.createMainImage);
 
-    })
 
+    });
 
+
+  }else if(result.msg){
+
+    if(result.code !== 0) ElMessage.error(result.msg)
   }
-}
 
+})
 onMounted(()=>{
   showVideo()
 })

+ 4 - 3
frontend/src/views/Photography/components/editRow.vue

@@ -7,16 +7,16 @@
       <el-form-item label="动作名称">
         <el-input v-model="editRowData.action_name" :disabled="editRowData.is_system" style="width: 170px;"/>
       </el-form-item>
-      <el-form-item label="是否拍照">
+      <el-form-item label="是否拍照" v-if="!editRowData.is_system">
         <el-radio-group v-model="editRowData.take_picture">
           <el-radio :label="true">拍照</el-radio>
           <el-radio :label="false">不拍照</el-radio>
         </el-radio-group>
       </el-form-item>
       <el-form-item label="相机高度(mm)">
-        <el-input v-model="editRowData.camera_height" @change="changeNum('camera_high_motor',0, 400)" :min="0" :max="400" :step="1"  style="width: 170px;" type="number">
+        <el-input v-model="editRowData.camera_height" @change="changeNum('camera_high_motor',0, 350)" :min="0" :max="350" :step="1"  style="width: 170px;" type="number">
         </el-input>
-        <div class="error-msg">最小0,最大400</div>
+        <div class="error-msg">最小0,最大350</div>
       </el-form-item>
       <el-form-item label="相机倾角">
         <el-input v-model="editRowData.camera_angle" :min="-40" :max="40" :step=".1" @change="changeNum('camera_steering',-40, 40)" style="width: 170px;" type="number">
@@ -66,6 +66,7 @@
     </el-form>
     <div class="btn-row mar-top-20">
       <div class="normal-btn" @click="close" v-if="id">取消</div>
+      <div class="normal-btn"  v-if="!id && editRowData.is_system" @click="testShoesFlip">运行</div>
       <div class="primary-btn" @click="saveRow">{{ id ? '保存并关闭' : '保存' }}</div>
       </div>
   </div>

+ 1 - 1
frontend/src/views/Photography/detail.vue

@@ -95,7 +95,7 @@
           </div>
         </div>
 
-        <div class="template-tips c-333 fs-14 line-20 te-l mar-top-20 flex ">
+        <div class="template-tips c-333 fs-14 line-20 te-l mar-top-20 flex left">
           <el-icon><WarningFilled /></el-icon>
           <span class="mar-left-10">该模版图片顺序说明:{{form.selectTemplate.template_image_order}}</span>
         </div>

+ 33 - 5
frontend/src/views/Photography/shot.vue

@@ -63,9 +63,9 @@
 
       </div>
 
-      <div class="last-photo" v-show="showlastPhoto" v-key="lastPhoto.image_path">
+      <div class="last-photo" v-show="showlastPhoto" v-key="lastPhoto.file_path">
         <div>{{lastPhtotoName[lastPhoto.image_index] || ''}}</div>
-        <el-image  :src="getFilePath(lastPhoto.image_path)"  fit="contain" ></el-image>
+        <el-image  :src="getFilePath(lastPhoto.file_path)"  fit="contain" ></el-image>
       </div>
       <div class="history-section flex-col">
           <span class="history-title flex between">
@@ -614,6 +614,7 @@ onBeforeUnmount(() => {
   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');
+  clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu_update');
 /*  window.removeEventListener('storage', handleStorageEvent);*/
 
 
@@ -632,6 +633,8 @@ const lastPhtotoName = ref({
   4:"内里",
 })
 const  getLastPhotoRecord = async ()=>{
+
+  return;
   if(goodsList.value && goodsList.value.length === 0) return;
   clientStore.ipc.removeAllListeners(icpList.takePhoto.getLastPhotoRecord);
   clientStore.ipc.send(icpList.takePhoto.getLastPhotoRecord,);
@@ -642,10 +645,10 @@ const  getLastPhotoRecord = async ()=>{
     console.log(runAction.value)
     clientStore.ipc.removeAllListeners(icpList.takePhoto.getLastPhotoRecord);
     if(result.code === 0){
-      if(lastPhoto.value.image_path){
-        if(  lastPhoto.value.image_path == result.data.image_path) return;
+      if(lastPhoto.value?.image_path){
+        if(  lastPhoto.value?.image_path == result.data?.image_path) return;
 
-        if(runAction.value.goods_art_no === result.data.goods_art_no){
+        if(runAction.value.goods_art_no === result.data?.goods_art_no){
           showlastPhoto.value = true
         }
       }
@@ -657,6 +660,31 @@ const  getLastPhotoRecord = async ()=>{
 }
 
 
+// 监听拍照完成后的最终状态事件
+clientStore.ipc.on(icpList.socket.message + '_run_mcu_update', (event, result) => {
+  console.log('_run_mcu_update')
+  console.log(result)
+  console.log('run_mcu_update:'+new Date().toLocaleString())  // 打印当前时间
+
+  if(result.code === 0){
+    if(lastPhoto.value?.file_path){
+      if(  lastPhoto.value?.file_path == result.data?.file_path) return;
+
+      if(runAction.value.goods_art_no === result.data?.goods_art_no){
+        showlastPhoto.value = true
+        getPhotoRecords()
+        setTimeout(()=>{
+          getPhotoRecords()
+        },2000)
+      }
+    }
+    lastPhoto.value = result.data
+  }else if(result.msg) {
+    ElMessage.error(result.msg)
+  }
+})
+
+
 /**
  * 打开主图详情页面。
  */

+ 2 - 1
frontend/src/views/Setting/index.vue

@@ -102,10 +102,11 @@
                 <el-table-column prop="action_name" label="步骤" />
                 <el-table-column prop="take_picture" label="是否拍照" width="200px">
                   <template #default="scope">
-                    <el-radio-group v-model="scope.row.take_picture">
+                    <el-radio-group v-model="scope.row.take_picture" v-if="!scope.row.is_system">
                       <el-radio :label="true">拍照</el-radio>
                       <el-radio :label="false">不拍照</el-radio>
                     </el-radio-group>
+                    <span v-else></span>
                   </template>
                 </el-table-column>
 <!--                <el-table-column prop="action_index" label="排序" >