上片机状态显示添加默认状态、颜色,下片卧式缓存websocket,ip和端口号均可配置
10个文件已修改
85 ■■■■■ 已修改文件
UI-Project/src/utils/constants.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Caching/cachingbefore.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Caching/cachingun.vue 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Identify/identify.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Returns/returns.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Slicecage/slicecage.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/StockBasicData/stockBasicData.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/StockBasicData/stockBasicDatatwo.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/utils/constants.js
@@ -1,2 +1,3 @@
// export const WebSocketHost = "192.168.1.199";
export const WebSocketHost = "10.153.19.150";
export const WebSocketHost = "10.153.19.150";
export const host = "88";
UI-Project/src/views/Caching/cachingbefore.vue
@@ -4,7 +4,7 @@
import {useRouter} from "vue-router"
const router = useRouter()
const adda = ref(false)
import { WebSocketHost } from '@/utils/constants'
import { WebSocketHost ,host} from '@/utils/constants'
import request from "@/utils/request"
import { ref, onMounted , onBeforeUnmount} from "vue";
@@ -78,8 +78,7 @@
    console.error('发生错误:', error);  
  }  
};   
const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`;
// const socketUrl = `ws://10.153.19.150:88/api/cacheGlass/api/talk/cacheGlass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
UI-Project/src/views/Caching/cachingun.vue
@@ -4,9 +4,10 @@
import {useRouter} from "vue-router"
const router = useRouter()
const adda = ref(false)
import { WebSocketHost ,host} from '@/utils/constants'
import request from "@/utils/request"
import { ref, onMounted } from "vue";
import { ref, onMounted , onBeforeUnmount} from "vue";
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
// import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
//  import LanguageMixin from './lang/LanguageMixin'
@@ -67,6 +68,32 @@
    console.error('发生错误:', error);  
  }  
};   
const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
  tableData.splice(0, tableData.length, ...data.params[0]);
  // tableData.value = data.params[0]
  // adjustedRects.value = data.EdgStorageCageinfos[0]
  adjustedRects.value = data.params[0].map(rect => ({
            ...rect, // 复制原始对象的其他属性
            width: rect.width * 0.5 ,
            id: rect.id * 10,
          }));
};
// 初始化 WebSocket,并传递消息处理函数
onMounted(() => {
  // fetchFlowCardId();
  // fetchTableData(); // 获取数据
  initializeWebSocket(socketUrl, handleMessage);
});
onBeforeUnmount(() => {
  console.log("关闭了")
  closeWebSocket();
});
</script>
 
<template>
@@ -113,9 +140,6 @@
    >
    </div>
  </div>
<!-- <div style="width: 100px;height: 10px;background-color: #409EFF;margin-top: -124px;margin-left: 480px;"></div>
<div style="width: 100px;height: 10px;background-color: #409EFF;margin-top: -30px;margin-left: 850px;"></div>
<div style="width: 100px;height: 10px;background-color: #409EFF;margin-top: 30px;margin-left: 695px;"></div> -->
</div>
</template>
 
