Browse Source

fix:断电恢复工艺; 工艺清洗添加字段volume

master
guoapeng 2 months ago
parent
commit
6b20f48f8f
  1. 32
      src/components/craft/AddCraft/index.vue
  2. 69
      src/components/home/CheckCraft/index.vue
  3. 23
      src/layouts/default.vue
  4. 26
      src/stores/systemStore.ts
  5. 2
      src/types/system.d.ts

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

@ -54,33 +54,34 @@ const okHandle = async () => {
}
//
const invalidStepIndex = form.value.stepList.findIndex(
(step: any) => {
(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
}
}
step.params.description = `${index}.`
switch (step.method) {
case 'clean':
step.params.description = `针头高度${step.params.height}mm清洗${step.params.cycle}`
step.params.description += `针头高度${step.params.height}mm, 加${step.params.volume}ml水清洗${step.params.cycle}`
break
case 'addLiquid':
step.params.description = `添加${solutionList.value.find(s => s.id === containerList.value.find(c => c.id === step.params.containerId)?.solutionId)?.name}-${step.params.volume}ml`
step.params.description += `添加${solutionList.value.find(s => s.id === containerList.value.find(c => c.id === step.params.containerId)?.solutionId)?.name}-${step.params.volume}ml`
break
case 'reduceLiquid':
step.params.description = `针头高度${step.params.height}mm抽取液体`
step.params.description += `针头高度${step.params.height}mm抽取液体`
break
case 'preHeat':
step.params.description = `预热到${step.params.temperature}`
step.params.description += `预热到${step.params.temperature}`
break
case 'heat':
step.params.description = `加热: ${step.params.temperature}度, 保持${step.params.minutes || 0}${step.params.seconds || 0}`
step.params.description += `加热: ${step.params.temperature}度, 保持${step.params.minutes || 0}${step.params.seconds || 0}`
break
case 'dry':
step.params.description = `烘干: ${step.params.temperature}度, 保持${step.params.minutes || 0}${step.params.seconds || 0}`
step.params.description += `烘干: ${step.params.temperature}度, 保持${step.params.minutes || 0}${step.params.seconds || 0}`
break
case 'anneal':
step.params.description = `退火: ${step.params.temperature}度, 保持${step.params.minutes || 0}${step.params.seconds || 0}`
step.params.description += `退火: ${step.params.temperature}度, 保持${step.params.minutes || 0}${step.params.seconds || 0}`
break
}
return !allPropertiesDefined(step.params, ['minutes', 'seconds', 'description'])
@ -118,7 +119,7 @@ const stepMap = {
addLiquid: { name: '加液', method: 'addLiquid', params: { volume: undefined, containerId: undefined, description: undefined } },
heat: { name: '加热', method: 'heat', params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined } },
reduceLiquid: { name: '抽液', method: 'reduceLiquid', params: { height: undefined, description: undefined } },
clean: { name: '清洗', method: 'clean', params: { cycle: undefined, height: undefined, description: undefined } },
clean: { name: '清洗', method: 'clean', params: { cycle: undefined, height: undefined, volume: 2, description: undefined } },
dry: { name: '烘干', method: 'dry', params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined } },
anneal: { name: '退火', method: 'anneal', params: { temperature: undefined, feedTemperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined } },
}
@ -152,14 +153,19 @@ const addStep = (data: any) => {
<div v-for="(item, index) in form.stepList" :key="index" class="step-item">
<el-form-item :label="`${index + 1}: ${item.name}`">
<template v-if="item.method === 'clean'">
<el-input v-model.number="item.params.cycle" type="number" size="small" placeholder="请输入次数">
<el-input v-model.number="item.params.height" type="number" size="small" placeholder="请输入高度">
<template #append>
mm
</template>
</el-input>
<el-input v-model.number="item.params.height" type="number" size="small" placeholder="请输入高度">
<el-input v-model.number="item.params.volume" style="width: 100px" type="number" size="small" placeholder="请输入加水量">
<template #append>
mm
ml
</template>
</el-input>
<el-input v-model.number="item.params.cycle" type="number" size="small" placeholder="请输入次数">
<template #append>
</template>
</el-input>
</template>

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

@ -0,0 +1,69 @@
<script setup lang="ts">
import { resumeCraft, stopCraft } from 'apis/crafts'
import { useSystemStore } from 'stores/systemStore'
const emits = defineEmits(['close'])
const systemStore = useSystemStore()
const tableData = computed(() => {
return systemStore.systemStatus.trays?.filter(item => item.crafts?.craft?.status === 'RESTORE').map((item) => {
return {
...item,
craftStepList: JSON.parse(item.crafts?.craft?.steps || '[]'),
currentIndex: item.crafts?.currentIndex,
}
})
})
const resumeCraftHandle = async (heatId: string) => {
await resumeCraft({
heatId,
})
}
const stopCraftHandle = async (heatId: string) => {
await stopCraft({
heatId,
})
}
const cancel = () => {
emits('close')
}
</script>
<template>
<FtDialog visible title="工艺恢复" width="70%" :ok-handle="okHandle" @cancel="cancel">
<el-table :data="tableData">
<el-table-column label="工艺名称">
<template #default="{ row }">
<span>{{ row.crafts?.craft?.name }}</span>
</template>
</el-table-column>
<el-table-column label="当前执行步骤">
<template #default="{ row }">
<span>{{ row.craftStepList?.[row.currentIndex]?.params?.description }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template #default="{ row }">
<ft-button type="primary" :click-handle="() => resumeCraftHandle(row.heatModuleCode)">
恢复
</ft-button>
<ft-button type="danger" :click-handle="() => stopCraftHandle(row.heatModuleCode)">
停止
</ft-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<ft-button @click="cancel">
关闭
</ft-button>
</template>
</FtDialog>
</template>
<style scoped lang="scss">
</style>

23
src/layouts/default.vue

@ -1,8 +1,10 @@
<script setup lang="ts">
import { getContainerList } from 'apis/container'
import { getSolsList } from 'apis/solution'
import { getStatus } from 'apis/system'
import logoutIcon from 'assets/images/logout.svg'
import Check from 'components/check/index.vue'
import CheckCraft from 'components/home/CheckCraft/index.vue'
import Liquid from 'components/home/Liquid/index.vue'
import Stop from 'components/Stop/index.vue'
import { useActivateDebug } from 'hooks/useActivateDebug'
@ -24,13 +26,29 @@ watch(() => currentTime.value, () => {
systemStore.currentTime = currentTime.value
})
watch (() => isClose.value, async (newVal) => {
if (newVal) {
const res = await getStatus()
systemStore.updateSystemStatus(res)
checkCraft()
}
})
onMounted(async () => {
solutionList.value = (await getSolsList()).list
if (!systemStore.systemStatus.selfTest && systemStore.systemStatus.currentUser?.username !== 'test') {
isCheck.value = true
return
}
solutionList.value = (await getSolsList()).list
checkCraft()
})
const checkCraftVisible = ref(false)
const checkCraft = () => {
if (systemStore.systemStatus.trays?.some(item => item.crafts?.state === 'RESTORE')) {
checkCraftVisible.value = true
}
}
// metaisDefault=true isDebug=true,debug
const menuList = computed(() => {
return authRoutes.filter((item) => {
@ -101,7 +119,7 @@ const commandHandle = async (command: string, params?: unknown) => {
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="systemStore.logout()">
<el-dropdown-item>
<div class="logout">
<span v-if="!isClose">已连接</span>
<span v-else>已断开</span>
@ -226,6 +244,7 @@ const commandHandle = async (command: string, params?: unknown) => {
<FtStream :visible="systemStore.streamVisible" />
<Check v-if="isCheck" @close="isCheck = false" />
<Stop v-if="systemStore.systemStatus.emergencyStop" />
<CheckCraft v-if="checkCraftVisible" @close="checkCraftVisible = false" />
</el-container>
</template>

26
src/stores/systemStore.ts

@ -61,7 +61,7 @@ export const useSystemStore = defineStore('system', {
{
moduleCode: 'heat_module_01',
enable: true,
trayStatus: true,
trayStatus: false,
heatingType: 'heating',
fanOpen: false,
targetTemperature: 0,
@ -184,7 +184,13 @@ export const useSystemStore = defineStore('system', {
},
],
crafts: {
state: 'READY',
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,
},
},
{
@ -201,7 +207,13 @@ export const useSystemStore = defineStore('system', {
},
],
crafts: {
state: 'READY',
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,
},
},
{
@ -213,7 +225,13 @@ export const useSystemStore = defineStore('system', {
tubes: [
],
crafts: {
state: 'READY',
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,
},
},
],

2
src/types/system.d.ts

@ -51,7 +51,7 @@ declare namespace System {
inHeatModule: boolean
tubes: Tubes[]
crafts?: {
state: 'READY' | 'RUNNING' | 'PAUSED' | 'STOPPED' | 'ERROR' | 'FINISHED'
state: 'READY' | 'RUNNING' | 'PAUSED' | 'STOPPED' | 'ERROR' | 'FINISHED' | 'RESTORE'
craft?: CraftTypes.Craft
currentIndex?: number
}

Loading…
Cancel
Save