| | |
| | | const flakea = ref(false) |
| | | const flakeb = ref(false) |
| | | const flakec = ref(false) |
| | | const dialoglea = ref(false) |
| | | const tableDatax = ref([]) |
| | | const user = ref(''); |
| | | const projectNo = ref(''); |
| | | const workstationId = ref(''); |
| | |
| | | const filmsId = ref(''); |
| | | const patternThickness = ref(''); |
| | | const number = ref(''); |
| | | const canSelectProject = ref(true); // 假设开始时可以选择项目 |
| | | const canStartLoading = ref(false); |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | const ida = ref(null); |
| | |
| | | // ElMessage.error('获取表格数据失败,请重试'); |
| | | } |
| | | }; |
| | | const handlezhiban = () => { |
| | | dialoglea.value = true; // 打开绑定架子对话框 |
| | | fetchFlowCardId(); |
| | | }; |
| | | // 值班信息 |
| | | const fetchFlowCardId = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/work_assignment/selectWorkAssignment',{ |
| | | line: 2001, |
| | | workingProcedure : '冷加工' |
| | | }) |
| | | if (response.code == 200) { |
| | | ElMessage.success(response.message); |
| | | tableDatax.value = response.data; |
| | | console.log(tableDatax.value); |
| | | console |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | } |
| | | catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } |
| | | const handleConfirmb = async () => { |
| | | const response = await request.post("/loadGlass/work_assignment/updateWorkAssignment", tableDatax.value) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | dialoglea.value = false; |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | }; |
| | | onMounted(() => { |
| | | list(''); |
| | | fetchOptions(''); |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | socket = initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onMounted(() => { |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | }); |
| | | const list = async () => { |
| | | try { |
| | |
| | | const titleSelectJsona = ref({ |
| | | processTypea: [], |
| | | }) |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | if(data.prioritylist!=null){ |
| | | tableData.splice(0, tableData.length, ...data.prioritylist[0]); |
| | | } |
| | | if(data.list!=null){ |
| | | tableDataa.value = data.list[0] |
| | | } |
| | | if(data.engineering ){ |
| | | if ( Array.isArray(data.engineering) && data.engineering.length !== 0) { |
| | | canSelectProject.value = false; |
| | | canStartLoading.value = true; |
| | | }else{ |
| | | canSelectProject.value = true; |
| | | canStartLoading.value = false; |
| | | } |
| | | } |
| | | if (data.InkageStatus) { |
| | | if(data.InkageStatus!=null){ |
| | | const status = data.InkageStatus[0]; |
| | | cuttingMachine.value = status; |
| | | upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa'); |
| | | cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005'; |
| | | inKageWord.value = status === '1' ? 0 : 1; |
| | | } |
| | | } |
| | | }; |
| | | const requestData = { |
| | |
| | | ElMessage.error(t('basicData.glassnull')); |
| | | } |
| | | }; |
| | | const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`; |
| | | const ws = new WebSocket(wsUrl); |
| | | ws.onopen = () => { |
| | | console.log('WebSocket连接已打开'); |
| | | }; |
| | | // 上片机联机状态 |
| | | // const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`; |
| | | // const ws = new WebSocket(wsUrl); |
| | | // ws.onopen = () => { |
| | | // console.log('WebSocket连接已打开'); |
| | | // }; |
| | | |
| | | // 监听WebSocket的错误事件 |
| | | ws.onerror = (error) => { |
| | | console.error('WebSocket发生错误:', error); |
| | | }; |
| | | // // 监听WebSocket的错误事件 |
| | | // ws.onerror = (error) => { |
| | | // console.error('WebSocket发生错误:', error); |
| | | // }; |
| | | |
| | | // 监听WebSocket的关闭事件 |
| | | ws.onclose = (event) => { |
| | | if (event.wasClean) { |
| | | console.log('WebSocket连接已正常关闭'); |
| | | } else { |
| | | console.error('WebSocket连接异常关闭'); |
| | | } |
| | | }; |
| | | // 监听WebSocket的消息事件 |
| | | ws.onmessage = (event) => { |
| | | try { |
| | | |
| | | const data = JSON.parse(event.data.replace('<END>', '')); // 解析消息为JSON |
| | | |
| | | if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) { |
| | | if(data.InkageStatus!=null){ |
| | | const status = data.InkageStatus[0]; |
| | | cuttingMachine.value = status; |
| | | upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa'); |
| | | cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005'; |
| | | inKageWord.value = status === '1' ? 0 : 1; |
| | | } |
| | | } else { |
| | | // 处理错误情况或无效数据 |
| | | // console.error('接收到的数据无效', data); |
| | | } |
| | | } catch (error) { |
| | | // console.error('解析WebSocket消息时发生错误', error); |
| | | } |
| | | }; |
| | | // // 监听WebSocket的关闭事件 |
| | | // ws.onclose = (event) => { |
| | | // if (event.wasClean) { |
| | | // console.log('WebSocket连接已正常关闭'); |
| | | // } else { |
| | | // console.error('WebSocket连接异常关闭'); |
| | | // } |
| | | // }; |
| | | // // 监听WebSocket的消息事件 |
| | | // ws.onmessage = (event) => { |
| | | // try { |
| | | // const data = JSON.parse(event.data.replace('<END>', '')); // 解析消息为JSON |
| | | // if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) { |
| | | // if(data.InkageStatus!=null){ |
| | | // const status = data.InkageStatus[0]; |
| | | // cuttingMachine.value = status; |
| | | // upstatus.value = status === '1' ? t('basicData.machine') : t('basicData.machineaa'); |
| | | // cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005'; |
| | | // inKageWord.value = status === '1' ? 0 : 1; |
| | | // } |
| | | // } else { |
| | | // // 处理错误情况或无效数据 |
| | | // // console.error('接收到的数据无效', data); |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('解析WebSocket消息时发生错误', error); |
| | | // } |
| | | // }; |
| | | const confirmCutting = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', |
| | |
| | | <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >{{ $t('basicData.change') }}</el-button> |
| | | |
| | | </div> |
| | | <el-button style="margin-top: 5px;margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true">{{ $t('basicData.selectproject') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">{{ $t('basicData.startloading') }}</el-button> |
| | | <el-button :disabled="!canSelectProject" style="margin-top: 5px;margin-left: 15px;" type="primary" @click="dialogFormVisible = true">{{ $t('basicData.selectproject') }}</el-button> |
| | | <el-button :style="{ backgroundColor: canStartLoading ? 'green' : 'initial',color: canStartLoading ? 'white' : 'black', }" style="margin-top: 5px;margin-left: 20px;" @click="handleBind">{{ $t('basicData.startloading') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="warning" @click="handleBinda">{{ $t('basicData.stop') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="info" @click="handlezhiban">{{ $t('searchOrder.dutyinformation') }}</el-button> |
| | | <!-- <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="danger" @click="handleBindb">停止任务</el-button> --> |
| | | |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading"> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog v-model="dialoglea" top="15vh" width="70%" :title="$t('searchOrder.dutyinformation')"> |
| | | <el-table ref="table" style="margin-top: 20px;height: 300px;" |
| | | :data="tableDatax" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="line" fixed align="center" :label="$t('searchOrder.line')"/> |
| | | <el-table-column prop="workProcesses" fixed align="center" :label="$t('searchOrder.process')" /> |
| | | <el-table-column prop="teamsGroupsName" align="center" :label="$t('searchOrder.team')"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.teamsGroupsName" autocomplete="off" min-width="150"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="deviceName" align="center" :label="$t('searchOrder.basic')"> |
| | | <template #default="{ row }"> |
| | | <el-input v-model="row.deviceName" autocomplete="off" min-width="150"/> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="handleConfirm"> |
| | | {{ $t('searchOrder.add') }} |
| | | </el-button> |
| | | <el-button @click="dialoglea = false">{{ $t('searchOrder.cancel') }}</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="blinda" top="30vh" width="25%" :title="$t('basicData.whetherpause')"> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |