|
|
@ -6,9 +6,12 @@ |
|
|
|
:heatInfo="{ ...item, index }" |
|
|
|
:tubeIndex="index + 1" |
|
|
|
@onSelectedTray="onSelectedTray" |
|
|
|
@onSetHeatAreaTemp = "onSetHeatAreaTemp" |
|
|
|
@onSelectCraft="(craftData)=>{onSelectCraft(item, craftData)}" |
|
|
|
></HeatPosition> |
|
|
|
@onSetHeatAreaTemp="onSetHeatAreaTemp" |
|
|
|
@onSelectCraft=" |
|
|
|
craftData => { |
|
|
|
onSelectCraft(item, craftData); |
|
|
|
} |
|
|
|
"></HeatPosition> |
|
|
|
</div> |
|
|
|
<!--执行中状态的遮罩层--> |
|
|
|
</div> |
|
|
@ -29,58 +32,27 @@ |
|
|
|
</div> --> |
|
|
|
<!--操作区--> |
|
|
|
<div class="graphite_btn_container"> |
|
|
|
<van-button v-if="doorStatus" size="large" class="btn_size op_open_door" @click="onCloseDoor" |
|
|
|
>关门</van-button |
|
|
|
> |
|
|
|
<van-button v-else size="large" class="btn_size op_open_door" @click="onOPenDoor" |
|
|
|
>开门</van-button |
|
|
|
> |
|
|
|
|
|
|
|
<van-button size="large" class="btn_size op_start_task" @click="startTask" |
|
|
|
>开始实验</van-button |
|
|
|
> |
|
|
|
<van-button size="large" class="btn_size op_stop_task" @click="onEndTask" |
|
|
|
>结束实验</van-button |
|
|
|
<van-button v-if="doorStatus" size="large" class="btn_size op_open_door" @click="onCloseDoor">关门</van-button> |
|
|
|
<van-button v-else size="large" class="btn_size op_open_door" @click="onOPenDoor">开门</van-button> |
|
|
|
|
|
|
|
<van-button size="large" class="btn_size op_start_task" @click="startTask">开始实验</van-button> |
|
|
|
<van-button size="large" class="btn_size op_stop_task" @click="onEndTask">结束实验</van-button> |
|
|
|
<van-button size="large" class="btn_size op_select_craft" @click="onChooseCaft">{{ craftName }}</van-button> |
|
|
|
<van-button size="large" class="btn_size op_exec_craft" @click="onCraftStart()">{{ exeCraftName }}</van-button> |
|
|
|
<van-button size="large" class="btn_size op_add_liquid" @click="onAddLiquid">添加溶液</van-button> |
|
|
|
<van-button v-if="!isSharking" size="large" class="btn_size op_shake_up" @click="onStartShakingTube" |
|
|
|
>摇匀</van-button |
|
|
|
> |
|
|
|
<van-button |
|
|
|
size="large" |
|
|
|
class="btn_size op_select_craft" |
|
|
|
@click="onChooseCaft" |
|
|
|
>{{ craftName }}</van-button |
|
|
|
> |
|
|
|
<van-button size="large" class="btn_size op_exec_craft" @click="onCraftStart()" |
|
|
|
>{{ exeCraftName }}</van-button |
|
|
|
> |
|
|
|
<van-button |
|
|
|
size="large" |
|
|
|
class="btn_size op_add_liquid" |
|
|
|
@click="onAddLiquid" |
|
|
|
>添加溶液</van-button |
|
|
|
> |
|
|
|
<van-button v-if="!isSharking" size="large" class="btn_size op_shake_up" @click="onStartShakingTube">摇匀</van-button> |
|
|
|
<van-button v-else size="large" class="btn_size op_shake_up" @click="onStopShakingTube">结束摇匀</van-button> |
|
|
|
<van-button |
|
|
|
size="large" |
|
|
|
class="btn_size op_move_heat" |
|
|
|
@click="onMoveToHeat" |
|
|
|
>移至加热</van-button |
|
|
|
> |
|
|
|
<van-button size="large" class="btn_size op_move_act" @click="onMoveToOperationArea" |
|
|
|
>移至加液</van-button |
|
|
|
> |
|
|
|
<van-button size="large" class="btn_size op_move_exception" @click="onMoveToSpecial" |
|
|
|
>移至特殊</van-button |
|
|
|
> |
|
|
|
<van-button size="large" class="btn_size op_move_heat" @click="onMoveToHeat">移至加热</van-button> |
|
|
|
<van-button size="large" class="btn_size op_move_act" @click="onMoveToOperationArea">移至加液</van-button> |
|
|
|
<van-button size="large" class="btn_size op_move_exception" @click="onMoveToSpecial">移至特殊</van-button> |
|
|
|
<van-button v-if="!isHeating" size="large" class="btn_size op_start_heat" @click="onStartHeat" |
|
|
|
>开始加热</van-button |
|
|
|
> |
|
|
|
<van-button v-else size="large" class="btn_size op_start_heat" @click="onStopHeat" |
|
|
|
>停止加热</van-button |
|
|
|
> |
|
|
|
<van-button v-else size="large" class="btn_size op_start_heat" @click="onStopHeat">停止加热</van-button> |
|
|
|
|
|
|
|
<van-button size="large" class="btn_size op_up_tray" @click="onUpTray" |
|
|
|
>抬起托盘</van-button |
|
|
|
> |
|
|
|
<van-button size="large" class="btn_size op_up_tray" @click="onUpTray">抬起托盘</van-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<van-overlay :show="liquidVisible" v-if="liquidVisible" style="z-index: 9999"> |
|
|
@ -89,8 +61,7 @@ |
|
|
|
<AddLiquid |
|
|
|
:currentSelectedTube="currentSelectedTube" |
|
|
|
@cancel="liquidVisible = false" |
|
|
|
@onAddSolution="onAddSolution" |
|
|
|
></AddLiquid> |
|
|
|
@onAddSolution="onAddSolution"></AddLiquid> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</van-overlay> |
|
|
@ -102,18 +73,16 @@ |
|
|
|
<!--实验名称--> |
|
|
|
<OverlayModal :visible="taskNameVisible"> |
|
|
|
<div class="task_name"> |
|
|
|
<div class="task_title"> |
|
|
|
开始新实验 |
|
|
|
</div> |
|
|
|
<div class="task_title">开始新实验</div> |
|
|
|
<div class="task_name_content"> |
|
|
|
<div class='mt-3'>实验名称:</div> |
|
|
|
<div class="mt-3">实验名称:</div> |
|
|
|
<div class="task_auto"> |
|
|
|
<input v-model="taskName" placeholder="实验名称" class="task_input" /> |
|
|
|
<div v-if="!taskName" style="color:red;font-size: 1rem;">请输入实验名称</div> |
|
|
|
<div v-if="!taskName" style="color: red; font-size: 1rem">请输入实验名称</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<br/> |
|
|
|
<br /> |
|
|
|
<footer class="task_button"> |
|
|
|
<button class="btn-dark px-2 py-1 min-w-20" @click="onSave">保存</button> |
|
|
|
<button class="cancel_btn" @click="onCancel">取消</button> |
|
|
@ -125,79 +94,77 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
import { ref, reactive, onMounted, onUnmounted, watch } from "vue"; |
|
|
|
//@ts-ignore |
|
|
|
import {ElMessage, ElMessageBox} from "element-plus"; |
|
|
|
import { ElMessage, ElMessageBox } from "element-plus"; |
|
|
|
import { createWebSocket, sharedWsUrl } from "@/services/socket"; |
|
|
|
import { HeatPosition, TakePickture, AddLiquid } from "./components"; |
|
|
|
import OverlayModal from "@/components/OverlayModal.vue"; |
|
|
|
import CraftList from "@/views/graphite/components/CraftList.vue"; |
|
|
|
import { injectFluid } from "@/services/task/task"; |
|
|
|
import { useStatusStore } from "@/stores/status"; |
|
|
|
import {getIngTask, saveTaskName, stopTask} from '@/services/task/task'; |
|
|
|
import { |
|
|
|
CmdDescMap, |
|
|
|
taskCmd, |
|
|
|
type OperationCmd, |
|
|
|
} from "@/services/globalCmd/globalCmd"; |
|
|
|
import { setOnGoingStatus, useStatusStore } from "@/stores/status"; |
|
|
|
import { getIngTask, saveTaskName, stopTask } from "@/services/task/task"; |
|
|
|
import { CmdDescMap, taskCmd, type OperationCmd } from "@/services/globalCmd/globalCmd"; |
|
|
|
import { craftStart, craftStop } from "@/services/ore/oreManage"; |
|
|
|
import { getTxnRecord } from "@/services/txn"; |
|
|
|
import { useSettingStore } from "@/stores/setting"; |
|
|
|
import { useCraftStore } from "@/stores/craft"; |
|
|
|
|
|
|
|
const craftStore = useCraftStore() |
|
|
|
const craftInfo = ref(craftStore.craftInfo) |
|
|
|
const craftStore = useCraftStore(); |
|
|
|
const craftInfo = ref(craftStore.craftInfo); |
|
|
|
const settingStore = useSettingStore(); |
|
|
|
const craftName = ref('选择工艺') |
|
|
|
const exeCraftName = ref('执行工艺') |
|
|
|
watch(()=>craftStore.craftInfo, (newVal)=>{ |
|
|
|
craftInfo.value = newVal |
|
|
|
if(newVal?.status == 1){ |
|
|
|
craftName.value = '暂停工艺' |
|
|
|
exeCraftName.value = '停止工艺' |
|
|
|
} |
|
|
|
}) |
|
|
|
const craftName = ref("选择工艺"); |
|
|
|
const exeCraftName = ref("执行工艺"); |
|
|
|
watch( |
|
|
|
() => craftStore.craftInfo, |
|
|
|
newVal => { |
|
|
|
craftInfo.value = newVal; |
|
|
|
if (newVal?.status == 1) { |
|
|
|
craftName.value = "暂停工艺"; |
|
|
|
exeCraftName.value = "停止工艺"; |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
//设备的全局状态 |
|
|
|
const statusStore = useStatusStore(); |
|
|
|
const heatAearStatusList = ref(statusStore.status?.heatArea || []) |
|
|
|
const heatAearStatusList = ref(statusStore.status?.heatArea || []); |
|
|
|
const heatList: any = ref([]); |
|
|
|
const craftVisible = ref(false); |
|
|
|
let tubeList = reactive<any>([]); |
|
|
|
const selectedColor = "#4F85FB"; |
|
|
|
const emptyColor = "#FFFFFF"; |
|
|
|
const taskName = ref('') |
|
|
|
let globeStatus:any = 0; |
|
|
|
const taskName = ref(""); |
|
|
|
let globeStatus: any = 0; |
|
|
|
onMounted(() => { |
|
|
|
//6个加热区数据 |
|
|
|
heatList.value = settingStore.heatAreaConfig.map((item:any) => { |
|
|
|
heatList.value = settingStore.heatAreaConfig.map((item: any) => { |
|
|
|
//添加一个字段,默认为未选中 |
|
|
|
item.isSelect = false; |
|
|
|
heatAearStatusList.value.forEach((areaItem:any) => { |
|
|
|
if(areaItem.hardwareId == item.hardwareId){ |
|
|
|
heatAearStatusList.value.forEach((areaItem: any) => { |
|
|
|
if (areaItem.hardwareId == item.hardwareId) { |
|
|
|
item = { |
|
|
|
...item, |
|
|
|
heatAearStatus:areaItem |
|
|
|
} |
|
|
|
heatAearStatus: areaItem, |
|
|
|
}; |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
//设备16个试管的基础数据 |
|
|
|
tubeBaseConfig(); |
|
|
|
//连接socket |
|
|
|
const wsClient = createWebSocket(sharedWsUrl); |
|
|
|
const subscription = wsClient.dataOb.subscribe((data) => { |
|
|
|
if(!globeStatus){//为了只输入一行,不想后台一直打印此处日志 TODO |
|
|
|
console.log('globeStatus====', data) |
|
|
|
const subscription = wsClient.dataOb.subscribe(data => { |
|
|
|
if (!globeStatus) { |
|
|
|
//为了只输入一行,不想后台一直打印此处日志 TODO |
|
|
|
console.log("globeStatus====", data); |
|
|
|
} |
|
|
|
globeStatus = 1; |
|
|
|
if (data.type === "cmd") { |
|
|
|
const cmdInfo = getTxnRecord(data.data.commandId, "task"); |
|
|
|
if (cmdInfo) { |
|
|
|
const command:any = cmdInfo.command; |
|
|
|
const command: any = cmdInfo.command; |
|
|
|
//@ts-ignore |
|
|
|
const cmdName = CmdDescMap[command]; |
|
|
|
const result = data.data.success |
|
|
|
? "执行完毕" |
|
|
|
: `执行失败 ${data.data.message}`; |
|
|
|
const result = data.data.success ? "执行完毕" : `执行失败 ${data.data.message}`; |
|
|
|
ElMessage({ |
|
|
|
message: `${cmdName} ${result}`, |
|
|
|
type: data.data.success ? "success" : "error", |
|
|
@ -215,50 +182,51 @@ onMounted(() => { |
|
|
|
//选中的托盘 |
|
|
|
const selectedTrayList = ref<any>([]); |
|
|
|
const selectedTrayObj: any = {}; |
|
|
|
const onSelectedTray = (heatAreaItem: any, type:string) => { |
|
|
|
const onSelectedTray = (heatAreaItem: any, type: string) => { |
|
|
|
heatList.value[heatAreaItem.index] = heatAreaItem; |
|
|
|
//取消选中,已经存在selectedTrayList中 |
|
|
|
let ids = selectedTrayList.value.map((tube:any) =>tube.id) |
|
|
|
if(type == 'isClick'){//点击加热区 |
|
|
|
if(ids.includes(heatAreaItem.id)){ |
|
|
|
let ids = selectedTrayList.value.map((tube: any) => tube.id); |
|
|
|
if (type == "isClick") { |
|
|
|
//点击加热区 |
|
|
|
if (ids.includes(heatAreaItem.id)) { |
|
|
|
heatAreaItem.isSelect = false; |
|
|
|
selectedTrayList.value = selectedTrayList.value.filter((selectedItem:any) => selectedItem.id != heatAreaItem.id) |
|
|
|
}else{ |
|
|
|
selectedTrayList.value = selectedTrayList.value.filter((selectedItem: any) => selectedItem.id != heatAreaItem.id); |
|
|
|
} else { |
|
|
|
heatAreaItem.isSelect = true; |
|
|
|
selectedTrayList.value.push(heatAreaItem) |
|
|
|
selectedTrayList.value.push(heatAreaItem); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
heatAreaItem.isSelect = true; |
|
|
|
} |
|
|
|
heatList.value.forEach((item:any) => { |
|
|
|
if(item.id == heatAreaItem.id){ |
|
|
|
item = heatAreaItem |
|
|
|
onHeadleCraft(item) |
|
|
|
heatList.value.forEach((item: any) => { |
|
|
|
if (item.id == heatAreaItem.id) { |
|
|
|
item = heatAreaItem; |
|
|
|
onHeadleCraft(item); |
|
|
|
} |
|
|
|
}) |
|
|
|
console.log('hasCraftInfo---', hasCraftInfo.value) |
|
|
|
}); |
|
|
|
console.log("hasCraftInfo---", hasCraftInfo.value); |
|
|
|
}; |
|
|
|
|
|
|
|
//选择的加热区是否选择了工艺 |
|
|
|
let hasCraftInfo = ref(false) |
|
|
|
const onHeadleCraft = (areaItem:any)=>{ |
|
|
|
if(areaItem.craftInfo){ |
|
|
|
let hasCraftInfo = ref(false); |
|
|
|
const onHeadleCraft = (areaItem: any) => { |
|
|
|
if (areaItem.craftInfo) { |
|
|
|
hasCraftInfo.value = true; |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//设置加热区温度 |
|
|
|
const onSetHeatAreaTemp = (dataInfo:any) => { |
|
|
|
const onSetHeatAreaTemp = (dataInfo: any) => { |
|
|
|
selectedTrayObj[dataInfo.id] = dataInfo; |
|
|
|
selectedTrayList.value = Object.values(selectedTrayObj); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//加热区选择的工艺 |
|
|
|
const onSelectCraft = (item:any, craftInfo:any) => { |
|
|
|
const onSelectCraft = (item: any, craftInfo: any) => { |
|
|
|
item.isSelect = true; |
|
|
|
item.craftInfo = craftInfo |
|
|
|
onSelectedTray(item,'isMove') |
|
|
|
} |
|
|
|
item.craftInfo = craftInfo; |
|
|
|
onSelectedTray(item, "isMove"); |
|
|
|
}; |
|
|
|
//开始执行工艺 |
|
|
|
const onCraftStart = () => { |
|
|
|
if (!selectedTrayList.value.length) { |
|
|
@ -269,46 +237,43 @@ const onCraftStart = () => { |
|
|
|
//可能会选择多个加热区执行工艺, 批量发送指令 |
|
|
|
let hasCraft = true; |
|
|
|
let len = selectedTrayList.value.length; |
|
|
|
for(let i = 0; i < len; i++){ |
|
|
|
let item = selectedTrayList.value[i] |
|
|
|
if(!item.craftInfo){ |
|
|
|
for (let i = 0; i < len; i++) { |
|
|
|
let item = selectedTrayList.value[i]; |
|
|
|
if (!item.craftInfo) { |
|
|
|
hasCraft = false; |
|
|
|
ElMessage.error('选择的加热区未选择工艺') |
|
|
|
ElMessage.error("选择的加热区未选择工艺"); |
|
|
|
break; |
|
|
|
} |
|
|
|
const params = { |
|
|
|
craftId:null, |
|
|
|
heatId: item.id |
|
|
|
} |
|
|
|
if(craftInfo.value?.status == 1){ |
|
|
|
craftId: null, |
|
|
|
heatId: item.id, |
|
|
|
}; |
|
|
|
if (craftInfo.value?.status == 1) { |
|
|
|
craftStop(params).then(res => { |
|
|
|
ElMessage.success('已停止执行工艺的指令') |
|
|
|
}) |
|
|
|
return |
|
|
|
}else{ |
|
|
|
params.craftId = item.craftInfo.id |
|
|
|
ElMessage.success("已停止执行工艺的指令"); |
|
|
|
}); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
params.craftId = item.craftInfo.id; |
|
|
|
craftStart(params).then(res => { |
|
|
|
ElMessage.success('已执行工艺的指令') |
|
|
|
}) |
|
|
|
ElMessage.success("已执行工艺的指令"); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(hasCraft){ |
|
|
|
if (hasCraft) { |
|
|
|
//给选择加热区heatList加一个正在执行工艺的标识 |
|
|
|
const selectedIds = selectedTrayList.value.map((item:any) => item.id) |
|
|
|
heatList.value.forEach((item:any) => { |
|
|
|
if(selectedIds.includes(item.id)){ |
|
|
|
const selectedIds = selectedTrayList.value.map((item: any) => item.id); |
|
|
|
heatList.value.forEach((item: any) => { |
|
|
|
if (selectedIds.includes(item.id)) { |
|
|
|
item.executing_craft = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//停止工艺 |
|
|
|
const onCraftStop = () => { |
|
|
|
|
|
|
|
} |
|
|
|
const onCraftStop = () => {}; |
|
|
|
|
|
|
|
const tubeBaseConfig = () => { |
|
|
|
//默认为16个 |
|
|
@ -324,11 +289,11 @@ const tubeBaseConfig = () => { |
|
|
|
const liquidVisible = ref(false); |
|
|
|
const onAddLiquid = () => { |
|
|
|
//检查加液区是否有试管。 |
|
|
|
const liquidArea = statusStore.status?.liquidArea |
|
|
|
if(liquidArea){ |
|
|
|
const liquidArea = statusStore.status?.liquidArea; |
|
|
|
if (liquidArea) { |
|
|
|
liquidVisible.value = true; |
|
|
|
}else{ |
|
|
|
ElMessage.error('加液区未检测到托盘,无法进行加液操作') |
|
|
|
} else { |
|
|
|
ElMessage.error("加液区未检测到托盘,无法进行加液操作"); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
@ -336,10 +301,16 @@ const onAddSolution = (data: any) => { |
|
|
|
let ids = data.map((item: any) => item.id); |
|
|
|
//批量发送加液指令 |
|
|
|
const params = { |
|
|
|
injectFluids:data |
|
|
|
injectFluids: data, |
|
|
|
}; |
|
|
|
injectFluid(params).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setOnGoingStatus("injecting"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
injectFluid(params) |
|
|
|
globeStatus = 0 |
|
|
|
}); |
|
|
|
globeStatus = 0; |
|
|
|
// tubeList.forEach((item: any) => { |
|
|
|
// if (ids.includes(item.id)) { |
|
|
|
// item.default = defaultColor; |
|
|
@ -364,21 +335,20 @@ const onChooseCaft = () => { |
|
|
|
}; |
|
|
|
|
|
|
|
//选择的工艺 |
|
|
|
const onHandleSelectedCraft = (craftInfo:any) => { |
|
|
|
selectedTrayList.value.forEach((item:any) => { |
|
|
|
const onHandleSelectedCraft = (craftInfo: any) => { |
|
|
|
selectedTrayList.value.forEach((item: any) => { |
|
|
|
item.isSelect = true; |
|
|
|
item.craftInfo = craftInfo |
|
|
|
onSelectedTray(item,'isMove') |
|
|
|
|
|
|
|
}) |
|
|
|
const selectedIds = selectedTrayList.value.map((item:any) => item.id) |
|
|
|
heatList.value.forEach((item:any) => { |
|
|
|
if(selectedIds.includes(item.id)){ |
|
|
|
item.craftInfo = craftInfo; |
|
|
|
onSelectedTray(item, "isMove"); |
|
|
|
}); |
|
|
|
const selectedIds = selectedTrayList.value.map((item: any) => item.id); |
|
|
|
heatList.value.forEach((item: any) => { |
|
|
|
if (selectedIds.includes(item.id)) { |
|
|
|
item.craftInfo = craftInfo; |
|
|
|
} |
|
|
|
}); |
|
|
|
changeVisible(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
const onChooseTube = (tubeItem: any, index: any) => { |
|
|
|
if (!tubeItem.id) return; |
|
|
@ -413,12 +383,12 @@ const onMoveToHeat = () => { |
|
|
|
//2、判断选择的加热区是否已经有了试管架, 加热区是否有试管是通过设备上报的数据获取的 |
|
|
|
let hardwareId = selectedDataItem.hardwareId; |
|
|
|
// let trayStatus = heatAearStatusList.value[selectedDataItem.index].trayStatus; |
|
|
|
let trayStatus |
|
|
|
heatAearStatusList.value.forEach((item:any) => { |
|
|
|
if(hardwareId == item.hardwareId){ |
|
|
|
trayStatus = item.trayStatus |
|
|
|
let trayStatus; |
|
|
|
heatAearStatusList.value.forEach((item: any) => { |
|
|
|
if (hardwareId == item.hardwareId) { |
|
|
|
trayStatus = item.trayStatus; |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
// trayStatus: 0为无托盘,1为有托盘,2为托盘抬起 |
|
|
|
if (trayStatus == 1) { |
|
|
|
ElMessage.error("选择的加热区已有试管架,重新选择加热区"); |
|
|
@ -430,9 +400,10 @@ const onMoveToHeat = () => { |
|
|
|
heatId: selectedDataItem.id, |
|
|
|
}; |
|
|
|
const command: OperationCmd = "moveToHeatArea"; |
|
|
|
taskCmd({ command, params }).then((res) => { |
|
|
|
taskCmd({ command, params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
setOnGoingStatus("movingToHeat"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
@ -448,15 +419,15 @@ const onMoveToHeat = () => { |
|
|
|
item.isSelect = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
tubeList.forEach((item:any) => { |
|
|
|
item.color = ''; |
|
|
|
item.default = '' |
|
|
|
tubeList.forEach((item: any) => { |
|
|
|
item.color = ""; |
|
|
|
item.default = ""; |
|
|
|
}); |
|
|
|
heatList.value = [...list]; |
|
|
|
}; |
|
|
|
|
|
|
|
//移至加液区(操作区) |
|
|
|
const currentSelectedTube = ref({}) |
|
|
|
const currentSelectedTube = ref({}); |
|
|
|
const onMoveToOperationArea = () => { |
|
|
|
//1、判断加液区是否有试管架(暂时获取不到这个状态) |
|
|
|
//1、是否选择了试管架/加热区 |
|
|
@ -470,41 +441,41 @@ const onMoveToOperationArea = () => { |
|
|
|
return false; |
|
|
|
} |
|
|
|
let selectedDataItem = selectedTrayList.value[0]; |
|
|
|
currentSelectedTube.value = selectedDataItem |
|
|
|
currentSelectedTube.value = selectedDataItem; |
|
|
|
//3、选择的加热区有没有试管架 |
|
|
|
if(!selectedDataItem.tubeList || !selectedDataItem.tubeList.length){ |
|
|
|
if (!selectedDataItem.tubeList || !selectedDataItem.tubeList.length) { |
|
|
|
ElMessage.error("选择的加热区没有试管架"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
//4、发送移至加液区指令 |
|
|
|
const params = { |
|
|
|
heatId: selectedDataItem.id |
|
|
|
} |
|
|
|
onSendCmd('moveToActionArea', params) |
|
|
|
heatId: selectedDataItem.id, |
|
|
|
}; |
|
|
|
onSendCmd("moveToActionArea", params); |
|
|
|
//更新UI |
|
|
|
heatList.value.forEach((item:any) => { |
|
|
|
if(item.id == selectedDataItem.id){ |
|
|
|
tubeList = [...item.tubeList] |
|
|
|
heatList.value.forEach((item: any) => { |
|
|
|
if (item.id == selectedDataItem.id) { |
|
|
|
tubeList = [...item.tubeList]; |
|
|
|
} |
|
|
|
}) |
|
|
|
onSelectedTray(selectedDataItem, 'isMove') |
|
|
|
}); |
|
|
|
onSelectedTray(selectedDataItem, "isMove"); |
|
|
|
return true; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//移至特殊区域 |
|
|
|
const onMoveToSpecial = () => { |
|
|
|
//检查是否设置了异常区域 |
|
|
|
const systemSetting = settingStore.systemSetting |
|
|
|
let specialArea:any = {} |
|
|
|
if(systemSetting && systemSetting.length){ |
|
|
|
const systemSetting = settingStore.systemSetting; |
|
|
|
let specialArea: any = {}; |
|
|
|
if (systemSetting && systemSetting.length) { |
|
|
|
systemSetting.forEach(item => { |
|
|
|
if(item.code == "sys_setting_abnormal_area"){ |
|
|
|
if (item.code == "sys_setting_abnormal_area") { |
|
|
|
specialArea = item; |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
if(!specialArea.id){ |
|
|
|
ElMessage.error('未设置异常区域,请在系统配置中设置') |
|
|
|
if (!specialArea.id) { |
|
|
|
ElMessage.error("未设置异常区域,请在系统配置中设置"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -519,93 +490,99 @@ const onMoveToSpecial = () => { |
|
|
|
return; |
|
|
|
} |
|
|
|
let selectedDataItem = selectedTrayList.value[0]; |
|
|
|
selectedDataItem.isSelect = false |
|
|
|
onSelectedTray(selectedDataItem, 'isMove') |
|
|
|
selectedDataItem.isSelect = false; |
|
|
|
onSelectedTray(selectedDataItem, "isMove"); |
|
|
|
|
|
|
|
const params = { |
|
|
|
heatId:selectedDataItem.id |
|
|
|
} |
|
|
|
onSendCmd('moveToActionArea', params) |
|
|
|
heatId: selectedDataItem.id, |
|
|
|
}; |
|
|
|
onSendCmd("moveToActionArea", params); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//开始实验 |
|
|
|
const taskNameVisible = ref(false) |
|
|
|
const taskId = ref() |
|
|
|
const onSave = ()=> { |
|
|
|
if(!taskName.value)return; |
|
|
|
const taskNameVisible = ref(false); |
|
|
|
const taskId = ref(); |
|
|
|
const onSave = () => { |
|
|
|
if (!taskName.value) return; |
|
|
|
const params = { |
|
|
|
name: taskName.value |
|
|
|
} |
|
|
|
name: taskName.value, |
|
|
|
}; |
|
|
|
saveTaskName(params).then(res => { |
|
|
|
if(res.success){ |
|
|
|
if (res.success) { |
|
|
|
taskId.value = res.data.id; |
|
|
|
ElMessage.success('保存成功') |
|
|
|
onCancel() |
|
|
|
}else{ |
|
|
|
ElMessage.error(res.msg) |
|
|
|
ElMessage.success("保存成功"); |
|
|
|
onCancel(); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const startTask = async () => { |
|
|
|
const res = await getIngTask(); |
|
|
|
|
|
|
|
if(res.data) { |
|
|
|
ElMessageBox.confirm(`上一实验"${res.data.name}"未结束,是否结束并开始新的实验`, '提示', { |
|
|
|
if (res.data) { |
|
|
|
ElMessageBox.confirm(`上一实验"${res.data.name}"未结束,是否结束并开始新的实验`, "提示", { |
|
|
|
confirmButtonText: "确定", |
|
|
|
cancelButtonText: "取消", |
|
|
|
center: true, |
|
|
|
}).then(() => { |
|
|
|
stopTask({taskId: res.data.id}).then(res=> { |
|
|
|
if(res.success){ |
|
|
|
ElMessage.success('实验已停止') |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
stopTask({ taskId: res.data.id }) |
|
|
|
.then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("实验已停止"); |
|
|
|
taskNameVisible.value = true; |
|
|
|
}else{ |
|
|
|
ElMessage.error('实验停止失败') |
|
|
|
} else { |
|
|
|
ElMessage.error("实验停止失败"); |
|
|
|
} |
|
|
|
}).catch(e=>{ |
|
|
|
ElMessage.error(e) |
|
|
|
}) |
|
|
|
}).catch(() => {}) |
|
|
|
}else { |
|
|
|
taskNameVisible.value = true |
|
|
|
.catch(e => { |
|
|
|
ElMessage.error(e); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.catch(() => {}); |
|
|
|
} else { |
|
|
|
taskNameVisible.value = true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//结束实验 |
|
|
|
const onEndTask = () => { |
|
|
|
const params = { |
|
|
|
taskId: taskId.value |
|
|
|
} |
|
|
|
stopTask(params).then(res=> { |
|
|
|
heatList.value.forEach((item:any) => { |
|
|
|
taskId: taskId.value, |
|
|
|
}; |
|
|
|
stopTask(params) |
|
|
|
.then(res => { |
|
|
|
heatList.value.forEach((item: any) => { |
|
|
|
item.executing_craft = false; |
|
|
|
}); |
|
|
|
if(res.success){ |
|
|
|
ElMessage.success('实验已停止') |
|
|
|
}else{ |
|
|
|
ElMessage.error('实验停止失败') |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("实验已停止"); |
|
|
|
} else { |
|
|
|
ElMessage.error("实验停止失败"); |
|
|
|
} |
|
|
|
}).catch(e=>{ |
|
|
|
ElMessage.error(e) |
|
|
|
}) |
|
|
|
} |
|
|
|
.catch(e => { |
|
|
|
ElMessage.error(e); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
const onCancel = ()=> { |
|
|
|
const onCancel = () => { |
|
|
|
taskNameVisible.value = false; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//开门 |
|
|
|
const doorStatus = ref(false)//开门状态 。true: 门已打开, false: 门未打开 |
|
|
|
const doorStatus = ref(false); //开门状态 。true: 门已打开, false: 门未打开 |
|
|
|
const onOPenDoor = () => { |
|
|
|
const params = {}; |
|
|
|
const command: OperationCmd = "openDoor"; |
|
|
|
taskCmd({ command, params }).then((res) => { |
|
|
|
taskCmd({ command, params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
doorStatus.value = true; |
|
|
|
setOnGoingStatus("doorOpening"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
@ -616,18 +593,19 @@ const onOPenDoor = () => { |
|
|
|
const onCloseDoor = () => { |
|
|
|
const params = {}; |
|
|
|
const command: OperationCmd = "closeDoor"; |
|
|
|
taskCmd({ command, params }).then((res) => { |
|
|
|
taskCmd({ command, params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
doorStatus.value = false; |
|
|
|
setOnGoingStatus("doorClosing"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//开始加热 |
|
|
|
const isHeating = ref(false) |
|
|
|
const isHeating = ref(false); |
|
|
|
const onStartHeat = () => { |
|
|
|
//选择的加热区 |
|
|
|
if (!selectedTrayList.value.length) { |
|
|
@ -638,43 +616,43 @@ const onStartHeat = () => { |
|
|
|
let existTubeRack = true; |
|
|
|
//加热区是否设置了加热温度 |
|
|
|
let hasSetTemp = true; |
|
|
|
selectedTrayList.value.forEach((item:any) => { |
|
|
|
selectedTrayList.value.forEach((item: any) => { |
|
|
|
let tubeList = item.tubeList; |
|
|
|
if(!tubeList || !tubeList.length){ |
|
|
|
if (!tubeList || !tubeList.length) { |
|
|
|
existTubeRack = false; |
|
|
|
} |
|
|
|
if(!item.temperature){ |
|
|
|
if (!item.temperature) { |
|
|
|
hasSetTemp = false; |
|
|
|
} |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
if(!existTubeRack){ |
|
|
|
ElMessage.error("选择的加热区未放置试管架,请重新选择") |
|
|
|
if (!existTubeRack) { |
|
|
|
ElMessage.error("选择的加热区未放置试管架,请重新选择"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if(!hasSetTemp){ |
|
|
|
ElMessage.error("选择的加热区未设置温度,请设置温度") |
|
|
|
if (!hasSetTemp) { |
|
|
|
ElMessage.error("选择的加热区未设置温度,请设置温度"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//后台批量发送指令 |
|
|
|
const cmdList:any = [] |
|
|
|
selectedTrayList.value.forEach((heatArea:any) => { |
|
|
|
const cmdList: any = []; |
|
|
|
selectedTrayList.value.forEach((heatArea: any) => { |
|
|
|
const params = { |
|
|
|
heatId : heatArea.id, |
|
|
|
temperature: heatArea.temperature |
|
|
|
} |
|
|
|
taskCmd({ command: 'startHeat', params }).then((res) => { |
|
|
|
heatId: heatArea.id, |
|
|
|
temperature: heatArea.temperature, |
|
|
|
}; |
|
|
|
taskCmd({ command: "startHeat", params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
isHeating.value = true; |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}); |
|
|
|
// onSendCmd("startHeat", cmdList) |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//停止加热 |
|
|
|
const onStopHeat = () => { |
|
|
@ -683,48 +661,48 @@ const onStopHeat = () => { |
|
|
|
ElMessage.error("请选择目标加热区"); |
|
|
|
return; |
|
|
|
} |
|
|
|
selectedTrayList.value.forEach((heatArea:any) => { |
|
|
|
selectedTrayList.value.forEach((heatArea: any) => { |
|
|
|
const params = { |
|
|
|
heatId : heatArea.id, |
|
|
|
} |
|
|
|
taskCmd({ command: 'stopHeat', params }).then((res) => { |
|
|
|
heatId: heatArea.id, |
|
|
|
}; |
|
|
|
taskCmd({ command: "stopHeat", params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
isHeating.value = false; |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
//开始摇匀 |
|
|
|
const isSharking = ref(false) |
|
|
|
const isSharking = ref(false); |
|
|
|
const onStartShakingTube = () => { |
|
|
|
const params = {} |
|
|
|
taskCmd({ command:'startShakeUp', params}).then((res) => { |
|
|
|
const params = {}; |
|
|
|
taskCmd({ command: "startShakeUp", params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
isSharking.value = true; |
|
|
|
setOnGoingStatus("shaking"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//结束摇匀 |
|
|
|
const onStopShakingTube = () => { |
|
|
|
const params = {} |
|
|
|
taskCmd({ command:'stopShakeUp', params}).then((res) => { |
|
|
|
const params = {}; |
|
|
|
taskCmd({ command: "stopShakeUp", params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
isSharking.value = false; |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
//抬起托盘 |
|
|
|
const onUpTray = () => { |
|
|
@ -733,51 +711,49 @@ const onUpTray = () => { |
|
|
|
return; |
|
|
|
} |
|
|
|
//选择了多个加热区,可托起多个加热区试管加 |
|
|
|
selectedTrayList.value.forEach((heatAreaItem:any) => { |
|
|
|
selectedTrayList.value.forEach((heatAreaItem: any) => { |
|
|
|
const params = { |
|
|
|
heatId: heatAreaItem.id |
|
|
|
} |
|
|
|
heatId: heatAreaItem.id, |
|
|
|
}; |
|
|
|
|
|
|
|
taskCmd({ command:'upTray', params }).then((res) => { |
|
|
|
taskCmd({ command: "upTray", params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
//修改加热区状态 selectedValue: 0 | 1 | 2; // 0为无托盘,1为有托盘,2为托盘抬起 |
|
|
|
const updateheatAearStatus = (selectedValue:any, heatId:string) => { |
|
|
|
let heaterList = statusStore.status?.heatArea |
|
|
|
if(heaterList){ |
|
|
|
heaterList.forEach((item:any) => { |
|
|
|
if(item.heaterId == heatId){ |
|
|
|
item.trayStatus = selectedValue |
|
|
|
const updateheatAearStatus = (selectedValue: any, heatId: string) => { |
|
|
|
let heaterList = statusStore.status?.heatArea; |
|
|
|
if (heaterList) { |
|
|
|
heaterList.forEach((item: any) => { |
|
|
|
if (item.heaterId == heatId) { |
|
|
|
item.trayStatus = selectedValue; |
|
|
|
} |
|
|
|
}) |
|
|
|
const data:any = { |
|
|
|
}); |
|
|
|
const data: any = { |
|
|
|
...statusStore.status, |
|
|
|
heater:[...heaterList] |
|
|
|
} |
|
|
|
statusStore.setStatus(data) |
|
|
|
heater: [...heaterList], |
|
|
|
}; |
|
|
|
statusStore.setStatus(data); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const onSendCmd = (command:OperationCmd,params:any)=> { |
|
|
|
const onSendCmd = (command: OperationCmd, params: any) => { |
|
|
|
//发送加热指令 |
|
|
|
taskCmd({ command, params }).then((res) => { |
|
|
|
taskCmd({ command, params }).then(res => { |
|
|
|
if (res.success) { |
|
|
|
ElMessage.success("指令已发送,请稍等"); |
|
|
|
// ElMessage.success("指令已发送,请稍等"); |
|
|
|
setOnGoingStatus("movingToAct"); |
|
|
|
} else { |
|
|
|
ElMessage.error(res.msg); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
|
|
@use "@/assets/style/mixin.scss" as *; |
|
|
@ -958,37 +934,37 @@ const onSendCmd = (command:OperationCmd,params:any)=> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.task_name{ |
|
|
|
height:17.25rem; |
|
|
|
.task_name { |
|
|
|
height: 17.25rem; |
|
|
|
width: 27.5rem; |
|
|
|
background: #ffffff; |
|
|
|
|
|
|
|
.task_title{ |
|
|
|
.task_title { |
|
|
|
font-size: 1.25rem; |
|
|
|
color: #40474E; |
|
|
|
color: #40474e; |
|
|
|
margin-left: 1.25rem; |
|
|
|
margin-top: 1.875rem |
|
|
|
margin-top: 1.875rem; |
|
|
|
} |
|
|
|
|
|
|
|
.task_name_content{ |
|
|
|
margin-top:1.875rem; |
|
|
|
.task_name_content { |
|
|
|
margin-top: 1.875rem; |
|
|
|
margin-left: 1.5rem; |
|
|
|
font-size: 1.25rem; |
|
|
|
color: #40474E; |
|
|
|
color: #40474e; |
|
|
|
display: flex; |
|
|
|
.task_input{ |
|
|
|
.task_input { |
|
|
|
border: 1px solid #dcdcdc; |
|
|
|
border-radius: 8px; |
|
|
|
height: 3rem; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.task_button{ |
|
|
|
.task_button { |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
} |
|
|
|
.cancel_btn{ |
|
|
|
.cancel_btn { |
|
|
|
border: 1px solid rgb(226, 226, 226); |
|
|
|
width: 5rem; |
|
|
|
margin-left: 2rem; |
|
|
|