| | |
| | | <template> |
| | | <div style="height: 500px;"> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;height: 800px;" v-loading="loading"> |
| | | <div style="height: 600px;"> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;height: 850px;"> |
| | | <div style="display: flex;margin-left: 40%;margin-bottom: 5px;"> |
| | | <div style="text-align: center;"> {{ $t('processCard.temperinglayout') }}:{{ ava }}-{{ avanum }} </div> |
| | | <el-button @click="handleAllDamage" style="margin-left: 80%;margin-top: -5px;">{{$t('order.dilapidation')}}</el-button> |
| | | </div> |
| | | <el-scrollbar height="750px" width="1400px" style="background-color: #e9e9eb;"> |
| | | <div style="position: relative;"> |
| | | <div |
| | |
| | | backgroundColor: rect.isActive ? '#ADFF2F' : getRectColor(rect.state) |
| | | }"> |
| | | <div class="centered-text"> |
| | | <div style="font-size: 20px;font-weight: bold;">{{ rect.glassId }}</div> |
| | | <div style="font-size: 20px;font-weight: bold;">{{ rect.flowCardId }}</div> |
| | | <div style="font-size: 30px;font-weight: bold;">{{ rect.widtha }}*{{ rect.heighta }}</div> |
| | | <div style="font-size: 10px;font-weight: bold;">{{ rect.glassId }}</div> |
| | | <div style="font-size: 10px;font-weight: bold;">{{ rect.flowCardId }}</div> |
| | | <div style="font-size: 15px;font-weight: bold;">{{ rect.widtha }}*{{ rect.heighta }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </div> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import {avatarEmits, ElMessage} from 'element-plus' |
| | | import {avatarEmits, ElMessage, ElMessageBox } from 'element-plus' |
| | | import {onBeforeUnmount, computed, onMounted, onUnmounted, ref} from 'vue'; |
| | | import request from "@/utils/request" |
| | | import {host, WebSocketHost} from '@/utils/constants' |
| | |
| | | const blind = ref(false) |
| | | const currentGlassId = ref(null); |
| | | const adjustedRects = ref([]); |
| | | const ava = ref([]); |
| | | const avanum = ref([]); |
| | | const ava = ref(''); |
| | | const avanum = ref(''); |
| | | const realwidth = ref(''); |
| | | const realheight = ref(''); |
| | | let socket = null; |
| | | const currentGlassRect = computed(() => { |
| | | return adjustedRects.value.find(rect => rect.glassId === currentGlassId.value); |
| | |
| | | isActive: false |
| | | })); |
| | | } |
| | | // 一键破损所有玻璃 |
| | | const handleAllDamage = async () => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | t('order.dilapidationWhether'), |
| | | t('workOrder.prompt'), |
| | | { |
| | | confirmButtonText: t('workOrder.yes'), |
| | | cancelButtonText: t('workOrder.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | // 筛选出state不是8和9的玻璃ID |
| | | const glassIdList = adjustedRects.value |
| | | .filter(rect => rect.state !== 8 && rect.state !== 9) |
| | | .map(rect => rect.glassId); |
| | | if (glassIdList.length === 0) { |
| | | ElMessage.warning(t('order.noGlassToDamage')); // 没有可破损的玻璃 |
| | | return; |
| | | } |
| | | const response = await request.post('/cacheGlass/taskCache/identControlsByPatternSequence', { |
| | | glassIdList: glassIdList, |
| | | state: 8, |
| | | line: 1, |
| | | workingProcedure: '切割', |
| | | remark: '掰片' |
| | | }); |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | // 更新所有玻璃状态 |
| | | glassIdList.forEach(glassId => { |
| | | updateRectStatus(glassId, 8); |
| | | }); |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | ElMessage.error(t('')); |
| | | } |
| | | }; |
| | | // 破损 |
| | | const handleDamage = async () => { |
| | | try { |
| | |
| | | if (data.engineer != null) { |
| | | ava.value = data.engineer[0] |
| | | }else{ |
| | | ava.value = 0 |
| | | ava.value = '' |
| | | } |
| | | if (data.engineer != null) { |
| | | avanum.value = data.sequence[0] |
| | | }else{ |
| | | avanum.value = 0 |
| | | avanum.value = '' |
| | | } |
| | | const scaleFactor = 1621.78 / 6000; |
| | | const scaleFactory = 750 / 3300; |
| | | console.log(data.upPattenUsage); |
| | | console.log(data.currentCutTerritory); |
| | | if (data.upPattenUsage && data.upPattenUsage.length > 0) { |
| | | realwidth.value = data.upPattenUsage[0].width; |
| | | realheight.value = data.upPattenUsage[0].height; |
| | | const realx = realwidth.value; |
| | | const realy = realheight.value; |
| | | window.localStorage.setItem('widthreturna', realy) |
| | | const scaleFactora = 1621.78 / realx; |
| | | const scaleFactorya = 750 / realy; |
| | | window.localStorage.setItem('scaleFactorb', scaleFactora) |
| | | window.localStorage.setItem('scaleFactoryb', scaleFactorya) |
| | | } |
| | | if (data.currentCutTerritory && data.currentCutTerritory.length > 0) { |
| | | let scaleFactor = window.localStorage.getItem('scaleFactorb') |
| | | let scaleFactory = window.localStorage.getItem('scaleFactoryb') |
| | | let widthreturn = window.localStorage.getItem('widthreturna') |
| | | const newRects = data.currentCutTerritory[0].map(rect => { |
| | | const existingRect = adjustedRects.value.find(r => r.glassId === rect.glassId); |
| | | if (existingRect) { |
| | | return { |
| | | ...existingRect, |
| | | xAxisa: rect.xAxis * scaleFactor * 1.1, |
| | | yAxisa: (3300 - (rect.yAxis + rect.edgHeight + 300)) * scaleFactory * 1.1, |
| | | width: rect.edgWidth * scaleFactor * 1.1, |
| | | height: rect.edgHeight * scaleFactory * 1.1, |
| | | xAxisa: rect.xAxis * scaleFactor, |
| | | yAxisa: (widthreturn - (rect.yAxis + rect.edgHeight)) * scaleFactory, |
| | | width: rect.edgWidth * scaleFactor, |
| | | height: rect.edgHeight * scaleFactory, |
| | | widtha: rect.edgWidth, |
| | | heighta: rect.edgHeight, |
| | | state: rect.state, |
| | |
| | | // 如果不存在,则添加新矩形,默认 isActive 为 false |
| | | return { |
| | | ...rect, |
| | | xAxisa: rect.xAxis * scaleFactor * 1.1, |
| | | yAxisa: (3300 - (rect.yAxis + rect.edgHeight + 300)) * scaleFactory * 1.1, |
| | | width: rect.edgWidth * scaleFactor * 1.1, |
| | | height: rect.edgHeight * scaleFactory * 1.1, |
| | | xAxisa: rect.xAxis * scaleFactor, |
| | | yAxisa: (widthreturn - (rect.yAxis + rect.edgHeight)) * scaleFactory, |
| | | width: rect.edgWidth * scaleFactor, |
| | | height: rect.edgHeight * scaleFactory, |
| | | widtha: rect.edgWidth, |
| | | heighta: rect.edgHeight, |
| | | state: rect.state, |