UI-Project/src/views/Identify/identify.vue
@@ -44,7 +44,7 @@
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, onMounted, onBeforeUnmount } from 'vue';  
import request from "@/utils/request"
import { WebSocketHost } from '@/utils/constants'
import { WebSocketHost ,host} from '@/utils/constants'
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
const blind = ref(false)
const olWidth = ref(); 
@@ -176,7 +176,7 @@
    }  
  });  
}
const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
UI-Project/src/views/Returns/returns.vue
@@ -13,7 +13,7 @@
const adda = ref(false)
const flake = ref(false)
const flakea = ref(false)
import { WebSocketHost } from '@/utils/constants'
import { WebSocketHost ,host} from '@/utils/constants'
import request from "@/utils/request"
const ida = ref(null); 
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -25,9 +25,9 @@
const selectedValuea = ref('');  
const selectedValueb = ref('');
const selectedValuec = ref(''); 
const upstatus = ref(''); // 假设这个用于显示自动/手动状态
const upstatus = ref('上片机手动状态:'); // 假设这个用于显示自动/手动状态
const cuttingMachine = ref(''); // 假设这个用于存储后端返回的状态值(0或1)  
const cuttingMachineStatusColor = ref(''); // 用于动态设置i标签的背景色
const cuttingMachineStatusColor = ref('#911005'); // 用于动态设置i标签的背景色
const inKageWord = ref(0); // 用于存储要传递给接口的inKageWord值 
const options = ref<any[]>([]); // 下拉选项列表  
const selectOptions = ref<Array<any>>([]); // 下拉选选项数组  
@@ -102,7 +102,7 @@
const titleSelectJsona = ref({
  processTypea: [],
})
const socketUrl = `ws://${WebSocketHost}:88/api/loadGlass/api/talk/loadGlass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
@@ -497,7 +497,7 @@
const wsUrl = `ws://${WebSocketHost}:88/api/loadGlass/api/talk/loadGlass`;
const wsUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`;
const ws = new WebSocket(wsUrl);  
ws.onopen = () => {  
  console.log('WebSocket连接已打开');  
@@ -526,7 +526,7 @@
      const status = data.InkageStatus[0]; 
      cuttingMachine.value = status; 
      upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:';
      cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';
      cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';
      inKageWord.value = status === '1' ? 0 : 1;  
    } else {  
      // 处理错误情况或无效数据  
@@ -544,7 +544,7 @@
    if (response.code == 200) {  
      const status = response.data.status; 
      upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:';  
      cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green';
      cuttingMachineStatusColor.value = status === '1' ? 'green' : '#911005';
      // 显示成功消息  
      ElMessage.success(response.message);  
    } else {  
UI-Project/src/views/Slicecage/slicecage.vue
@@ -3,8 +3,7 @@
import {reactive} from "vue";
import {useRouter} from "vue-router"
const router = useRouter()
import { WebSocketHost } from '@/utils/constants'
import { WebSocketHost ,host} from '@/utils/constants'
import { ref, onMounted , onBeforeUnmount} from "vue";
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
import { ElMessage, ElMessageBox } from 'element-plus'
@@ -192,7 +191,7 @@
}
 
const socketUrl = `ws://${WebSocketHost}:88/api/cacheVerticalGlass/api/talk/slicecage`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/slicecage`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
UI-Project/src/views/StockBasicData/stockBasicData.vue
@@ -4,8 +4,7 @@
import {useRouter} from "vue-router"
const router = useRouter()
const adda = ref(false)
import { WebSocketHost } from '@/utils/constants'
import { WebSocketHost ,host} from '@/utils/constants'
import request from "@/utils/request"
import { ref, onMounted , onBeforeUnmount} from "vue";
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -95,7 +94,7 @@
  }  
};   
const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
UI-Project/src/views/StockBasicData/stockBasicDatatwo.vue
@@ -4,8 +4,7 @@
import {useRouter} from "vue-router"
const router = useRouter()
const adda = ref(false)
import { WebSocketHost } from '@/utils/constants'
import { WebSocketHost ,host} from '@/utils/constants'
import request from "@/utils/request"
import { ref, onMounted , onBeforeUnmount} from "vue";
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
@@ -96,7 +95,7 @@
};   
const socketUrl = `ws://${WebSocketHost}:88/api/cacheGlass/api/talk/cacheGlass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue
@@ -37,7 +37,7 @@
import Swal from 'sweetalert2'
import request from "@/utils/request";
import { initializeWebSocket } from '@/utils/WebSocketService';
 import { WebSocketHost } from '@/utils/constants';
import { WebSocketHost ,host} from '@/utils/constants'
const racks = ref([
  { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } },
 
@@ -112,7 +112,7 @@
  }
};
const socketUrl = `ws://${WebSocketHost}:88/api/unLoadGlass/api/talk/unloadglass3`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass3`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -11,9 +11,7 @@
import Landingindicationtwo from "./Landingindicationtwo.vue";
import request from "@/utils/request";
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
 import { WebSocketHost } from '@/utils/constants';
import { WebSocketHost ,host} from '@/utils/constants'
const dialogFormVisiblea = ref(false)
const dialogFormVisiblea2 = ref(false)
@@ -148,7 +146,7 @@
};
const socketUrl = `ws://${WebSocketHost}:88/api/unLoadGlass/api/talk/unloadglass`;
const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {