|
|
@ -24,7 +24,11 @@ |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<tr v-for="report in formattedReports" :key="report.channel" :class="{ 'error-row': report.isError }"> |
|
|
|
<tr |
|
|
|
v-for="report in formattedReports" |
|
|
|
:key="report.channel" |
|
|
|
:class="{ 'error-row': report.isError }" |
|
|
|
> |
|
|
|
<td>通道{{ report.channel + 1 }}</td> |
|
|
|
<td>{{ report.projName || '--' }}</td> |
|
|
|
<td>{{ report.lotId || '--' }}</td> |
|
|
@ -47,9 +51,18 @@ |
|
|
|
<SpttingPlates :plates="plates" :temperature="currentTemperature" /> |
|
|
|
</div> |
|
|
|
<div class="move-liquid-area"> |
|
|
|
<MoveLiquidArea :isLoad="isLoad" :isLoading="isLoading" :moveLiquids="moveLiquids" :tempTipNum="tempTipNum" |
|
|
|
:bufferBig="bufferBig" :emergencyInfo="emergencyInfo" :wasteStatus="wasteStatus" |
|
|
|
@loadConsumables="handleIsLoad" @unloadConsumables="handleIsUnload" @updateTipNum="updateTipNum" /> |
|
|
|
<MoveLiquidArea |
|
|
|
:isLoad="isLoad" |
|
|
|
:isLoading="isLoading" |
|
|
|
:moveLiquids="moveLiquids" |
|
|
|
:tempTipNum="tempTipNum" |
|
|
|
:bufferBig="bufferBig" |
|
|
|
:emergencyInfo="emergencyInfo" |
|
|
|
:wasteStatus="wasteStatus" |
|
|
|
@loadConsumables="handleIsLoad" |
|
|
|
@unloadConsumables="handleIsUnload" |
|
|
|
@updateTipNum="updateTipNum" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="main-bottom"> |
|
|
@ -59,9 +72,19 @@ |
|
|
|
<div class="content">缓冲液(小)</div> |
|
|
|
</div> |
|
|
|
<div class="ball-area"> |
|
|
|
<MainComponent v-for="item in bufferLittles" :key="item" class="ball-grid" :projectName="item.projShortName" |
|
|
|
:currentCount="item.num" :totalBalls="25" :activatedBalls="item.num" :columns="5" gridWidth="240px" |
|
|
|
gridHeight="235px" :activeColor="item.color" /> |
|
|
|
<MainComponent |
|
|
|
v-for="item in bufferLittles" |
|
|
|
:key="item" |
|
|
|
class="ball-grid" |
|
|
|
:projectName="item.projShortName" |
|
|
|
:currentCount="item.num" |
|
|
|
:totalBalls="25" |
|
|
|
:activatedBalls="item.num" |
|
|
|
:columns="5" |
|
|
|
gridWidth="240px" |
|
|
|
gridHeight="235px" |
|
|
|
:activeColor="item.color" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -70,17 +93,21 @@ |
|
|
|
<script setup lang="ts"> |
|
|
|
import { MoveLiquidArea, SpttingPlates, MainComponent } from '../components' |
|
|
|
import { ref, onMounted, onActivated, onBeforeUnmount, watch } from 'vue' |
|
|
|
import { scanConsumables, updateTipsNum } from '../../../services/Index/index' |
|
|
|
import { |
|
|
|
getInitState, |
|
|
|
scanConsumables, |
|
|
|
updateTipsNum, |
|
|
|
} from '../../../services/Index/index' |
|
|
|
import { useConsumablesStore, useEmergencyStore } from '../../../store' |
|
|
|
import { useDeviceStore } from '../../../store/index' |
|
|
|
import { eventBus } from '../../../eventBus' |
|
|
|
import { |
|
|
|
ReactionPlate, |
|
|
|
BottleGroup, |
|
|
|
LiquidState, |
|
|
|
} from '../../../types/Index' |
|
|
|
import { ReactionPlate, BottleGroup, LiquidState } from '../../../types/Index' |
|
|
|
import { createWebSocket } from '../../../websocket/socket' |
|
|
|
import type { ConsumablesStateMessage, SensorStateMessage, EmergencyPosStateMessage } from '../../../websocket/socket'; |
|
|
|
import type { |
|
|
|
ConsumablesStateMessage, |
|
|
|
SensorStateMessage, |
|
|
|
EmergencyPosStateMessage, |
|
|
|
} from '../../../websocket/socket' |
|
|
|
import { getServerInfo } from '../../../utils/getServerInfo' |
|
|
|
import { formatScanReports } from '../../../utils/errorHandler' |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
@ -91,15 +118,15 @@ const consumableStore = useConsumablesStore() |
|
|
|
const emergencyStore = useEmergencyStore() |
|
|
|
const deviceStore = useDeviceStore() |
|
|
|
// 温度状态 |
|
|
|
const currentTemperature = ref(40); |
|
|
|
const currentTemperature = ref(40) |
|
|
|
// 废料区状态 |
|
|
|
const wasteStatus = ref(false) |
|
|
|
// 父组件状态 |
|
|
|
const isLoad = ref(false) |
|
|
|
const isLoading = ref(false) |
|
|
|
//管理反应板夹的状态 |
|
|
|
// 反应板夹的状态 |
|
|
|
const plates = ref<ReactionPlate[]>([]) |
|
|
|
// 管理移液盘的状态 |
|
|
|
// 移液盘的状态 |
|
|
|
const moveLiquids = ref<LiquidState[]>([ |
|
|
|
{ |
|
|
|
id: 1, |
|
|
@ -190,7 +217,7 @@ const isHandleScan = ref(false) |
|
|
|
const handleConfirmScan = () => { |
|
|
|
showScanResults.value = false |
|
|
|
isHandleScan.value = true |
|
|
|
if (formattedReports.value.some(report => report.isError)) { |
|
|
|
if (formattedReports.value.some((report) => report.isError)) { |
|
|
|
isLoad.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
ElMessage.warning('存在错误,请检查耗材') |
|
|
@ -203,15 +230,15 @@ const startWebSocket = () => { |
|
|
|
// 处理传感器状态消息 |
|
|
|
const handleSensorState = (data: SensorStateMessage['data']) => { |
|
|
|
// 更新温度值(这里使用孵育盒温度) |
|
|
|
currentTemperature.value = data.incubateBoxTemperature; |
|
|
|
currentTemperature.value = data.incubateBoxTemperature |
|
|
|
wasteStatus.value = data.wasteBinFullFlag |
|
|
|
consumableStore.updateWasteStatus(wasteStatus.value) |
|
|
|
// 可以添加温度异常处理逻辑 |
|
|
|
if (currentTemperature.value > 40) { |
|
|
|
console.warn('温度过高警告'); |
|
|
|
console.warn('温度过高警告') |
|
|
|
// 可以在这里添加其他警告逻辑 |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
//处理耗材状态 |
|
|
|
const handleConsumablesState = (data: ConsumablesStateMessage['data']) => { |
|
|
@ -233,17 +260,24 @@ const updatePlatesAndBuffers = ({ |
|
|
|
value: number |
|
|
|
index: number |
|
|
|
}) => { |
|
|
|
if (plates.value && plates.value[index]) plates.value[index].num = value |
|
|
|
if (bufferLittles.value && bufferLittles.value[index]) |
|
|
|
if (plates.value && plates.value[index]) { |
|
|
|
plates.value[index].num = value |
|
|
|
} |
|
|
|
if (bufferLittles.value && bufferLittles.value[index]) { |
|
|
|
bufferLittles.value[index].num = value |
|
|
|
if (bufferBig.value && bufferBig.value[index]) |
|
|
|
} |
|
|
|
if (bufferBig.value && bufferBig.value[index]) { |
|
|
|
bufferBig.value[index].isUse = value > 0 |
|
|
|
} |
|
|
|
} |
|
|
|
onMounted(() => { |
|
|
|
eventBus.on('confirm', updatePlatesAndBuffers) |
|
|
|
startWebSocket() |
|
|
|
socket.subscribe<SensorStateMessage>('SensorState', handleSensorState); |
|
|
|
socket.subscribe<ConsumablesStateMessage>('ConsumablesStateService', handleConsumablesState); |
|
|
|
socket.subscribe<SensorStateMessage>('SensorState', handleSensorState) |
|
|
|
socket.subscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesStateService', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
// getEmergencyInfo() |
|
|
|
}) |
|
|
|
onBeforeUnmount(() => { |
|
|
@ -252,8 +286,11 @@ onBeforeUnmount(() => { |
|
|
|
if (socket !== null) { |
|
|
|
socket.disconnect() // 断开连接 |
|
|
|
} |
|
|
|
socket.unsubscribe<SensorStateMessage>('SensorState', handleSensorState); |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>('ConsumablesStateService', handleConsumablesState); |
|
|
|
socket.unsubscribe<SensorStateMessage>('SensorState', handleSensorState) |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesStateService', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
}) |
|
|
|
// 在组件激活时恢复状态 |
|
|
|
onActivated(() => { |
|
|
@ -267,9 +304,13 @@ onActivated(() => { |
|
|
|
const consumablesData = ref<ConsumablesStateMessage['data'] | null>(null) |
|
|
|
// 修改加载耗材的处理函数 |
|
|
|
const handleIsLoad = async () => { |
|
|
|
isLoading.value = true |
|
|
|
|
|
|
|
const res = await getInitState() |
|
|
|
if (res.ecode === 'SUC' && !res.data.deviceInited) { |
|
|
|
eventBus.emit('initDevice') |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
isLoading.value = true |
|
|
|
const res = await scanConsumables() |
|
|
|
isLoading.value = false |
|
|
|
|
|
|
@ -279,10 +320,6 @@ const handleIsLoad = async () => { |
|
|
|
// 显示扫描结果弹窗 |
|
|
|
showScanResults.value = true |
|
|
|
consumablesData.value = res.data.consumableState |
|
|
|
// 更新状态 |
|
|
|
if (res.data.consumableState) { |
|
|
|
|
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('加载耗材失败:', error) |
|
|
|
isLoading.value = false |
|
|
@ -296,14 +333,13 @@ watch(isHandleScan, (newVal) => { |
|
|
|
if (consumablesData.value) { |
|
|
|
moveLiquids.value = consumablesData.value.tips |
|
|
|
plates.value = consumablesData.value.reactionPlateGroup as ReactionPlate[] |
|
|
|
bufferLittles.value = consumablesData.value.littBottleGroup as BufferLittle[] |
|
|
|
bufferLittles.value = consumablesData.value |
|
|
|
.littBottleGroup as BufferLittle[] |
|
|
|
bufferBig.value = consumablesData.value.larBottleGroup as BottleGroup[] |
|
|
|
tempTipNum.value = [...moveLiquids.value.map((liquid) => liquid.tipNum)] |
|
|
|
isLoad.value = true |
|
|
|
isAlreadyLoad.value = true |
|
|
|
consumableStore.setConsumablesData(consumablesData.value) |
|
|
|
// 清空临时数据 |
|
|
|
consumablesData.value = null |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 取消时清空临时数据 |
|
|
@ -314,7 +350,10 @@ const handleIsUnload = () => { |
|
|
|
isLoad.value = !isLoad.value |
|
|
|
isLoading.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>('ConsumablesStateService', handleConsumablesState); |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesStateService', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
// 重置 moveLiquids 和 tempTipNum |
|
|
|
moveLiquids.value = [ |
|
|
|
{ id: 1, tipNum: 0 }, |
|
|
@ -365,14 +404,20 @@ const handleIsUnload = () => { |
|
|
|
] |
|
|
|
bufferBig.value = [] |
|
|
|
} |
|
|
|
const updateTipNum = async ({ index, tipNum }: { index: number; tipNum: number }) => { |
|
|
|
const updateTipNum = async ({ |
|
|
|
index, |
|
|
|
tipNum, |
|
|
|
}: { |
|
|
|
index: number |
|
|
|
tipNum: number |
|
|
|
}) => { |
|
|
|
// 新临时状态 |
|
|
|
tempTipNum.value[index] = tipNum |
|
|
|
console.log('🚀 ~ updateTipNum ~ tempTipNum:', tempTipNum.value) |
|
|
|
//调用接口 |
|
|
|
try { |
|
|
|
if (deviceStore.status === 'IDLE') { |
|
|
|
await updateTipsNum({ group: `CG${index}`, num: tipNum }) |
|
|
|
await updateTipsNum({ group: `TipG${index+1}`, num: tipNum }) |
|
|
|
} else { |
|
|
|
ElMessage.error('设备正在工作,无法修改数值') |
|
|
|
} |
|
|
@ -492,7 +537,7 @@ const updateTipNum = async ({ index, tipNum }: { index: number; tipNum: number } |
|
|
|
flex-wrap: wrap; |
|
|
|
|
|
|
|
.ball-grid { |
|
|
|
margin: 0 15px 5px 15px |
|
|
|
margin: 0 15px 5px 15px; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|