|
@@ -372,43 +372,7 @@ function handleAutoFocus() {
|
|
|
const loading = ref(true)
|
|
const loading = ref(true)
|
|
|
const editData = ref(null);
|
|
const editData = ref(null);
|
|
|
const imageTplPath = ref(null)
|
|
const imageTplPath = ref(null)
|
|
|
-const expectTestPhoto = ref(false)
|
|
|
|
|
-let testPhotoToken = 0
|
|
|
|
|
-let shootAfterMove = false
|
|
|
|
|
-function buildSingleShotData() {
|
|
|
|
|
- const row = editData.value?.editRowData || {}
|
|
|
|
|
- const data: Record<string, any> = {
|
|
|
|
|
- camera_height: Number(row.camera_height),
|
|
|
|
|
- camera_angle: Number(row.camera_angle),
|
|
|
|
|
- led_switch: row.led_switch,
|
|
|
|
|
- id: 0,
|
|
|
|
|
- mode_type: row.mode_type,
|
|
|
|
|
- turntable_position: Number(row.turntable_position),
|
|
|
|
|
- action_name: row.action_name || '测试',
|
|
|
|
|
- turntable_angle: Number(row.turntable_angle),
|
|
|
|
|
- shoe_upturn: Number(row.shoe_upturn),
|
|
|
|
|
- camera_focal_distance: Number(row.camera_focal_distance || 0),
|
|
|
|
|
- action_index: 1,
|
|
|
|
|
- number_focus: isSetting.value ? Number(row.number_focus || 0) : 0,
|
|
|
|
|
- take_picture: true,
|
|
|
|
|
- pre_delay: 0,
|
|
|
|
|
- after_delay: 0,
|
|
|
|
|
- point_name: row.point_name || currentPointName.value || 'A',
|
|
|
|
|
- is_move_device: row.is_move_device,
|
|
|
|
|
- }
|
|
|
|
|
- if (isSetting.value) {
|
|
|
|
|
- const cameraConfigs = editData.value?.getCameraConfigs?.()
|
|
|
|
|
- if (cameraConfigs) {
|
|
|
|
|
- data.camera_configs = cameraConfigs
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return data
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
function backToPreview() {
|
|
function backToPreview() {
|
|
|
- testPhotoToken += 1
|
|
|
|
|
- expectTestPhoto.value = false
|
|
|
|
|
- shootAfterMove = false
|
|
|
|
|
step.value = 1
|
|
step.value = 1
|
|
|
imageTplPath.value = null
|
|
imageTplPath.value = null
|
|
|
loading.value = false
|
|
loading.value = false
|
|
@@ -422,25 +386,28 @@ function takePictures() {
|
|
|
|
|
|
|
|
if (clientStore.isClient) {
|
|
if (clientStore.isClient) {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
- if (isSetting.value) {
|
|
|
|
|
- const token = ++testPhotoToken
|
|
|
|
|
- expectTestPhoto.value = true
|
|
|
|
|
- shootAfterMove = true
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- if (token !== testPhotoToken || !expectTestPhoto.value || step.value !== 1) return
|
|
|
|
|
- expectTestPhoto.value = false
|
|
|
|
|
- shootAfterMove = false
|
|
|
|
|
- loading.value = false
|
|
|
|
|
- showVideo(currentPointName.value)
|
|
|
|
|
- ElMessage.warning('未收到测试照片,已返回预览')
|
|
|
|
|
- }, 30000)
|
|
|
|
|
- }
|
|
|
|
|
- const shotData = buildSingleShotData()
|
|
|
|
|
- if (isSetting.value) {
|
|
|
|
|
- shotData.take_picture = false
|
|
|
|
|
- shotData.number_focus = 0
|
|
|
|
|
- delete shotData.camera_configs
|
|
|
|
|
|
|
+ const row = editData.value?.editRowData || {}
|
|
|
|
|
+ const shotData: Record<string, any> = {
|
|
|
|
|
+ camera_height: Number(row.camera_height),
|
|
|
|
|
+ camera_angle: Number(row.camera_angle),
|
|
|
|
|
+ led_switch: row.led_switch,
|
|
|
|
|
+ id: 0,
|
|
|
|
|
+ mode_type: row.mode_type,
|
|
|
|
|
+ turntable_position: Number(row.turntable_position),
|
|
|
|
|
+ action_name: row.action_name || '测试',
|
|
|
|
|
+ turntable_angle: Number(row.turntable_angle),
|
|
|
|
|
+ shoe_upturn: Number(row.shoe_upturn),
|
|
|
|
|
+ camera_focal_distance: Number(row.camera_focal_distance),
|
|
|
|
|
+ action_index: 1,
|
|
|
|
|
+ number_focus: 0,
|
|
|
|
|
+ take_picture: true,
|
|
|
|
|
+ pre_delay: 0,
|
|
|
|
|
+ after_delay: 0,
|
|
|
|
|
+ point_name: row.point_name || currentPointName.value || 'A',
|
|
|
|
|
+ is_move_device: row.is_move_device,
|
|
|
}
|
|
}
|
|
|
|
|
+ const cameraConfigs = editData.value?.getCameraConfigs?.()
|
|
|
|
|
+ if (cameraConfigs) shotData.camera_configs = cameraConfigs
|
|
|
console.log('takePictures');
|
|
console.log('takePictures');
|
|
|
console.log(shotData)
|
|
console.log(shotData)
|
|
|
hideVideo(currentPointName.value).then(() => {
|
|
hideVideo(currentPointName.value).then(() => {
|
|
@@ -479,22 +446,10 @@ function createMainImage (file_path){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-clientStore.ipc.on(icpList.socket.message+'_run_mcu', async (event, result) => {
|
|
|
|
|
- if (!expectTestPhoto.value) return
|
|
|
|
|
- if (result?.code === 0) return
|
|
|
|
|
- testPhotoToken += 1
|
|
|
|
|
- expectTestPhoto.value = false
|
|
|
|
|
- loading.value = false
|
|
|
|
|
- showVideo(currentPointName.value)
|
|
|
|
|
- if (result?.msg) ElMessage.error(result.msg)
|
|
|
|
|
-})
|
|
|
|
|
-
|
|
|
|
|
//拍照成功 SmartShooter
|
|
//拍照成功 SmartShooter
|
|
|
clientStore.ipc.on(icpList.socket.message+'_smart_shooter_photo_take', async (event, result) => {
|
|
clientStore.ipc.on(icpList.socket.message+'_smart_shooter_photo_take', async (event, result) => {
|
|
|
console.log('_smart_shooter_photo_take');
|
|
console.log('_smart_shooter_photo_take');
|
|
|
console.log(result);
|
|
console.log(result);
|
|
|
- testPhotoToken += 1
|
|
|
|
|
- expectTestPhoto.value = false
|
|
|
|
|
if(result.code === 0 && result.data?.photo_file_name){
|
|
if(result.code === 0 && result.data?.photo_file_name){
|
|
|
imageTplPath.value = result.data?.photo_file_name
|
|
imageTplPath.value = result.data?.photo_file_name
|
|
|
step.value = 2
|
|
step.value = 2
|
|
@@ -531,20 +486,6 @@ clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, resul
|
|
|
}else {
|
|
}else {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
console.log('_run_mcu_single');
|
|
console.log('_run_mcu_single');
|
|
|
- if (shootAfterMove && result.code === 0) {
|
|
|
|
|
- shootAfterMove = false
|
|
|
|
|
- loading.value = true
|
|
|
|
|
- socketStore.sendMessage({
|
|
|
|
|
- type: 'smart_shooter_photo_take',
|
|
|
|
|
- data: {
|
|
|
|
|
- point_name: currentPointName.value || 'A',
|
|
|
|
|
- goods_art_no: '',
|
|
|
|
|
- id: 0,
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- expectTestPhoto.value = false
|
|
|
|
|
showVideo(currentPointName.value)
|
|
showVideo(currentPointName.value)
|
|
|
if(result.code !== 0 && result.msg) ElMessage.error(result.msg)
|
|
if(result.code !== 0 && result.msg) ElMessage.error(result.msg)
|
|
|
}
|
|
}
|
|
@@ -586,7 +527,6 @@ onBeforeUnmount(() => {
|
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewHide);
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewHide);
|
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
|
|
clientStore.ipc.removeAllListeners(icpList.camera.PreviewShow);
|
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message+'_run_mcu_single');
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message+'_run_mcu_single');
|
|
|
- clientStore.ipc.removeAllListeners(icpList.socket.message+'_run_mcu');
|
|
|
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message+'_smart_shooter_photo_take');
|
|
clientStore.ipc.removeAllListeners(icpList.socket.message+'_smart_shooter_photo_take');
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|