wu
2024-09-18 fdc39f2277775b9cdaf8add9170d7ac0d68ed607
拉取前提交更改
2个文件已修改
83 ■■■■ 已修改文件
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCMechanicalArm.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/MechanicalArm/mechanicalArm.vue 82 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/job/PLCMechanicalArm.java
@@ -58,6 +58,7 @@
        Machine machine=machineMapper.selectById(1L);
        List<Tasking> taskingList=taskingService.findMachineTask(machine);
        jsonObject.append("taskingList", taskingList);
        jsonObject.append("machine", machine);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("mechanicalArm");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
UI-Project/src/views/MechanicalArm/mechanicalArm.vue
@@ -1,4 +1,4 @@
<!--  上片机  -->
<!--  打标机  -->
<script setup>
import request from "@/utils/request";
import { ElMessage, ElMessageBox } from "element-plus";
@@ -14,7 +14,7 @@
});
const loadData = ref([]);
const findMachine = ref([]);
const machineid=1//获取数据
const machineId=1;//当前页面的设备ID
//使用WebSocket方式展示数据
let socket = null;
const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/mechanicalArm`;
@@ -76,7 +76,7 @@
//修改工作状态 【失败/正在工作/完工】
const workStatus = async(row,state) => {
  let url;
  if(state=="失败"){
  if(state=="重发"){
    url="/deviceInteraction/tasking/loseMachineTask";
  }else if(state=="正在工作"){
    url="/deviceInteraction/tasking/startMachineTask";
@@ -86,11 +86,11 @@
    return;
  }
  ElMessageBox.confirm(
        t('marking.tips'),
        t('functionState.tips'),
        t('delivery.prompt'),  
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
@@ -98,7 +98,7 @@
          //开始修改
          request.post(url,
            {
              "id": machineid,
              "id": machineId
            }).then((res) => { // 替换为你的API端点  
              if (res.code === 200) {
                ElMessage.success(res.message);
@@ -110,7 +110,7 @@
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
            message: t('functionState.cancel'),
          })
        })
@@ -119,11 +119,11 @@
//开工/暂停
const machineStatus = async(state) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('functionState.tips'),
        t('delivery.prompt'),  
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
@@ -131,7 +131,7 @@
          //下线接口
          request.post("/deviceInteraction/machine/updateMachineState",
            {
              "id": machineid,
              "id": machineId,
              "state": state
            }).then((res) => { // 替换为你的API端点  
              if (res.code === 200) {
@@ -144,18 +144,18 @@
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
            message: t('functionState.cancel'),
          })
        })
}
//破损
const damagedTask = async(row) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('functionState.tips'),
        t('delivery.prompt'),  
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
@@ -175,18 +175,18 @@
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
            message: t('functionState.cancel'),
          })
        })
}
//下线(拿走)
const glassDownLine = async(row) => {
  ElMessageBox.confirm(
        t('marking.tips'),
        t('functionState.tips'),
        t('delivery.prompt'),  
        {
          confirmButtonText: t('marking.sure'),
          cancelButtonText: t('marking.cancel'),
          confirmButtonText: t('functionState.sure'),
          cancelButtonText: t('functionState.cancel'),
          type: 'warning',
        }
      )
@@ -206,7 +206,7 @@
        .catch(() => {
          ElMessage({
            type: 'info',
            message: t('marking.cancel'),
            message: t('functionState.cancel'),
          })
        })
}
@@ -217,16 +217,16 @@
</script>
<template>
  <div ref="content">
  <div ref="content" style="padding:0 20px;">
    <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;">
      自动上片机
      {{$t('machine.mechanicalArm')}}
    </div>
    <hr />
    <br>
    <div id="search" style="padding-left: 20px;">
    <div id="search" >
      <!-- 功能 -->
      <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?'开工':'暂停'}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">上线</el-button>
      <el-button :type="(findMachine['state']=='暂停'?'danger':'success')" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button>
      <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button>
      <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button>
      <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> -->
@@ -237,29 +237,29 @@
        :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129', textAlign: 'center' }"
        :cell-style="{ textAlign: 'center' }">
        <!-- <el-table-column type="selection" min-width="30" /> -->
        <el-table-column type="index" label="序号" min-width="30" />
        <el-table-column prop="batchNumber" label="批次号" />
        <el-table-column prop="taskType" label="任务类型" />
        <el-table-column prop="glassId" label="玻璃编号" />
        <el-table-column prop="length" label="长" />
        <el-table-column prop="width" label="宽" />
        <el-table-column prop="thickness" label="厚" />
        <el-table-column prop="workState" label="状态" />
        <el-table-column type="index" :label="$t('glassInfo.number')" min-width="30" />
        <el-table-column prop="batchNumber" :label="$t('glassInfo.batchNumber')"/>
        <el-table-column prop="taskType" :label="$t('glassInfo.taskType')"/>
        <el-table-column prop="glassId" :label="$t('glassInfo.glassId')"/>
        <el-table-column prop="length" :label="$t('glassInfo.length')"/>
        <el-table-column prop="width" :label="$t('glassInfo.width')"/>
        <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/>
        <el-table-column prop="workState" :label="$t('glassInfo.workState')"/>
        <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270">
          <template #default="scope">
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '失败')">重发</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">完工</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">破损</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">下线</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')" >{{$t('functionState.anew')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{$t('functionState.finish')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button>
            <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div id="main-body"
      style="width: 100%; height: 460px;background-image: url(../../src/assets/自动打标机.png) ;background-size: 100% 100%;">
    <div id="main-body"
      style="width: 45%; height: 400px;;background-image: url(../../src/assets/上片机.png) ;background-size: 100% 100%;">
      <!-- 画图内容 -->
      <div style="width: 100px; height: 100px; background-color: red; position: relative; top: 171px; left: 218px">
      <div style="width: 200px; height: 100px; background-color: red; position: relative; top: 271px; left: 158px">
      </div>
    </div>
  </div>