图片定时任务
This commit is contained in:
@@ -33,3 +33,13 @@ export function validateWeighing(data: any) {
|
|||||||
export function vmSend(materialProcess: string) {
|
export function vmSend(materialProcess: string) {
|
||||||
return http.post<string>(`/vm/send`, { materialProcess })
|
return http.post<string>(`/vm/send`, { materialProcess })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @desc vm定时任务保存图片 */
|
||||||
|
export function getVmSaveImageTask() {
|
||||||
|
return http.get<any>(`/vm/start`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @desc vm关闭定时任务 */
|
||||||
|
export function getVmCloseTask() {
|
||||||
|
return http.get<any>(`/vm/stop`)
|
||||||
|
}
|
||||||
|
|||||||
@@ -265,9 +265,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { nextTick, onBeforeUnmount, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
|
import { nextTick, onBeforeUnmount, onMounted, onUnmounted, reactive, ref, watch } from 'vue'
|
||||||
import { Message, Modal, Notification } from '@arco-design/web-vue'
|
import { Message, Modal, Notification } from '@arco-design/web-vue'
|
||||||
import { getMaterialDetail, validateWeighing, vmSend } from '@/apis/weightManage/weightManage'
|
import {
|
||||||
|
getMaterialDetail,
|
||||||
|
getVmCloseTask,
|
||||||
|
getVmSaveImageTask,
|
||||||
|
validateWeighing,
|
||||||
|
vmSend
|
||||||
|
} from '@/apis/weightManage/weightManage'
|
||||||
import {type WorkOrderResp, addWorkOrder} from '@/apis/workOrder/workOrder'
|
import {type WorkOrderResp, addWorkOrder} from '@/apis/workOrder/workOrder'
|
||||||
import {getCaptureImage, getCheckStatus, getEnterWeighPage, getLeaveWeighPage} from "@/apis/weightManage/ys";
|
import {getCaptureImage, getCheckStatus, getEnterWeighPage, getLeaveWeighPage } from "@/apis/weightManage/ys";
|
||||||
import {brightness, connect, disconnect} from "@/apis/weightManage/light";
|
import {brightness, connect, disconnect} from "@/apis/weightManage/light";
|
||||||
|
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
@@ -414,21 +420,30 @@ onMounted(() => {
|
|||||||
// 监听步骤变化
|
// 监听步骤变化
|
||||||
watch(activeStep, (newVal) => {
|
watch(activeStep, (newVal) => {
|
||||||
if (newVal === 1) {
|
if (newVal === 1) {
|
||||||
// 进入扫码验证页面,连接灯光
|
// 进入扫码验证页面,连接灯光并启动vm定时任务保存图片
|
||||||
connect().catch(error => {
|
connect().catch(error => {
|
||||||
console.error('连接灯光失败:', error)
|
console.error('连接灯光失败:', error)
|
||||||
})
|
})
|
||||||
|
getVmSaveImageTask().catch(error => {
|
||||||
|
console.error('启动vm定时任务保存图片失败:', error)
|
||||||
|
})
|
||||||
} else if (newVal === 2) {
|
} else if (newVal === 2) {
|
||||||
// 进入称重登记页面,断开灯光
|
// 进入称重登记页面,断开灯光并关闭vm定时任务
|
||||||
disconnect().catch(error => {
|
disconnect().catch(error => {
|
||||||
console.error('断开灯光失败:', error)
|
console.error('断开灯光失败:', error)
|
||||||
})
|
})
|
||||||
|
getVmCloseTask().catch(error => {
|
||||||
|
console.error('关闭vm定时任务失败:', error)
|
||||||
|
})
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
enterWeighPage()
|
enterWeighPage()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 离开称重页面,断开灯光
|
// 离开称重页面,断开灯光并关闭vm定时任务
|
||||||
leaveWeighPage()
|
leaveWeighPage()
|
||||||
|
getVmCloseTask().catch(error => {
|
||||||
|
console.error('关闭vm定时任务失败:', error)
|
||||||
|
})
|
||||||
disconnect().catch(error => {
|
disconnect().catch(error => {
|
||||||
console.error('断开灯光失败:', error)
|
console.error('断开灯光失败:', error)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user