Browse Source

fix: 工艺步骤调整

master
guoapeng 2 months ago
parent
commit
60e4a36a16
  1. 17
      src/components/craft/AddCraft/index.vue
  2. 6
      src/components/home/CheckCraft/index.vue
  3. 30
      src/components/home/Tube/index.vue
  4. 75
      src/stores/systemStore.ts
  5. 1
      src/types/system.d.ts
  6. 3
      src/views/home/index.vue

17
src/components/craft/AddCraft/index.vue

@ -52,11 +52,21 @@ const okHandle = async () => {
return
}
//
const errorMsg: string[] = []
const invalidStepIndex = form.value.stepList.findIndex((step: any, index) => {
if (['heat', 'dry', 'anneal'].includes(step.method)) {
if (step.params.minutes || step.params.seconds) {
step.params.time = (step.params.minutes || 0) * 60 + (step.params.seconds || 0) || undefined
}
if (step.params.temperature > 400 && step.method === 'anneal') {
errorMsg.push(`步骤${index + 1}: 退火温度不能超过400度`)
}
if (step.params.temperature > 200 && step.method === 'heat') {
errorMsg.push(`步骤${index + 1}: 加热温度不能超过400度`)
}
if (step.params.temperature > 200 && step.method === 'dry') {
errorMsg.push(`步骤${index + 1}: 烘干温度不能超过400度`)
}
}
step.params.description = `${index + 1}.`
switch (step.method) {
@ -93,6 +103,10 @@ const okHandle = async () => {
FtMessage.error(`步骤${invalidStepIndex + 1}: 请填写完整参数`)
return
}
if (errorMsg.length) {
FtMessage.error(errorMsg.join('; '))
return
}
form.value.steps = JSON.stringify(form.value.stepList)
form.value.oresId = oresId
@ -232,7 +246,7 @@ const addStep = (data: any) => {
</el-input>
</template>
<template v-else-if="['heat', 'dry', 'anneal'].includes(item.method)">
<el-input v-model.number="item.params.temperature" type="number" size="small" placeholder="加热温度">
<el-input v-model.number="item.params.temperature" type="number" :max="item.method === 'anneal' ? 400 : 200" size="small" placeholder="加热温度">
<template #append>
</template>
@ -326,6 +340,7 @@ const addStep = (data: any) => {
width: 100%;
display: flex;
align-items: center;
position: relative;
.el-input,
.el-select {

6
src/components/home/CheckCraft/index.vue

@ -17,11 +17,17 @@ const tableData = ref<any[]>([])
const resumeCraftHandle = async (monitorId: string) => {
await craftRestart(monitorId)
FtMessage.success('恢复成功')
loading.value = true
tableData.value = await craftList()
loading.value = false
}
const stopCraftHandle = async (monitorId: string) => {
await craftRemove(monitorId)
FtMessage.success('删除成功')
loading.value = true
tableData.value = await craftList()
loading.value = false
}
const cancel = () => {

30
src/components/home/Tube/index.vue

@ -3,6 +3,7 @@ import { pauseCraft, resumeCraft, stopCraft } from 'apis/crafts'
import { trayTube } from 'apis/home'
import errorIcon from 'assets/images/error.svg'
import ingIcon from 'assets/images/ing.svg'
import jaw_icon from 'assets/images/jaw.svg'
import successIcon from 'assets/images/success.svg'
import waitIcon from 'assets/images/wait.svg'
import CountDown from 'components/home/Countdown/Countdown.vue'
@ -96,14 +97,22 @@ defineExpose({
<div class="tube" :class="{ 'tube-active': hearInfo?.selected, 'tube-shadow': data.trayStatus }">
<div class="header">
<span>{{ hearInfo?.label }}</span>
<img v-if="tray?.useArm" :src="jaw_icon" alt="">
<el-tag v-show="!data.trayStatus" type="info">
空置
</el-tag>
<el-tag v-show="data.trayStatus" type="success">
已放置
</el-tag>
</div>
<div class="tube-item">
<div
class="tube-item" :class="{
'tube-item-anneal': ['annealing'].includes(data.heatingType),
'tube-item-dry': ['drying'].includes(data.heatingType),
'tube-item-heat': ['heating', 'constant'].includes(data.heatingType),
'tube-item-fan': data.fanOpen }"
>
<div v-if="!data.trayStatus" class="tube-disable" />
<div
v-if="craft?.state"
@ -127,7 +136,7 @@ defineExpose({
<span v-if="craft?.state === 'PAUSED'" class="status-text">工艺已暂停</span>
<span v-if="craft?.state === 'ERROR'" class="status-text">工艺执行错误</span>
<span v-if="craft?.state === 'FINISHED'" class="status-text">工艺执行成功</span>
<el-tooltip v-if="craft?.state === 'RUNNING' && craftSteps && craftSteps[craft.currentIndex || 0]?.params?.description" :content="`${(craft.currentIndex || 0) + 1}.${craftSteps[craft.currentIndex || 0].params.description}`" placement="top" trigger="click">
<el-tooltip v-if="craft?.state === 'RUNNING' && craftSteps && craftSteps[craft.currentIndex || 0]?.params?.description" :content="`${craftSteps[craft.currentIndex || 0].params.description}`" placement="top" trigger="click">
<div class="status-description">
{{ craftSteps[craft.currentIndex || 0].params.description }}
</div>
@ -162,7 +171,7 @@ defineExpose({
<span>{{ data.temperature || '--' }}</span>
<span></span>
</span>
<span v-show="data.fanOpen" style="color: #14A656;font-weight: bold">降温中</span>
<span v-show="data.fanOpen" style="color: #6CD3FF;font-weight: bold">降温中</span>
<span v-show="data.heatingType === 'heating'" style="color: #FE0A0A;font-weight: bold ">加热中</span>
<span v-show="data.heatingType === 'constant'" style="color: #FE0A0A;font-weight: bold ">恒温中</span>
<span v-show="data.heatingType === 'drying'" style="color: #F2652D;font-weight: bold ">烘干中</span>
@ -212,6 +221,21 @@ defineExpose({
justify-content: space-between;
align-items: center;
color: #4D6882;
img {
width: 20px;
}
}
.tube-item-heat {
background: #FE0A0A !important;
}
.tube-item-fan {
background: #6CD3FF !important;
}
.tube-item-dry {
background: #F2652D !important;
}
.tube-item-anneal {
background: #1677FF !important;
}
.tube-item {
padding: 5px;

75
src/stores/systemStore.ts

@ -66,7 +66,7 @@ export const useSystemStore = defineStore('system', {
{
moduleCode: 'heat_module_01',
enable: true,
trayStatus: false,
trayStatus: true,
heatingType: 'heating',
fanOpen: false,
targetTemperature: 0,
@ -118,6 +118,7 @@ export const useSystemStore = defineStore('system', {
inFeedArea: false,
inSolutionPositon: false,
inHeatModule: true,
useArm: true,
tubes: [
{
columnNum: 1,
@ -145,15 +146,15 @@ export const useSystemStore = defineStore('system', {
exists: true,
},
],
crafts: {
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
},
state: 'RUNNING',
currentIndex: 1,
},
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
{
uuid: '3',
@ -188,15 +189,15 @@ export const useSystemStore = defineStore('system', {
exists: true,
},
],
crafts: {
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
},
state: 'RUNNING',
currentIndex: 1,
},
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
{
uuid: '5',
@ -211,15 +212,15 @@ export const useSystemStore = defineStore('system', {
exists: true,
},
],
crafts: {
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
},
state: 'RUNNING',
currentIndex: 1,
},
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
{
uuid: '5',
@ -229,15 +230,15 @@ export const useSystemStore = defineStore('system', {
inHeatModule: true,
tubes: [
],
crafts: {
craft: {
id: 1,
name: '菱锌矿硫酸溶解法',
steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
},
state: 'RUNNING',
currentIndex: 1,
},
// crafts: {
// craft: {
// id: 1,
// name: '菱锌矿硫酸溶解法',
// steps: '[{"name":"加液","method":"addLiquid","params":{"addLiquidList":[{"containerId":1,"volume":3},{"containerId":4,"volume":4},{"containerId":3,"volume":5}],"description":["添加硫酸-3ml; ","添加氢氟酸-4ml; ","添加硝酸-5ml; "]}},{"name":"加热","method":"startHeating","params":{"temperature":4,"second":123,"description":"加热: 4度, 保持2分3秒","minutes":2,"seconds":3}},{"name":"摇匀","method":"shaking","params":{"second":122,"seconds":2,"minutes":2,"description":"摇匀: 122秒"}},{"name":"拍照","method":"takePhoto","params":{"description":"拍照"}}]',
// },
// state: 'RUNNING',
// currentIndex: 1,
// },
},
],
},

1
src/types/system.d.ts

@ -50,6 +50,7 @@ declare namespace System {
inFeedArea: boolean
inSolutionPositon: boolean
inHeatModule: boolean
useArm?: boolean
tubes: Tubes[]
crafts?: {
state: 'READY' | 'RUNNING' | 'PAUSED' | 'STOPPED' | 'ERROR' | 'FINISHED' | 'RESTORE'

3
src/views/home/index.vue

@ -286,6 +286,9 @@ const moreVisible = ref(false)
<ft-button size="large" @click="extractLiquidVisible = true">
抽取溶液
</ft-button>
<ft-button size="large" :click-handle="() => commandHandle('drain_liquid')">
关机排空
</ft-button>
<ft-button size="large" :click-handle="() => commandHandle('liquid_motor_origin')">
加液臂回原点
</ft-button>

Loading…
Cancel
Save