|
|
@ -12,8 +12,11 @@ import TrayGraph from 'components/spray/trayGraph/index.vue' |
|
|
|
import { FtMessage } from 'libs/message' |
|
|
|
import { socket } from 'libs/socket' |
|
|
|
import { sendControl } from 'libs/utils' |
|
|
|
import { useSystemStore } from 'stores/useSystemStore' |
|
|
|
import { nextTick, onMounted, ref } from 'vue' |
|
|
|
|
|
|
|
const systemStore = useSystemStore() |
|
|
|
|
|
|
|
const sprayRefs = ref<any>([]) |
|
|
|
|
|
|
|
const updateParam = () => { |
|
|
@ -29,15 +32,15 @@ const updateParam = () => { |
|
|
|
} |
|
|
|
|
|
|
|
const submitParam = async () => { |
|
|
|
form.value = { |
|
|
|
...form.value, |
|
|
|
...updateForm.value, |
|
|
|
} |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_change_param', |
|
|
|
cmdId: '', |
|
|
|
params: updateForm.value, |
|
|
|
} |
|
|
|
form.value = { |
|
|
|
...form.value, |
|
|
|
...updateForm.value, |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
infoVisible.value = false |
|
|
|
} |
|
|
@ -46,12 +49,14 @@ const infoVisible = ref(false) |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
getMatrixList() |
|
|
|
// nextTick(() => { |
|
|
|
// currentSpeed = 1 |
|
|
|
// sprayPointReceiveMessage({ index: 0, currentPoint: { x: 1, y: 1 }, nextPoint: { x: 10, y: 1 } }) |
|
|
|
// }) |
|
|
|
systemStore.systemStatus.spraying && getSpraying() |
|
|
|
}) |
|
|
|
|
|
|
|
const getSpraying = async () => { |
|
|
|
// const res = await getSprayStatus() |
|
|
|
// const sprayTaskSprayedList = res.sprayTaskSprayedList |
|
|
|
} |
|
|
|
|
|
|
|
const matrixList = ref([]) |
|
|
|
const getMatrixList = async () => { |
|
|
|
const res = await listMatrix({ pageNum: 1, pageSize: 100, matrixName: '' }) |
|
|
@ -90,13 +95,15 @@ const checkPosition = () => { |
|
|
|
FtMessage.error('至少选择一个玻片') |
|
|
|
return false |
|
|
|
} |
|
|
|
position = form.value.position.map((item: any, index: number) => { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
...sprayRefs.value[index].getSelection(), |
|
|
|
index, |
|
|
|
} |
|
|
|
}).filter((item: { select: boolean }) => item.select) |
|
|
|
position = form.value.position |
|
|
|
.map((item: any, index: number) => { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
...sprayRefs.value[index].getSelection(), |
|
|
|
index, |
|
|
|
} |
|
|
|
}) |
|
|
|
.filter((item: { select: boolean }) => item.select) |
|
|
|
console.log(position) |
|
|
|
for (let i = 0; i < position.length; i++) { |
|
|
|
const p = position[i] |
|
|
@ -123,7 +130,7 @@ const startWork = async () => { |
|
|
|
|
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_start', |
|
|
|
cmdId: '', |
|
|
|
cmdId: Date.now().toString(), |
|
|
|
params: { |
|
|
|
...form.value, |
|
|
|
position, |
|
|
@ -131,53 +138,67 @@ const startWork = async () => { |
|
|
|
} |
|
|
|
console.log(params) |
|
|
|
socket.init(sprayPointReceiveMessage, 'spray_point') |
|
|
|
socket.init((data: any) => { |
|
|
|
console.log(data) |
|
|
|
if (data.cmdId === params.cmdId && data.status === 'spray_task_finish') { |
|
|
|
form.value.position.forEach((item, index) => { |
|
|
|
if (item.select) { |
|
|
|
sprayRefs.value[index].clearLines() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, 'cmd_response') |
|
|
|
await sendControl(params) |
|
|
|
currentSpeed = Number(form.value.movingSpeed) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
let currentSpeed = 0 |
|
|
|
let poll: ReturnType<typeof setInterval> |
|
|
|
|
|
|
|
// let poll: ReturnType<typeof setInterval> |
|
|
|
console.log(currentSpeed) |
|
|
|
const colors = ['#2E8B57', '#C0FF3E', '#8B658B', '#EE7942', '#EE1289', '#FF00FF', '#C6E2FF'] |
|
|
|
const sprayPointReceiveMessage = (data: any) => { |
|
|
|
if (poll) { |
|
|
|
clearInterval(poll) |
|
|
|
} |
|
|
|
const { currentPoint, nextPoint, index } = data |
|
|
|
// 计算累加的mm |
|
|
|
const moveDistance = currentSpeed / 2 |
|
|
|
// y轴移动 |
|
|
|
if (currentPoint.x === nextPoint.x) { |
|
|
|
let currentY = currentPoint.y |
|
|
|
poll = setInterval(() => { |
|
|
|
currentY += moveDistance |
|
|
|
if (currentY >= nextPoint.y) { |
|
|
|
clearInterval(poll) |
|
|
|
} |
|
|
|
drawLine(index, { x: currentPoint.x * 5, y: currentY * 5 }) |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
else if (currentPoint.y === nextPoint.y) { |
|
|
|
// x轴移动 |
|
|
|
let currentX = currentPoint.x |
|
|
|
poll = setInterval(() => { |
|
|
|
currentX += moveDistance |
|
|
|
if (currentX >= nextPoint.x) { |
|
|
|
clearInterval(poll) |
|
|
|
} |
|
|
|
drawLine(index, { x: currentX * 5, y: currentPoint.y * 5 }) |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
const { currentPoint, nextPoint, index, number } = data |
|
|
|
drawLine(index, { x: currentPoint.x * 5, y: currentPoint.y * 5 }, number) |
|
|
|
drawLine(index, { x: nextPoint.x * 5, y: nextPoint.y * 5 }, number) |
|
|
|
// if (poll) { |
|
|
|
// clearInterval(poll) |
|
|
|
// } |
|
|
|
// const { currentPoint, nextPoint, index } = data |
|
|
|
// // 计算累加的mm |
|
|
|
// const moveDistance = currentSpeed / 2 |
|
|
|
// // y轴移动 |
|
|
|
// if (currentPoint.x === nextPoint.x) { |
|
|
|
// let currentY = currentPoint.y |
|
|
|
// poll = setInterval(() => { |
|
|
|
// currentY += moveDistance |
|
|
|
// if (currentY >= nextPoint.y) { |
|
|
|
// clearInterval(poll) |
|
|
|
// } |
|
|
|
// drawLine(index, { x: currentPoint.x * 5, y: currentY * 5 }) |
|
|
|
// }, 500) |
|
|
|
// } |
|
|
|
// else if (currentPoint.y === nextPoint.y) { |
|
|
|
// // x轴移动 |
|
|
|
// let currentX = currentPoint.x |
|
|
|
// poll = setInterval(() => { |
|
|
|
// currentX += moveDistance |
|
|
|
// if (currentX >= nextPoint.x) { |
|
|
|
// clearInterval(poll) |
|
|
|
// } |
|
|
|
// drawLine(index, { x: currentX * 5, y: currentPoint.y * 5 }) |
|
|
|
// }, 500) |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
const drawLine = async (index: number, point: { x: number, y: number }) => { |
|
|
|
const drawLine = async (index: number, point: { x: number, y: number }, number: number) => { |
|
|
|
await nextTick(() => { |
|
|
|
if (!sprayRefs.value[index].hasLine) { |
|
|
|
sprayRefs.value[index].addLine() |
|
|
|
if (!sprayRefs.value[index].hasLine(number)) { |
|
|
|
sprayRefs.value[index].addLine(colors[number]) |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('drawLine', point) |
|
|
|
sprayRefs.value[index].updateLine(point) |
|
|
|
sprayRefs.value[index].updateLine(point, number) |
|
|
|
} |
|
|
|
|
|
|
|
const pauseWork = async () => { |
|
|
@ -211,6 +232,11 @@ const stopWork = async () => { |
|
|
|
cmdId: '', |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
form.value.position.forEach((item, index) => { |
|
|
|
if (item.select) { |
|
|
|
sprayRefs.value[index].clearLines() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const matrixCraftList = ref<any>([]) |
|
|
@ -229,29 +255,41 @@ const matrixCraftChange = (value: number) => { |
|
|
|
|
|
|
|
const rules = { |
|
|
|
matrixId: [{ required: true, message: '请选择基质', trigger: 'change' }], |
|
|
|
motorZHeight: [{ required: true, trigger: 'blur', validator: (rule: any, value: any, callback: any) => { |
|
|
|
setTimeout(() => { |
|
|
|
if (value < 15) { |
|
|
|
callback(new Error('最小安全高度为15mm')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
}, 500) |
|
|
|
} }], |
|
|
|
motorZHeight: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
trigger: 'blur', |
|
|
|
validator: (rule: any, value: any, callback: any) => { |
|
|
|
setTimeout(() => { |
|
|
|
if (value < 15) { |
|
|
|
callback(new Error('最小安全高度为15mm')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
}, 500) |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
gasPressure: [{ required: true, message: '请输入氮气气压', trigger: 'blur' }], |
|
|
|
volume: [{ required: true, message: '请输入基质流速', trigger: 'blur' }], |
|
|
|
highVoltageValue: [{ required: true, trigger: 'blur', validator: (rule: any, value: any, callback: any) => { |
|
|
|
if (form.value.highVoltage && !value) { |
|
|
|
callback(new Error('请输入电压')) |
|
|
|
} |
|
|
|
else if (value > 6000) { |
|
|
|
callback(new Error('最大电压为6000V')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
} }], |
|
|
|
highVoltageValue: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
trigger: 'blur', |
|
|
|
validator: (rule: any, value: any, callback: any) => { |
|
|
|
if (form.value.highVoltage && !value) { |
|
|
|
callback(new Error('请输入电压')) |
|
|
|
} |
|
|
|
else if (value > 6000) { |
|
|
|
callback(new Error('最大电压为6000V')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
movingSpeed: [{ required: true, message: '请输入移动速度', trigger: 'blur' }], |
|
|
|
spacing: [{ required: true, message: '请输入间距', trigger: 'blur' }], |
|
|
|
times: [{ required: true, message: '请输入喷涂次数', trigger: 'blur' }], |
|
|
@ -279,8 +317,7 @@ const updateCraft = async () => { |
|
|
|
upDateLoading.value = false |
|
|
|
} |
|
|
|
|
|
|
|
const formData = ref({ |
|
|
|
}) |
|
|
|
const formData = ref({}) |
|
|
|
const addCraft = () => { |
|
|
|
console.log(form.value) |
|
|
|
formData.value = { |
|
|
@ -317,7 +354,7 @@ const addCraft = () => { |
|
|
|
<div style="display: flex"> |
|
|
|
<div class="select-box" /> |
|
|
|
</div> |
|
|
|
<div style="display: flex;position: relative"> |
|
|
|
<div style="display: flex; position: relative"> |
|
|
|
<div v-show="false" class="mask-box" /> |
|
|
|
<div |
|
|
|
v-for="(p, index) in form.position" |
|
|
@ -357,7 +394,11 @@ const addCraft = () => { |
|
|
|
alt="" |
|
|
|
@click="form.matrixPathType = 'vertical'" |
|
|
|
> |
|
|
|
<img :src="form.matrixPathType === 'grid' ? route_active : route" alt="" @click="form.matrixPathType = 'grid'"> |
|
|
|
<img |
|
|
|
:src="form.matrixPathType === 'grid' ? route_active : route" |
|
|
|
alt="" |
|
|
|
@click="form.matrixPathType = 'grid'" |
|
|
|
> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="Z轴高度" prop="motorZHeight"> |
|
|
@ -375,8 +416,14 @@ const addCraft = () => { |
|
|
|
<el-form-item label="是否加电" prop="highVoltageValue"> |
|
|
|
<div class="voltage-box"> |
|
|
|
<el-switch v-model="form.highVoltage" /> |
|
|
|
<el-input v-show="form.highVoltage" v-model="form.highVoltageValue" max="5000" type="number" class="voltage-input" /> |
|
|
|
<span v-show="form.highVoltage" class="unit-text"> V</span> |
|
|
|
<el-input |
|
|
|
v-show="form.highVoltage" |
|
|
|
v-model="form.highVoltageValue" |
|
|
|
max="5000" |
|
|
|
type="number" |
|
|
|
class="voltage-input" |
|
|
|
/> |
|
|
|
<span v-show="form.highVoltage" class="unit-text"> V</span> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="移动速度" prop="movingSpeed"> |
|
|
@ -401,13 +448,8 @@ const addCraft = () => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<el-drawer |
|
|
|
v-model="infoVisible" |
|
|
|
title="调整参数" |
|
|
|
direction="rtl" |
|
|
|
:close-on-click-modal="false" |
|
|
|
> |
|
|
|
<el-form label-width="auto" style="display: flex;flex-direction: column;justify-content: center"> |
|
|
|
<el-drawer v-model="infoVisible" title="调整参数" direction="rtl" :close-on-click-modal="false"> |
|
|
|
<el-form label-width="auto" style="display: flex; flex-direction: column; justify-content: center"> |
|
|
|
<div> |
|
|
|
<el-form-item label="Z轴高度" prop="motorZHeight"> |
|
|
|
<el-input v-model="updateForm.motorZHeight" type="number" /> |
|
|
@ -424,16 +466,21 @@ const addCraft = () => { |
|
|
|
<el-form-item label="是否加电" prop="highVoltageValue"> |
|
|
|
<div class="voltage-box"> |
|
|
|
<el-switch v-model="updateForm.highVoltage" /> |
|
|
|
<el-input v-show="updateForm.highVoltage" v-model="updateForm.highVoltageValue" type="number" class="voltage-input" /> |
|
|
|
<span v-show="updateForm.highVoltage" class="unit-text"> V</span> |
|
|
|
<el-input |
|
|
|
v-show="updateForm.highVoltage" |
|
|
|
v-model="updateForm.highVoltageValue" |
|
|
|
type="number" |
|
|
|
class="voltage-input" |
|
|
|
/> |
|
|
|
<span v-show="updateForm.highVoltage" class="unit-text"> V</span> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="移动速度" prop="movingSpeed"> |
|
|
|
<el-input v-model="form.movingSpeed" type="number" /> |
|
|
|
<el-input v-model="updateForm.movingSpeed" type="number" /> |
|
|
|
<span class="unit-text">mm/s</span> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<div style="display: flex; justify-content: center;width: 100%"> |
|
|
|
<div style="display: flex; justify-content: center; width: 100%"> |
|
|
|
<ft-button type="primary" @click="submitParam"> |
|
|
|
确定 |
|
|
|
</ft-button> |
|
|
@ -467,9 +514,9 @@ const addCraft = () => { |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
.el-input, .el-select { |
|
|
|
.el-input, |
|
|
|
.el-select { |
|
|
|
width: 400px; |
|
|
|
margin: 0 40px; |
|
|
|
} |
|
|
|