Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
# Conflicts:
# hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
# hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
50个文件已修改
10 文件已重命名
12个文件已添加
11个文件已删除
| | |
| | | const userStore = useUserInfoStore() |
| | | const user = userStore.user.userName |
| | | |
| | | // store.createWebSocket(); |
| | | function quit() { |
| | | userStore.$patch({ |
| | | let userInfoStr = window.localStorage.getItem('userInfo') |
| | | console.log(userInfoStr); |
| | | // const userInfoStr = localStorage.getItem('userInfo'); |
| | | // let userInfo = userInfoStr.user.token; |
| | | let token = userInfo; // 提取 token |
| | | // 退出登录方法 |
| | | const quit = async () => { |
| | | try { |
| | | const response = await request.get('/loadGlass/sys/user/logout', { |
| | | token: token, |
| | | user: null, |
| | | }) |
| | | router.push('/login') |
| | | if (response.code === 200) { |
| | | // 登出成功,清除本地存储的 userInfo |
| | | localStorage.removeItem('userInfo'); |
| | | // 可以在这里重置应用状态,如导航到登录页等 |
| | | console.log('登出成功'); |
| | | } else { |
| | | // 处理错误情况 |
| | | console.error('登出失败', response); |
| | | } |
| | | } |
| | | catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } |
| | | // store.createWebSocket(); |
| | | // function quit() { |
| | | // userStore.$patch({ |
| | | // user: null, |
| | | // }) |
| | | // // router.push('/login') |
| | | // request.get("/loadGlass/sys/user/login").then((res) => { |
| | | // if (res.code === 200) { |
| | | // ElMessage.success(res.msg); |
| | | // console.log(res.data); |
| | | // } else { |
| | | // ElMessage.warning(res.msg); |
| | | // // router.push("/login"); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | //提取菜单模块列表 |
| | | let menuList = $ref([]) |
| | |
| | | request.get('/loadGlass/sys/menu/getMenuTree').then((res) => { |
| | | if (res.code == 200) { |
| | | menuList = deepClone(res.data) |
| | | console.log(response.data.token); |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | router.push('/login') |
| | |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 系统管理 ----------------*/ |
| | | { |
| | | path: 'User', |
| | | name: 'user', |
| | | component: () => import('../views/User/user.vue'), |
| | | children:[ |
| | | { |
| | | path: '/User/userlist', |
| | | name: 'userlist', |
| | | component: () => import('../views/User/userlist.vue') |
| | | }, |
| | | { |
| | | path: '/User/rolelist', |
| | | name: 'rolelist', |
| | | component: () => import('../views/User/rolelist.vue') |
| | | }, |
| | | { |
| | | path: '/User/permissions', |
| | | name: 'permissions', |
| | | component: () => import('../views/User/permissions.vue') |
| | | } |
| | | ] |
| | | }, |
| | | /*----------- 管理系统 ----------------*/ |
| | | { |
| | | path: 'sys', |
New file |
| | |
| | | // WebSocketService.js
|
| | |
|
| | | let socket = null;
|
| | |
|
| | | export const initializeWebSocket = (socketUrl, messageHandler) => {
|
| | | if (typeof WebSocket === "undefined") {
|
| | | console.log("Your browser does not support WebSocket");
|
| | | return null;
|
| | | }
|
| | | |
| | | const socket = new WebSocket(socketUrl);
|
| | | |
| | | socket.onopen = function () {
|
| | | console.log("WebSocket is now open");
|
| | | };
|
| | | |
| | | socket.onmessage = (msg) => {
|
| | | if (!msg.data) {
|
| | | return;
|
| | | }
|
| | | |
| | | const obj = JSON.parse(msg.data);
|
| | | |
| | | // 调用消息处理函数,将数据传递给 Vue 组件
|
| | | if (messageHandler) {
|
| | | messageHandler(obj);
|
| | | }
|
| | | };
|
| | | |
| | | return socket;
|
| | | };
|
| | | |
| | |
|
| | | export const closeWebSocket = (socket) => {
|
| | | if (socket && socket.readyState === WebSocket.OPEN) {
|
| | | socket.close();
|
| | | console.log("WebSocket connection closed");
|
| | | }
|
| | | }; |
New file |
| | |
| | | export const WebSocketHost = "localhost"; |
| | |
| | | <!-- <div class="centered-text" >NG24030401B01</div> --> |
| | | <div class="centered-text"> |
| | | <div>{{ rect.process_id }}</div> |
| | | <div style="margin-top: 50px;margin-left: -85px;">{{ rect.width }}*{{ rect.height }}</div> |
| | | <div style="margin-top: 50px;margin-left: -85px;">{{ rect.widtha }}*{{ rect.heighta }}</div> |
| | | </div> |
| | | </div> |
| | | <!-- 点击弹出 --> |
| | |
| | | x_axis: (rect.x_axis*100) * 0.005, // 将x值除以3 |
| | | y_axis: (rect.y_axis*100) * 0.005, |
| | | width: (rect.width*100) * 0.004 , |
| | | widtha: rect.width , |
| | | heighta: rect.height , |
| | | height:( rect.height*100) * 0.004 , |
| | | glass_state: rect.glass_state |
| | | })); |
| | |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | import type { TableColumnCtx } from 'element-plus' |
| | | |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | const dialogFormVisible = ref(false) |
| | | const blind = ref(false) |
| | |
| | | const adda = ref(false) |
| | | const flake = ref(false) |
| | | const flakea = ref(false) |
| | | const state = reactive({updateKey: 0}) |
| | | // const value = ref('') |
| | | import { WebSocketHost } from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | const ida = ref(null); |
| | | import { ref, onMounted } from "vue"; |
| | | // import http from "@/http/index"; |
| | | |
| | | let ruleForm = ref({ |
| | | projectNo: '', |
| | | workstationId: '', |
| | | patternHeight: '', |
| | | patternWidth: '', |
| | | filmsId: '', |
| | | patternThickness: '', |
| | | number: '', |
| | | |
| | | }) |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { ref, onMounted, onUnmounted, onBeforeUnmount } from "vue"; |
| | | // 响应式数据 |
| | | const selectedProjectNo = ref(''); // 当前选中的工程号 |
| | | const selectedProjectNoa = ref(''); // 当前选中的工程号 |
| | | const selectedValue = ref(''); // 当前选中的宽 |
| | | const selectedValuea = ref(''); |
| | | const selectedValueb = ref(''); |
| | | const selectedValuec = ref(''); |
| | | const upstatus = ref(''); // 假设这个用于显示自动/手动状态 |
| | | const cuttingMachine = ref(''); // 假设这个用于存储后端返回的状态值(0或1) |
| | | const cuttingMachineStatusColor = ref(''); // 用于动态设置i标签的背景色 |
| | | const inKageWord = ref(0); // 用于存储要传递给接口的inKageWord值 |
| | | const options = ref<any[]>([]); // 下拉选项列表 |
| | | const selectOptions = ref<Array<any>>([]); // 下拉选选项数组 |
| | | const selectOptionsa = ref<Array<any>>([]); // 下拉选选项数组 |
| | | const selectOptionsb = ref<Array<any>>([]); // 下拉选选项数组 |
| | | const selectOptionsc = ref<Array<any>>([]); // 下拉选选项数组 |
| | | const tableDataa = ref([]) |
| | | |
| | | |
| | | const tableData = reactive([]); |
| | | // let filterData = ref({ |
| | | // damageDetails: { |
| | | // state: '', |
| | | // }, |
| | | |
| | | // }) |
| | | // 发送获取表格数据的请求 |
| | | const fetchTableData = async () => { |
| | | try { |
| | | const response = await request.get("/loadGlass/up-patten-usage/prioritylist"); |
| | | |
| | | // 检查响应状态 |
| | | if (response.code === 200) { |
| | | // 更新表格数据 |
| | | console.log('成功获取表格数据:', response.data); |
| | | tableData.splice(0, tableData.length, ...response.data); |
| | | window.localStorage.setItem('engineeringId', response.data[0].engineeringId) |
| | | // 获取唯一值 |
| | | const uniqueWidths = new Set(response.data.map(item => item.width)); |
| | | const uniqueHeights = new Set(response.data.map(item => item.height)); |
| | | const uniqueFilmsIds = new Set(response.data.map(item => item.filmsId)); |
| | | const uniqueThicknesses = new Set(response.data.map(item => item.thickness)); |
| | | |
| | | selectOptions.value = Array.from(uniqueWidths).map(width => ({ |
| | | value: width, // 假设这是你想要作为value的属性 |
| | | label: width, // 假设这是你想要显示的label |
| | | })); |
| | | selectOptionsa.value = Array.from(uniqueHeights).map(height => ({ |
| | | value: height, |
| | | label: height, |
| | | })); |
| | | selectOptionsb.value = Array.from(uniqueFilmsIds).map(filmsId => ({ |
| | | value: filmsId, |
| | | label: filmsId, |
| | | })); |
| | | selectOptionsc.value = Array.from(uniqueThicknesses).map(thickness => ({ |
| | | value: thickness, |
| | | label: thickness, |
| | | })); |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理请求失败的情况 |
| | | ElMessage.error('获取表格数据失败,请重试'); |
| | | // ElMessage.error('获取表格数据失败,请重试'); |
| | | } |
| | | }; |
| | | request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | if (res.code === 200) { |
| | | window.localStorage.setItem('patternWidth', res.data.patternWidth) |
| | | window.localStorage.setItem('workstationId', res.data.workstationId) |
| | | if (res.code == 200) { |
| | | console.log(res.data); |
| | | tableDataa.value = res.data; |
| | | tableDataa.value = res.data |
| | | console.log(res.data.patternWidth); |
| | | |
| | | if (tableDataa.value.length === 2) { |
| | | if (tableDataa.value[0].patternWidth > 0) { |
| | | flake.value = true; |
| | | } |
| | | |
| | | if (tableDataa.value[1].patternWidth > 0) { |
| | | flakea.value = true; |
| | | } |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | let patternWidth = window.localStorage.getItem('patternWidth') |
| | | if (patternWidth !== '' || workstationId == '1') { |
| | | flake.value = true |
| | | } else if (patternWidth !== '' || workstationId == '2') { |
| | | flakea.value = true |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | // router.push("/login"); |
| | | ElMessage.warning(res.msg) |
| | | // router.push("/login") |
| | | } |
| | | }); |
| | | // request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | // window.localStorage.setItem('patternWidth', res.data.patternWidth) |
| | | // window.localStorage.setItem('workstationId', res.data.workstationId) |
| | | // if (res.code == 200) { |
| | | // console.log(res.data); |
| | | // tableDataa.value = res.data |
| | | // console.log(res.data.patternWidth); |
| | | |
| | | // let workstationId = window.localStorage.getItem('workstationId') |
| | | // let patternWidth = window.localStorage.getItem('patternWidth') |
| | | // if (patternWidth !== '' || workstationId == '1') { |
| | | // flake.value = true |
| | | // } else if (patternWidth !== '' || workstationId == '2') { |
| | | // flakea.value = true |
| | | // } |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // // router.push("/login") |
| | | // } |
| | | // }); |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | | processType: [], |
| | | |
| | | }) |
| | | const titleSelectJsona = ref({ |
| | | processTypea: [], |
| | | |
| | | }) |
| | | // const getBasicData = ref({ |
| | | // id: '', |
| | | // projectNo: '', |
| | | // }) |
| | | // const requestData = { |
| | | // // projectNo:"P24030805", |
| | | // state:100 |
| | | // }; |
| | | // request.post("/loadGlass/optimizeProject/listByState", requestData) |
| | | // .then((res) => { |
| | | // if (res.code == 200) { |
| | | // titleSelectJson.value.processType = res.data; |
| | | // console.log(res.data); |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // // router.push("/login") |
| | | // } |
| | | // }); |
| | | // 初始请求参数 |
| | | const socketUrl = `ws://10.153.19.150:88/api/loadGlass/api/talk/loadGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | |
| | | tableData.splice(0, tableData.length, ...data.prioritylist[0]); |
| | | tableDataa.value = data.list[0] |
| | | // console.log("更新后数据", tableData); |
| | | }; |
| | | const requestData = { |
| | | state: 100 |
| | | }; |
| | | // 响应式数据 |
| | | const selectedProjectNo = ref(''); // 当前选中的工程号 |
| | | const selectedProjectNoa = ref(''); // 当前选中的工程号 |
| | | const options = ref<any[]>([]); // 下拉选项列表 |
| | | |
| | | // 调用接口获取选项数据的函数 |
| | | const fetchOptions = async (queryString: string) => { |
| | | try { |
| | |
| | | |
| | | if (response.code == 200) { |
| | | titleSelectJson.value.processType = response.data; |
| | | console.log(response.data); |
| | | |
| | | } else { |
| | | ElMessage.warning(response.data); |
| | | } |
| | | } catch (error) { |
| | | console.error('Error fetching options:', error); |
| | | } |
| | | }; |
| | | // 开始上片下拉选 |
| | | const fetchOptionsa = async (queryString: string) => { |
| | | try { |
| | | // 发送请求到后端接口 |
| | | const response = await request.get('/loadGlass/engineering/engineering/selectTask'); |
| | | if (response.code == 200) { |
| | | titleSelectJsona.value.processTypea = response.data; |
| | | console.log(response.data); |
| | | |
| | | } else { |
| | |
| | | }; |
| | | // 初始化加载数据(如果需要) |
| | | onMounted(() => { |
| | | // 在组件挂载后调用 fetchOptions('') 来加载初始数据(如果需要) |
| | | fetchOptions(''); |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onMounted(() => { |
| | | // 在组件挂载后调用 fetchOptions('') 来加载初始数据(如果需要) |
| | | fetchOptionsa(''); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | // const billall = () => { |
| | | // request.post("/loadGlass/optimizeProject/listByState", requestData) |
| | | // .then((res: any) => { |
| | | // // if (res.code == 200) { |
| | | // tableData.value = res.data; |
| | | // // let self = this |
| | | // // } |
| | | // }) |
| | | // .catch((err: any) => {}); |
| | | // } |
| | | const user = ref(''); |
| | | // 定义表头上传数据 |
| | | // let titleUploadData = ref({ |
| | | // projectNo:'', |
| | | // }) |
| | | const projectNo = ref(''); |
| | | const workstationId = ref(''); |
| | | const id = ref(''); |
| | |
| | | const response = await request.post('/loadGlass/LoadGlass/updateGlassMessage', { |
| | | id: workstationId.value, |
| | | workstationId: workstationId.value, |
| | | patternHeight: patternHeight.value, |
| | | patternWidth: patternWidth.value, |
| | | filmsId: filmsId.value, |
| | | patternThickness: patternThickness.value, |
| | | patternHeight: selectedValuea.value, |
| | | patternWidth: selectedValue.value, |
| | | filmsId: selectedValueb.value, |
| | | patternThickness: selectedValuec.value, |
| | | number: number.value |
| | | }); |
| | | if (response.code == 200) { |
| | |
| | | // window.location.reload() |
| | | add.value = false; |
| | | tableDataa.value = response.data; |
| | | selectedValuea.value = ''; |
| | | selectedValue.value = ''; |
| | | selectedValueb.value = ''; |
| | | selectedValuec.value = ''; |
| | | number.value = ''; |
| | | window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId == '1') { |
| | |
| | | const response = await request.post('/loadGlass/LoadGlass/updateGlassMessage', { |
| | | id: workstationId.value, |
| | | workstationId: workstationId.value, |
| | | patternHeight: patternHeight.value, |
| | | patternWidth: patternWidth.value, |
| | | filmsId: filmsId.value, |
| | | patternThickness: patternThickness.value, |
| | | patternHeight: selectedValuea.value, |
| | | patternWidth: selectedValue.value, |
| | | filmsId: selectedValueb.value, |
| | | patternThickness: selectedValuec.value, |
| | | number: number.value |
| | | }); |
| | | if (response.code == 200) { |
| | |
| | | // window.location.reload() |
| | | add.value = false; |
| | | tableDataa.value = response.data; |
| | | selectedValuea.value = ''; |
| | | selectedValue.value = ''; |
| | | selectedValueb.value = ''; |
| | | selectedValuec.value = ''; |
| | | number.value = ''; |
| | | window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId == '1') { |
| | |
| | | // 选择工程确认 |
| | | const handleup = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/up-patten-usage/saveUpPattenUsage', { |
| | | const response = await request.post('/loadGlass/up-patten-usage/selectUpPattenUsage', { |
| | | engineerId: selectedProjectNo.value, |
| | | }) |
| | | if (response.code == 200) { |
| | |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | dialogFormVisible.value = false; |
| | | tableData.splice(0, tableData.length, ...response.data); |
| | | selectedProjectNo.value = '' |
| | | markingMachineStatus.value = '#911005'; |
| | | cuttingMachineStatus.value = '#911005'; |
| | | const uniqueWidths = new Set(response.data.map(item => item.width)); |
| | | const uniqueHeights = new Set(response.data.map(item => item.height)); |
| | | const uniqueFilmsIds = new Set(response.data.map(item => item.filmsId)); |
| | | const uniqueThicknesses = new Set(response.data.map(item => item.thickness)); |
| | | |
| | | selectOptions.value = Array.from(uniqueWidths).map(width => ({ |
| | | value: width, // 假设这是你想要作为value的属性 |
| | | label: width, // 假设这是你想要显示的label |
| | | })); |
| | | selectOptionsa.value = Array.from(uniqueHeights).map(height => ({ |
| | | value: height, |
| | | label: height, |
| | | })); |
| | | selectOptionsb.value = Array.from(uniqueFilmsIds).map(filmsId => ({ |
| | | value: filmsId, |
| | | label: filmsId, |
| | | })); |
| | | selectOptionsc.value = Array.from(uniqueThicknesses).map(thickness => ({ |
| | | value: thickness, |
| | | label: thickness, |
| | | })); |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | } |
| | | // 开始上片 |
| | | const handle = async () => { |
| | | if (markingMachineStatus.value === 'green' && cuttingMachineStatus.value === 'green') { |
| | | |
| | | try { |
| | | let engineeringId = window.localStorage.getItem('engineeringId') |
| | | console.log(engineeringId); |
| | | |
| | | const response = await request.post('/loadGlass/engineering/engineering/changeTask', { |
| | | engineerId: selectedProjectNoa.value, |
| | | engineerId: engineeringId, |
| | | state: 1, |
| | | }) |
| | | if (response.code == 200) { |
| | |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | blind.value = false; |
| | | tableData.splice(0, tableData.length, ...response.data); |
| | | |
| | | selectedProjectNoa.value = '' |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } else if (markingMachineStatus.value === '#911005' || cuttingMachineStatus.value === '#911005') { |
| | | // 提示用户打标机未就绪 |
| | | ElMessage.warning('请确认打标机和切割机的就绪状态!'); |
| | | } |
| | | } |
| | | // 暂停 |
| | | const handlea = async () => { |
| | |
| | | let engineeringId = window.localStorage.getItem('engineeringId') |
| | | console.log(engineeringId); |
| | | if (engineeringId !== '') { |
| | | const response = await request.post('/loadGlass/engineering/engineering/changeTask', { |
| | | const response = await request.post('/loadGlass/engineering/engineering/pauseTask', { |
| | | engineeringId: engineeringId, |
| | | state: 0, |
| | | }) |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | blinda.value = false; |
| | | // tableData.value = response.data |
| | | // tableData.value = []; |
| | | state.updateKey ++ |
| | | tableData.splice([]); |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | let engineeringId = window.localStorage.getItem('engineeringId') |
| | | console.log(engineeringId); |
| | | if (engineeringId !== '') { |
| | | const response = await request.post('/loadGlass/engineering/engineering/changeTask', { |
| | | const response = await request.post('/loadGlass/engineering/engineering/pauseTask', { |
| | | engineeringId: engineeringId, |
| | | state: 0, |
| | | }) |
| | |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | blindb.value = false; |
| | | state.updateKey ++ |
| | | tableData.splice([]); |
| | | |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | return '上片中'; |
| | | case 100: |
| | | return '已完成'; |
| | | default: |
| | | return '未知状态'; |
| | | } |
| | | } |
| | | |
| | | function getStatusType(state: number) { |
| | | // 这里假设只有100时类型不是success,其他都是success |
| | | return state === 100 ? 'info' : 'success'; // 根据需要调整类型 |
| | | switch (state) { |
| | | case 0: |
| | | return 'warning'; |
| | | case 1: |
| | | return 'primary'; |
| | | case 2: |
| | | return 'primary'; |
| | | case 100: |
| | | return 'success'; |
| | | } |
| | | // const open = () => { |
| | | // ElMessageBox.confirm( |
| | | // '是否删除该条信息?', |
| | | // '提示', |
| | | // { |
| | | // confirmButtonText: '是', |
| | | // cancelButtonText: '取消', |
| | | // type: 'warning', |
| | | // } |
| | | // ) |
| | | // .then(() => { |
| | | // ElMessage({ |
| | | // type: 'success', |
| | | // message: '删除成功!', |
| | | // }) |
| | | // }) |
| | | // .catch(() => { |
| | | // ElMessage({ |
| | | // type: 'info', |
| | | // message: '删除失败', |
| | | // }) |
| | | // }) |
| | | // } |
| | | } |
| | | // 开始上片 |
| | | const handleBind = (row) => { |
| | | // engineeringId.value = row.engineeringId; |
| | | |
| | | blind.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | // 暂停 |
| | | const handleBinda = (row) => { |
| | | // engineeringId.value = row.engineeringId; |
| | | |
| | | blinda.value = true; // 打开绑定架子对话框 |
| | | blinda.value = true; |
| | | }; |
| | | // 停止任务 |
| | | const handleBindb = (row) => { |
| | | // engineeringId.value = row.engineeringId; |
| | | |
| | | blindb.value = true; // 打开绑定架子对话框 |
| | | blindb.value = true; |
| | | }; |
| | | |
| | | // 删除 |
| | | const handleBindRacka = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | |
| | | adda.value = true; // 打开绑定架子对话框 |
| | | workstationId.value = row.workstationId; |
| | | adda.value = true; |
| | | }; |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | data: [ |
| | | { |
| | | 'id': '1', |
| | | 'long': '5', |
| | | 'wide': '1005', |
| | | 'thick': '183.6', |
| | | // 定义一个响应式引用,用于存储颜色状态 |
| | | const markingMachineStatus = ref('#911005'); |
| | | const cuttingMachineStatus = ref('#911005'); |
| | | // 定义一个方法来改变颜色状态 |
| | | const confirmMarkingMachine = () => { |
| | | markingMachineStatus.value = 'green'; |
| | | }; |
| | | const confirmCuttingMachine = () => { |
| | | cuttingMachineStatus.value = 'green'; |
| | | }; |
| | | |
| | | |
| | | |
| | | const wsUrl = 'ws://10.153.19.150:88/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.onclose = (event) => { |
| | | if (event.wasClean) { |
| | | console.log('WebSocket连接已正常关闭'); |
| | | } else { |
| | | console.error('WebSocket连接异常关闭'); |
| | | } |
| | | ], |
| | | }) |
| | | }; |
| | | |
| | | // 监听WebSocket的消息事件 |
| | | ws.onmessage = (event) => { |
| | | // 假设服务器发送的是JSON格式的字符串 |
| | | try { |
| | | const data = JSON.parse(event.data); // 解析消息为JSON |
| | | |
| | | // 假设服务器发送的数据结构是 { InkageStatus: ["1"] } |
| | | if (data && Array.isArray(data.InkageStatus) && data.InkageStatus.length > 0) { |
| | | const status = data.InkageStatus[0]; |
| | | cuttingMachine.value = status; |
| | | upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green'; |
| | | 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', |
| | | inKageWord.value |
| | | ); |
| | | if (response.code == 200) { |
| | | const status = response.data.status; |
| | | upstatus.value = status === '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | cuttingMachineStatusColor.value = status === '1' ? '#911005' : 'green'; |
| | | // 显示成功消息 |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | ElMessage.error(response.message || '请求失败'); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error('请求时发生错误', error); |
| | | ElMessage.error('请求时发生错误'); |
| | | } |
| | | }; |
| | | // const confirmCutting = async () => { |
| | | // try { |
| | | // const response = await request.post('/loadGlass/LoadGlass/updateMesInkageLoad', { |
| | | // inKageWord: inKageWord.value |
| | | // }) |
| | | // if (response.code == 200) { |
| | | // inKageWord == '1' ? '上片机联机状态:' : '上片机手动状态:'; |
| | | // inKageWord.value == '1' ? '#911005' : 'green'; |
| | | // ElMessage.success(response.message); |
| | | // } else { |
| | | // // 请求失败,显示错误消息 |
| | | // ElMessage.error(response.msg); |
| | | // } |
| | | // } |
| | | // catch (error) { |
| | | // // 处理错误 |
| | | // console.error(error); |
| | | // } |
| | | // } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <div id="dotClass"> |
| | | <div>打标机就绪状态:</div> |
| | | <i style="margin-top: 2px; background-color: green;width:18px; height:18px; border-radius: 50%; display: block"></i> |
| | | <el-button style="margin-left: 30px;margin-top: -3px;">手动确认</el-button> |
| | | |
| | | <i :style="{ marginTop: '2px', backgroundColor: markingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i> |
| | | <el-button @click="confirmMarkingMachine" style="margin-left: 30px;margin-top: -3px;">确认</el-button> |
| | | <div style="margin-left: 70px;">切割机就绪状态:</div> |
| | | <i style="margin-top: 2px; background-color: #911005 ;width:18px; height:18px; border-radius: 50%; display: block"></i> |
| | | <el-button style="margin-left: 30px;margin-top: -3px;" >手动确认</el-button> |
| | | <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatus, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i> |
| | | <el-button @click="confirmCuttingMachine" style="margin-left: 30px;margin-top: -3px;" >确认</el-button> |
| | | <div style="margin-left: 70px;">{{ upstatus }} </div> |
| | | <i :style="{ marginTop: '2px', backgroundColor: cuttingMachineStatusColor, width: '18px', height: '18px', borderRadius: '50%', display: 'block' }"></i> |
| | | <el-button @click="confirmCutting" style="margin-left: 30px;margin-top: -3px;" >确认</el-button> |
| | | |
| | | </div> |
| | | <el-button style="margin-top: 5px;margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true">选择工程</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">开始上片</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 style="width: 98%; height: calc(100% - 35px); overflow-y: auto;" :key="state.updateKey"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> |
| | | <el-table |
| | | height="150" |
| | | ref="table" |
| | |
| | | > |
| | | <el-table-column prop="engineeringId" label="工程号" width="200" align="center"/> |
| | | <el-table-column prop="width" label="原片宽" align="center"/> |
| | | <el-table-column prop="height" label="原片长" align="center"/> |
| | | <el-table-column prop="height" label="原片高" align="center"/> |
| | | <el-table-column prop="filmsId" label="膜系" align="center"/> |
| | | <el-table-column prop="layoutSequence" label="数量" align="center"/> |
| | | <el-table-column prop="thickness" label="厚度" align="center"/> |
| | |
| | | {{ getStatusText(scope.row.state) }} |
| | | </el-tag> |
| | | </template> |
| | | <!-- <template #default="scope"> |
| | | <el-tag type="success" >{{ scope.row.state==0?"等待中":"上片中" }}</el-tag> |
| | | </template> --> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | |
| | | </el-card> |
| | | <el-dialog v-model="blind" top="24vh" width="30%" title="是否开始上片?" > |
| | | <div style="margin-left: 50px;margin-bottom: 10px;"> |
| | | <el-form-item label="工程号:" :required="true"> |
| | | <el-select |
| | | v-model="selectedProjectNoa" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择工程" |
| | | style="width: 220px" |
| | | @input="handleInputChangea" |
| | | > |
| | | <el-option |
| | | v-for="item in titleSelectJsona['processTypea']" |
| | | :key="item.id" |
| | | :label="item.engineerId" |
| | | :value="item.engineerId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div> |
| | | <el-dialog v-model="blind" top="30vh" width="25%" title="是否开始上片?" > |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="handle"> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- <el-dialog v-model="blind" top="30vh" width="25%" title="是否开始上片?" > |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="handle"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="blind = false">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> --> |
| | | <el-dialog v-model="blinda" top="30vh" width="25%" title="是否暂停?" > |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | |
| | | <div id="overlaya" v-show="flakea"></div> |
| | | </div> |
| | | <div style="margin-top: -350px;margin-left: 650px;"> |
| | | <el-table :data="tableDataa" border style="width: 60%" |
| | | <el-table :data="tableDataa" border style="width: 70%" |
| | | :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" |
| | | > |
| | | <el-table-column prop="workstationId" align="center" label="工位" min-width="50" /> |
| | | <el-table-column prop="patternWidth" align="center" label="宽" min-width="80" /> |
| | | <el-table-column prop="patternHeight" align="center" label="长" min-width="80" /> |
| | | <el-table-column prop="patternHeight" align="center" label="高" min-width="80" /> |
| | | <el-table-column prop="filmsId" align="center" label="膜系" min-width="80" /> |
| | | <el-table-column prop="number" align="center" label="数量" min-width="80" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="150"> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="长:" :required="true" style="width: 14vw"> |
| | | <el-input v-model="patternHeight" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | <el-form-item label="宽:" :required="true" style="width: 14vw"> |
| | | <el-select |
| | | v-model="selectedValue" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择宽" |
| | | style="width: 220px" |
| | | @input="handleInputChangea" |
| | | > |
| | | <el-option |
| | | v-for="item in selectOptions" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div></div> |
| | | </el-col> |
| | | <el-col :span="9"> |
| | | <div id="dta" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="宽:" :required="true" style="width: 14vw"> |
| | | <el-input v-model="patternWidth" autocomplete="off" /> |
| | | <el-form-item label="高:" :required="true" style="width: 14vw"> |
| | | <el-select |
| | | v-model="selectedValuea" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择高" |
| | | style="width: 220px" |
| | | @input="handleInputChangea" |
| | | > |
| | | <el-option |
| | | v-for="item in selectOptionsa" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div> |
| | | </div> |
| | | </el-col> |
| | |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="膜系:" :required="true" style="width: 14vw;"> |
| | | <el-input v-model="filmsId" autocomplete="off" /> |
| | | <el-select |
| | | v-model="selectedValueb" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择膜系" |
| | | style="width: 220px" |
| | | @input="handleInputChangea" |
| | | > |
| | | <el-option |
| | | v-for="item in selectOptionsb" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | <el-col :span="9"> |
| | | <div id="dta" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="厚度:" :required="true" style="width: 14vw"> |
| | | <el-input v-model="patternThickness" autocomplete="off" /> |
| | | <el-select |
| | | v-model="selectedValuec" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择厚度" |
| | | style="width: 220px" |
| | | @input="handleInputChangea" |
| | | > |
| | | <el-option |
| | | v-for="item in selectOptionsc" |
| | | :key="item.id" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <!-- <el-input v-model="patternThickness" autocomplete="off" /> --> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | |
| | | |
| | | <el-dialog v-model="dialogFormVisible" top="24vh" width="30%" title="工程" > |
| | | <div style="margin-left: 50px;margin-bottom: 10px;"> |
| | | <el-form-item label="工程号:" :required="true"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, watchEffect } from 'vue'; |
| | | import { ref, watchEffect ,onMounted} from 'vue'; |
| | | |
| | | import Swal from 'sweetalert2' |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost } 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' } }, |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | fetchFlowCardId() |
| | | // setTimeout(fetchFlowCardId(),1000); |
| | | //setInterval(fetchFlowCardId, 2000) |
| | | const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass2`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | |
| | | // 更新 tableData 的数据 |
| | | |
| | | data.glassinfo[0].forEach((itemData, index) => { |
| | | if (index < racks.value.length) { |
| | | const rack = racks.value[index]; |
| | | const newItem = { |
| | | content: itemData.item.content, |
| | | fillColor: itemData.item.fillColor, |
| | | width: itemData.item.width === 0 ? "" : 10, |
| | | height: itemData.item.height === 0 ? "" : 90 |
| | | }; |
| | | |
| | | if (index === 2 && itemData.item.width > 0) { |
| | | newItem.width = 100; |
| | | newItem.height = 20; |
| | | } |
| | | |
| | | rack.item = newItem; |
| | | |
| | | // console.log("显示图1",racks.value); // 打印更新后的 racks 值 |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | onMounted(() => { |
| | | fetchFlowCardId(); // 获取数据 |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | |
| | | |
| | | const showCustomAlert = (content) => { |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, watchEffect } from 'vue'; |
| | | import { ref, watchEffect ,onMounted} from 'vue'; |
| | | |
| | | import Swal from 'sweetalert2' |
| | | import request from "@/utils/request"; |
| | | |
| | | import { initializeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost } 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' } }, |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | fetchFlowCardId() |
| | | const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass3`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | |
| | | // 更新 tableData 的数据 |
| | | |
| | | data.glassinfo2[0].forEach((itemData, index) => { |
| | | if (index < racks.value.length) { |
| | | const rack = racks.value[index]; |
| | | const newItem = { |
| | | content: itemData.item.content, |
| | | fillColor: itemData.item.fillColor, |
| | | width: itemData.item.width === 0 ? "" : 10, |
| | | height: itemData.item.height === 0 ? "" : 90 |
| | | }; |
| | | |
| | | if (index === 2 && itemData.item.width > 0) { |
| | | newItem.width = 100; |
| | | newItem.height = 20; |
| | | } |
| | | |
| | | rack.item = newItem; |
| | | |
| | | //console.log("显示图2",racks.value); // 打印更新后的 racks 值 |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | // 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | onMounted(() => { |
| | | fetchFlowCardId(); // 获取数据 |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | |
| | | |
| | | // const showCustomAlert = (content) => { |
| | | // var str="架号 : 111\n" + |
| | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive, onMounted} from "vue"; |
| | | import {reactive, onMounted, onBeforeUnmount} from "vue"; |
| | | |
| | | import {useRouter} from "vue-router" |
| | | const router = useRouter() |
| | | |
| | |
| | | import Landingindication from "./Landingindication.vue"; |
| | | import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import request from "@/utils/request"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { WebSocketHost } from '@/utils/constants'; |
| | | |
| | | |
| | | const dialogFormVisiblea = ref(false) |
| | | |
| | | |
| | | |
| | | const dialogFormVisiblea2 = ref(false) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | let socket; |
| | | |
| | | |
| | | const initWebSocket = (token) =>{ //初始化we |
| | | |
| | | let viewname = "unloadglass"; |
| | | |
| | | if (typeof WebSocket === "undefined") { |
| | | console.log("您的浏览器不支持WebSocket"); |
| | | } else { |
| | | let socketUrl = "ws://" + "localhost"+":88" + "/api/talk/" + viewname; |
| | | if (socket != null) { |
| | | socket.close(); |
| | | socket = null; |
| | | } |
| | | |
| | | // 开启一个websocket服务 |
| | | socket = new WebSocket(socketUrl); |
| | | |
| | | // 打开事件 |
| | | socket.onopen = function () { |
| | | console.log("websocket已打开"); |
| | | }; |
| | | |
| | | |
| | | |
| | | socket.onmessage = (msg) => { |
| | | if (!msg.data) { |
| | | return; // 如果收到空数据,则直接返回,不执行后续逻辑 |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | |
| | | |
| | | console.log('收到消息:', obj.data); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 数据 |
| | | const loading = ref(false); |
| | | |
| | | |
| | | // 弹框显示控制 |
| | | |
| | | const dialogFormVisible = ref(false); |
| | | |
| | | // 表单数据 |
| | | const workstationId = ref(''); |
| | | const flowCardId = ref(''); |
| | | const flowCardOptions = ref([]); |
| | | const tableData = reactive([]); |
| | | |
| | | // 方法 |
| | | const handleSelectionChange = () => { |
| | | // 处理表格行选择事件 |
| | |
| | | |
| | | const handleBindRack = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | |
| | | // 发起接口请求获取流程卡号 |
| | | fetchFlowCardId(); |
| | | |
| | | |
| | | dialogFormVisiblea.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | |
| | | |
| | | |
| | | //获取流程卡号 |
| | | const fetchFlowCardId = async () => { |
| | |
| | | const response = await request.get('unLoadGlass/downWorkStation/getflowCardId'); |
| | | console.log(response) |
| | | if (response.code === 200) { |
| | | flowCardOptions.value = response.data.map(item => ({ flowcard_id: item.flow_card_Id })); |
| | | console.log(flowCardOptions.value) |
| | | } else { |
| | | flowCardOptions.value = response.data |
| | | .filter(item => item !== null) |
| | | .map(item => ({ flowcard_id: item.flow_card_Id })); |
| | | console.log(flowCardOptions.value); |
| | | } |
| | | else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | |
| | | // 假设你的页面上有一个名为 tableData 的 Vue 组件 |
| | | // 你可以直接更新 tableData 的数据 |
| | | fetchTableData() |
| | | |
| | | // 使用 $forceUpdate() 强制更新组件 |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | const handleBindRack2 = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | |
| | | |
| | | |
| | | |
| | | dialogFormVisiblea2.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | //清除内容 |
| | |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 发送获取表格数据的请求 |
| | | const fetchTableData = async () => { |
| | | try { |
| | |
| | | }; |
| | | |
| | | |
| | | const socketUrl = `ws://${WebSocketHost}:8085/api/talk/unloadglass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | |
| | | // 更新 tableData 的数据 |
| | | |
| | | tableData.splice(0, tableData.length, ...data.params[0]); |
| | | // console.log("更新后数据", tableData); |
| | | |
| | | }; |
| | | |
| | | // 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | onMounted(() => { |
| | | fetchFlowCardId(); |
| | | fetchTableData(); // 获取数据 |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | |
| | | // beforeUnmount(() => { |
| | | // closeWebSocket(); |
| | | // }); |
| | | |
| | | |
| | | // initWebSocket(); |
| | | onMounted(fetchTableData); |
| | | // setInterval(fetchTableData, 2000) |
| | | |
| | | const open = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: '删除失败', |
| | | }) |
| | | }) |
| | | } |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | data: [ |
| | | { |
| | | 'id': '1', |
| | | 'long': '5', |
| | | 'wide': '1005', |
| | | 'thick': '183.6', |
| | | } |
| | | ], |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </script> |
| | |
| | | <el-table-column prop="racksnumber" align="center" label="已落架数量" min-width="120" /> |
| | | <el-table-column prop="work_state" align="center" label="状态" min-width="120" /> |
| | | <el-table-column prop="deviceId" align="center" label="设备号" min-width="120" /> |
| | | <el-table-column prop="enableState" align="center" label="启用状态" min-width="120" /> |
| | | |
| | | |
| | | |
| | | <el-table-column |
| | | align="center" |
| | | label="启用状态" |
| | | min-width="80" |
| | | prop="enableState" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag type="success" >{{ scope.row.enableState==1?"启用":"未启用" }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain v-show="scope.row.enableState !== '已启用' " @click="handleBindRack(scope.row)">绑定架子</el-button> |
| | |
| | | <script lang="ts" setup> |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | import { ref } from 'vue' |
| | | |
| | | const router = useRouter() |
| | | const value1 = ref(true) |
| | | const add = ref(false) |
| | | const adda = ref(false) |
| | | |
| | | const changer = ref(false) |
| | | const editingUser = ref({}); // 用于存储当前编辑的用户数据 |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted } from "vue"; |
| | | // import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | // import LanguageMixin from './lang/LanguageMixin' |
| | | const selectedProjectNoa = ref(''); // 当前选中的角色 |
| | | // const options = ref<any[]>([]); // 下拉选项列表 |
| | | const menuName = ref(''); |
| | | const parentId = ref(''); |
| | | const url = ref(''); |
| | | const tableData = ref([]) |
| | | const slot = ref('') |
| | | request.get("/loadGlass/sys/menu/nav").then((res) => { |
| | | if (res.code == 200) { |
| | | console.log(res.data); |
| | | tableData.value = res.data.tree |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | |
| | | const tableData = [ |
| | | { |
| | | id: '1', |
| | | long: '1005', |
| | | wide: '183.6', |
| | | thick: '1991', |
| | | time: '2024/4/1', |
| | | type: '待识别', |
| | | typea: '1', |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | time: '2024/4/1', |
| | | thick: '191', |
| | | typea: '1', |
| | | type: '待识别' |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | time: '2024/4/1', |
| | | thick: '191', |
| | | typea: '1', |
| | | type: '待识别' |
| | | }, |
| | | ] |
| | | const open = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: '删除失败', |
| | | }) |
| | | }) |
| | | } |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | const dialogForm = () => { |
| | | ElMessageBox.confirm( |
| | | '是否重置密码?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | // this.boxa = true |
| | | // this.box = false |
| | | |
| | | }) |
| | | } |
| | | const dialogForma = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | } |
| | | |
| | | const options = [ |
| | | { |
| | | value: 'Option1', |
| | | label: 'admin', |
| | | }, |
| | | { |
| | | value: 'Option2', |
| | | label: 'ueser2', |
| | | }, |
| | | { |
| | | value: 'Option3', |
| | | label: 'ueser3', |
| | | }, |
| | | ] |
| | | const optionsa = [ |
| | | { |
| | | valuea: 'Option1', |
| | | labela: '正常', |
| | | }, |
| | | { |
| | | valuea: 'Option2', |
| | | labela: '禁用', |
| | | }, |
| | | ] |
| | | |
| | | const data= reactive({ |
| | | tableList:[]//table数据 |
| | | }) |
| | | |
| | | const beforeChange = () => { |
| | | return new Promise((resolve) => { |
| | | setTimeout(() => { |
| | | ElMessage.success("修改成功!"); |
| | | return resolve(true); |
| | | }, 1000); |
| | | }); |
| | | const titleSelectJsona = ref({ |
| | | processType: [], |
| | | |
| | | }) |
| | | // const handleInputChangea = async (value: string) => { |
| | | // if (value) { |
| | | // await fetchOptionsa(value); |
| | | // } else { |
| | | // options.value = []; // 清空选项列表 |
| | | // } |
| | | // }; |
| | | onMounted(() => { |
| | | // 在组件挂载后调用 fetchOptions('') 来加载初始数据(如果需要) |
| | | fetchOptionsa(''); |
| | | }); |
| | | // 角色下拉选 |
| | | const fetchOptionsa = async () => { |
| | | try { |
| | | // 发送请求到后端接口 |
| | | const response = await request.post('/loadGlass/sys/role/queryRole',{ |
| | | key: '' |
| | | }); |
| | | if (response.code == 200) { |
| | | titleSelectJsona.value.processTypea = response.data; |
| | | console.log(response.data); |
| | | |
| | | } else { |
| | | ElMessage.warning(response.data); |
| | | } |
| | | } catch (error) { |
| | | console.error('Error fetching options:', error); |
| | | } |
| | | }; |
| | | // 添加 |
| | | const getTableRow = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/menu/save', { |
| | | menuName: menuName.value, |
| | | parentId: parentId.value, |
| | | url: url.value, |
| | | }); |
| | | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | add.value = false; |
| | | // tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | // 处理编辑按钮点击 |
| | | function handleEdit(row) { |
| | | editingUser.value = { ...row }; // 使用展开运算符复制当前行数据 |
| | | adda.value = true; // 显示对话框 |
| | | } |
| | | // 编辑 |
| | | const getTableRowa = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/menu/updateMenu', { |
| | | menuName: menuName.value, |
| | | parentId: parentId.value, |
| | | url: url.value, |
| | | }); |
| | | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | editingUser.value = {}; |
| | | adda.value = false; |
| | | tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | // 删除 |
| | | const opena = async(row) => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否删除该用户?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/loadGlass/sys/menu/deleteMenu", { |
| | | menuId: row.id, |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | // //js层,实战版本,与后台接口交互 |
| | | // const gettableList = (id) = >{ |
| | | // xxx接口.({ |
| | | // id:id |
| | | // }).then((res)=>{ |
| | | // //将数据传给el-table绑定的:data=>data.tableList |
| | | // data.tableList = res.data |
| | | |
| | | // }) |
| | | // } |
| | | |
| | | // //最后将请求函数挂载到vue视图上 |
| | | // onMounted(() => { |
| | | // gettableList () |
| | | |
| | | // }) |
| | | // const delete = () => { |
| | | // ElMessageBox.confirm( |
| | | // '是否删除该条信息?', |
| | | // '提示', |
| | | // const gridOptions = reactive({ |
| | | // border: "full",//表格加边框 |
| | | // keepSource: true,//保持源数据 |
| | | // align: 'center',//文字居中 |
| | | // stripe:true,//斑马纹 |
| | | // rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | // id: 'OrderList', |
| | | // showFooter: true,//显示脚 |
| | | // printConfig: {}, |
| | | // importConfig: {}, |
| | | // exportConfig: {}, |
| | | // scrollY:{ enabled: true },//开启虚拟滚动 |
| | | // showOverflow:true, |
| | | // columnConfig: { |
| | | // resizable: true, |
| | | // useKey: true |
| | | // }, |
| | | // filterConfig: { //筛选配置项 |
| | | // remote: true |
| | | // }, |
| | | // customConfig: { |
| | | // storage: true |
| | | // }, |
| | | // editConfig: { |
| | | // trigger: 'click', |
| | | // mode: 'row', |
| | | // showStatus: true |
| | | // }, |
| | | // data: [ |
| | | // { |
| | | // confirmButtonText: '是', |
| | | // cancelButtonText: '取消', |
| | | // type: 'warning', |
| | | // 'id': '1', |
| | | // 'long': '5', |
| | | // 'wide': '1005', |
| | | // 'thick': '183.6', |
| | | // } |
| | | // ) |
| | | // .then(() => { |
| | | // ] |
| | | |
| | | // }) |
| | | // } |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | | align: 'center',//文字居中 |
| | | stripe:true,//斑马纹 |
| | | rowConfig: {isCurrent: true, isHover: true,height: 50},//鼠标移动或选择高亮 |
| | | id: 'OrderList', |
| | | showFooter: true,//显示脚 |
| | | printConfig: {}, |
| | | importConfig: {}, |
| | | exportConfig: {}, |
| | | scrollY:{ enabled: true },//开启虚拟滚动 |
| | | showOverflow:true, |
| | | columnConfig: { |
| | | resizable: true, |
| | | useKey: true |
| | | }, |
| | | filterConfig: { //筛选配置项 |
| | | remote: true |
| | | }, |
| | | customConfig: { |
| | | storage: true |
| | | }, |
| | | editConfig: { |
| | | trigger: 'click', |
| | | mode: 'row', |
| | | showStatus: true |
| | | }, |
| | | data: [ |
| | | { |
| | | 'id': '1', |
| | | 'long': '5', |
| | | 'wide': '1005', |
| | | 'thick': '183.6', |
| | | 'time': '2024/4/1', |
| | | } |
| | | ] |
| | | }) |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">添加用户</el-button> |
| | | <el-input |
| | | clearable |
| | | placeholder="请输入用户名" |
| | | size="mini" |
| | | style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;" |
| | | /> |
| | | <el-input |
| | | clearable |
| | | placeholder="请输入邮箱" |
| | | size="mini" |
| | | style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;" |
| | | /> |
| | | <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">查询</el-button > |
| | | <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">清空</el-button> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;"> |
| | | <el-table height="100%" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="id" align="center" label="用户名" min-width="80" /> |
| | | <el-table-column prop="long" align="center" label="邮箱" min-width="120" /> |
| | | <el-table-column prop="time" align="center" label="创建时间" min-width="120" /> |
| | | <el-table-column align="center" prop="changer" label="是否禁用" min-width="140" > |
| | | <div style="height: 700px;"> |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">添加菜单</el-button> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 650px;"> |
| | | <el-table |
| | | :data="tableData" |
| | | height="650" |
| | | @expand-change="handleExpandChange" |
| | | row-key="id" |
| | | :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" |
| | | > |
| | | <el-table-column type="expand"> |
| | | <template #default="props"> |
| | | <div v-if="props.row.children && props.row.children.length"> |
| | | <el-table |
| | | :data="props.row.children" |
| | | border |
| | | style="width: 100%;margin-left: 20px;" |
| | | row-key="id" |
| | | :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" |
| | | > |
| | | <el-table-column prop="menuName" label="二级菜单栏" align="center" min-width="140" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"/> |
| | | <el-table-column prop="url" label="链接" align="center" min-width="160"/> |
| | | <el-table-column prop="id" align="center" label="排序" min-width="140"/> |
| | | <el-table-column fixed="right" label="操作" align="center"> |
| | | <template #default="scope"> |
| | | <el-switch v-model="scope.row.changer" :before-change="beforeChange" /> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default> |
| | | <el-button size="mini" type="text" plain @click="dialogForm">重置密码</el-button> |
| | | <el-button size="mini" type="text" plain @click="adda = true">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="dialogForma">删除</el-button> |
| | | <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="menuName" label="一级菜单栏" align="center" min-width="120" /> |
| | | <el-table-column prop="url" label="链接" align="center" min-width="200"/> |
| | | <el-table-column prop="id" align="center" label="排序" min-width="180" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- <el-table height="240" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="menuName" align="center" label="菜单栏" min-width="180" /> |
| | | <el-table-column align="center" label="链接" min-width="180"> |
| | | <template #default="scope"> |
| | | <el-tag v-for="role in scope.row.children"> |
| | | {{role.url}} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="id" align="center" label="排序" min-width="180" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain @click="adda = true">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> --> |
| | | </div> |
| | | |
| | | <el-dialog v-model="add" top="23vh" width="37%" title="添加用户" > |
| | | </el-card> |
| | | </div> |
| | | <el-dialog v-model="add" top="23vh" width="37%" title="添加菜单" > |
| | | <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="用户名:" :required="true" style="width: 25vw"> |
| | | <el-input autocomplete="off" /> |
| | | <el-form-item label="菜单栏:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="menuName" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择角色" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-form-item label="链接:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="url" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="邮箱:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="是否禁用" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择是否禁用" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in optionsa" |
| | | :key="item.valuea" |
| | | :label="item.labela" |
| | | :value="item.valuea" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="密码:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | <el-form-item label="排序:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="parentId" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow('edit')"> |
| | | <el-button type="primary" @click="getTableRow"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="add = false">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="adda" top="23vh" width="37%" title="修改用户" > |
| | | <el-dialog v-model="adda" top="23vh" width="37%" title="修改菜单" > |
| | | <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form :model="editingUser" ref="formRef" size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | | <el-row style="margin-top: -15px;margin-bottom: -2px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="用户名:" :required="true" style="width: 25vw"> |
| | | <el-input autocomplete="off" /> |
| | | <el-form-item label="菜单栏:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="editingUser.menuName" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择角色" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | <el-form-item label="链接:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="editingUser.url" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="邮箱:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="是否禁用" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择是否禁用" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in optionsa" |
| | | :key="item.valuea" |
| | | :label="item.labela" |
| | | :value="item.valuea" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="密码:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | <el-form-item label="排序:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="editingUser.parentId" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow('edit')"> |
| | | <el-button type="primary" @click="getTableRowa"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="adda = false">取消</el-button> |
| | |
| | | margin-left: 28%; |
| | | } |
| | | #awatch{ |
| | | height: 450px; |
| | | } |
| | | #main-body{ |
| | | margin-top: -20px; |
| | | margin-left: 300px; |
| | | } |
| | | #main-bodya{ |
| | | margin-top: -10px; |
| | | margin-left: 100px; |
| | | height: 460px; |
| | | /* margin-top: -60px; */ |
| | | } |
| | | </style> |
| | |
| | | <script lang="ts" setup> |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | import { ref } from 'vue' |
| | | |
| | | const router = useRouter() |
| | | const value1 = ref(true) |
| | | const add = ref(false) |
| | | const adda = ref(false) |
| | | |
| | | const changer = ref(false) |
| | | const editingUser = ref({}); // 用于存储当前编辑的用户数据 |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted } from "vue"; |
| | | // import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | // import LanguageMixin from './lang/LanguageMixin' |
| | | const selectedProjectNoa = ref(''); // 当前选中的角色 |
| | | // const options = ref<any[]>([]); // 下拉选项列表 |
| | | const name = ref(''); |
| | | |
| | | const tableData = [ |
| | | { |
| | | id: '1', |
| | | long: '1005', |
| | | wide: '183.6', |
| | | thick: '1991', |
| | | time: '2024/4/1', |
| | | type: '待识别', |
| | | typea: '1', |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | time: '2024/4/1', |
| | | thick: '191', |
| | | typea: '1', |
| | | type: '待识别' |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | time: '2024/4/1', |
| | | thick: '191', |
| | | typea: '1', |
| | | type: '待识别' |
| | | }, |
| | | ] |
| | | const open = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: '删除失败', |
| | | }) |
| | | }) |
| | | } |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | const dialogForm = () => { |
| | | ElMessageBox.confirm( |
| | | '是否重置密码?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | // this.boxa = true |
| | | // this.box = false |
| | | const tableData = ref([]) |
| | | const slot = ref('') |
| | | |
| | | const titleSelectJsona = ref({ |
| | | processType: [], |
| | | |
| | | }) |
| | | } |
| | | const dialogForma = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | } |
| | | |
| | | const options = [ |
| | | { |
| | | value: 'Option1', |
| | | label: 'admin', |
| | | }, |
| | | { |
| | | value: 'Option2', |
| | | label: 'ueser2', |
| | | }, |
| | | { |
| | | value: 'Option3', |
| | | label: 'ueser3', |
| | | }, |
| | | ] |
| | | const optionsa = [ |
| | | { |
| | | valuea: 'Option1', |
| | | labela: '正常', |
| | | }, |
| | | { |
| | | valuea: 'Option2', |
| | | labela: '禁用', |
| | | }, |
| | | ] |
| | | |
| | | const data= reactive({ |
| | | tableList:[]//table数据 |
| | | }) |
| | | |
| | | const beforeChange = () => { |
| | | return new Promise((resolve) => { |
| | | setTimeout(() => { |
| | | ElMessage.success("修改成功!"); |
| | | return resolve(true); |
| | | }, 1000); |
| | | // const handleInputChangea = async (value: string) => { |
| | | // if (value) { |
| | | // await fetchOptionsa(value); |
| | | // } else { |
| | | // options.value = []; // 清空选项列表 |
| | | // } |
| | | // }; |
| | | onMounted(() => { |
| | | // 在组件挂载后调用 fetchOptions('') 来加载初始数据(如果需要) |
| | | fetchOptionsa(''); |
| | | }); |
| | | // 角色下拉选 |
| | | const fetchOptionsa = async () => { |
| | | try { |
| | | // 发送请求到后端接口 |
| | | const response = await request.post('/loadGlass/sys/role/queryRole',{ |
| | | key: '' |
| | | }); |
| | | if (response.code == 200) { |
| | | tableData.value = response.data |
| | | // titleSelectJsona.value.processTypea = response.data.menuList; |
| | | console.log(response.data); |
| | | |
| | | } else { |
| | | ElMessage.warning(response.data); |
| | | } |
| | | } catch (error) { |
| | | console.error('Error fetching options:', error); |
| | | } |
| | | }; |
| | | // 添加 |
| | | const getTableRow = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/role/saveRole', { |
| | | name: name.value, |
| | | }); |
| | | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | add.value = false; |
| | | // tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | // 处理编辑按钮点击 |
| | | function handleEdit(row) { |
| | | editingUser.value = { ...row }; // 使用展开运算符复制当前行数据 |
| | | adda.value = true; // 显示对话框 |
| | | } |
| | | // 编辑 |
| | | const getTableRowa = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/role/updateRole', { |
| | | name: name.value, |
| | | |
| | | }); |
| | | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | editingUser.value = {}; |
| | | adda.value = false; |
| | | tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | // 删除 |
| | | const opena = async(row) => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否删除该用户?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/loadGlass/sys/role/delete", { |
| | | ids: row.id, |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | // //js层,实战版本,与后台接口交互 |
| | | // const gettableList = (id) = >{ |
| | | // xxx接口.({ |
| | | // id:id |
| | | // }).then((res)=>{ |
| | | // //将数据传给el-table绑定的:data=>data.tableList |
| | | // data.tableList = res.data |
| | | |
| | | // }) |
| | | // } |
| | | |
| | | // //最后将请求函数挂载到vue视图上 |
| | | // onMounted(() => { |
| | | // gettableList () |
| | | |
| | | // }) |
| | | // const delete = () => { |
| | | // ElMessageBox.confirm( |
| | | // '是否删除该条信息?', |
| | | // '提示', |
| | | // { |
| | | // confirmButtonText: '是', |
| | | // cancelButtonText: '取消', |
| | | // type: 'warning', |
| | | // } |
| | | // ) |
| | | // .then(() => { |
| | | |
| | | // }) |
| | | // } |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | |
| | | 'long': '5', |
| | | 'wide': '1005', |
| | | 'thick': '183.6', |
| | | 'time': '2024/4/1', |
| | | } |
| | | ] |
| | | }) |
| | | |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">添加用户</el-button> |
| | | <el-input |
| | | clearable |
| | | placeholder="请输入用户名" |
| | | size="mini" |
| | | style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;" |
| | | /> |
| | | <el-input |
| | | clearable |
| | | placeholder="请输入邮箱" |
| | | size="mini" |
| | | style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;" |
| | | /> |
| | | <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">查询</el-button > |
| | | <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">清空</el-button> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;"> |
| | | <el-table height="100%" ref="table" |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">添加角色</el-button> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> |
| | | <el-table height="240" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="id" align="center" label="用户名" min-width="80" /> |
| | | <el-table-column prop="long" align="center" label="邮箱" min-width="120" /> |
| | | <el-table-column prop="time" align="center" label="创建时间" min-width="120" /> |
| | | <el-table-column align="center" prop="changer" label="是否禁用" min-width="140" > |
| | | <template #default="scope"> |
| | | <el-switch v-model="scope.row.changer" :before-change="beforeChange" /> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="name" align="center" label="角色" min-width="180" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default> |
| | | <el-button size="mini" type="text" plain @click="dialogForm">重置密码</el-button> |
| | | <el-button size="mini" type="text" plain @click="adda = true">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="dialogForma">删除</el-button> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | |
| | | </div> |
| | | |
| | | <el-dialog v-model="add" top="23vh" width="37%" title="添加用户" > |
| | | <el-dialog v-model="add" top="23vh" width="37%" title="添加角色" > |
| | | <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="用户名:" :required="true" style="width: 25vw"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择角色" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="邮箱:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="是否禁用" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择是否禁用" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in optionsa" |
| | | :key="item.valuea" |
| | | :label="item.labela" |
| | | :value="item.valuea" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="密码:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="name" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow('edit')"> |
| | | <el-button type="primary" @click="getTableRow"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="add = false">取消</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="adda" top="23vh" width="37%" title="修改用户" > |
| | | <el-dialog v-model="adda" top="23vh" width="37%" title="修改角色" > |
| | | <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form :model="editingUser" ref="formRef" size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | | <el-row style="margin-top: -15px;margin-bottom: -2px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="用户名:" :required="true" style="width: 25vw"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择角色" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="邮箱:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="是否禁用" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择是否禁用" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in optionsa" |
| | | :key="item.valuea" |
| | | :label="item.labela" |
| | | :value="item.valuea" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="密码:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw"> |
| | | <el-input v-model="editingUser.name" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow('edit')"> |
| | | <el-button type="primary" @click="getTableRowa"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="adda = false">取消</el-button> |
| | |
| | | margin-left: 28%; |
| | | } |
| | | #awatch{ |
| | | height: 450px; |
| | | } |
| | | #main-body{ |
| | | margin-top: -20px; |
| | | margin-left: 300px; |
| | | } |
| | | #main-bodya{ |
| | | margin-top: -10px; |
| | | margin-left: 100px; |
| | | height: 460px; |
| | | /* margin-top: -60px; */ |
| | | } |
| | | </style> |
| | |
| | | <script lang="ts" setup> |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | import { ref } from 'vue' |
| | | |
| | | const router = useRouter() |
| | | const value1 = ref(true) |
| | | const add = ref(false) |
| | | const adda = ref(false) |
| | | |
| | | const changer = ref(false) |
| | | const editingUser = ref({}); // 用于存储当前编辑的用户数据 |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted } from "vue"; |
| | | // import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | // import LanguageMixin from './lang/LanguageMixin' |
| | | const selectedProjectNoa = ref(''); // 当前选中的角色 |
| | | // const options = ref<any[]>([]); // 下拉选项列表 |
| | | const userName = ref(''); |
| | | const password = ref(''); |
| | | |
| | | const tableData = [ |
| | | { |
| | | id: '1', |
| | | long: '1005', |
| | | wide: '183.6', |
| | | thick: '1991', |
| | | time: '2024/4/1', |
| | | type: '待识别', |
| | | typea: '1', |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | time: '2024/4/1', |
| | | thick: '191', |
| | | typea: '1', |
| | | type: '待识别' |
| | | }, |
| | | { |
| | | id: '2', |
| | | long: '105', |
| | | wide: '183', |
| | | time: '2024/4/1', |
| | | thick: '191', |
| | | typea: '1', |
| | | type: '待识别' |
| | | }, |
| | | ] |
| | | const open = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | }) |
| | | }) |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: '删除失败', |
| | | }) |
| | | }) |
| | | } |
| | | const getTableRow = (row,type) =>{ |
| | | switch (type) { |
| | | case 'edit' :{ |
| | | //alert('我接收到子组件传送的编辑信息') |
| | | router.push({path: '/main/returns/createReturns', query: { ReturnID: 'TH24010101' }}) |
| | | break |
| | | } |
| | | case 'delete':{ |
| | | alert('我接收到子组件传送的删除信息') |
| | | break |
| | | } |
| | | } |
| | | } |
| | | const dialogForm = () => { |
| | | ElMessageBox.confirm( |
| | | '是否重置密码?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | // this.boxa = true |
| | | // this.box = false |
| | | const tableData = ref([]) |
| | | const slot = ref('') |
| | | request.post("/loadGlass/sys/user/listByUserName",{ |
| | | key: '' |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | console.log(res.data); |
| | | tableData.value = res.data |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | |
| | | }) |
| | | } |
| | | const dialogForma = () => { |
| | | ElMessageBox.confirm( |
| | | '是否删除该条信息?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | } |
| | | |
| | | const options = [ |
| | | { |
| | | value: 'Option1', |
| | | label: 'admin', |
| | | }, |
| | | { |
| | | value: 'Option2', |
| | | label: 'ueser2', |
| | | }, |
| | | { |
| | | value: 'Option3', |
| | | label: 'ueser3', |
| | | }, |
| | | ] |
| | | const optionsa = [ |
| | | { |
| | | valuea: 'Option1', |
| | | labela: '正常', |
| | | }, |
| | | { |
| | | valuea: 'Option2', |
| | | labela: '禁用', |
| | | }, |
| | | ] |
| | | |
| | | const data= reactive({ |
| | | tableList:[]//table数据 |
| | | }) |
| | | |
| | | const beforeChange = () => { |
| | | return new Promise((resolve) => { |
| | | setTimeout(() => { |
| | | ElMessage.success("修改成功!"); |
| | | return resolve(true); |
| | | }, 1000); |
| | | }); |
| | | // 重置密码 |
| | | const open = async(row) => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否重置用户密码?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | var url="/loadGlass/sys/user/resetPassword?userId="+row.id; |
| | | console.log(url); |
| | | const response = await request.post(url, { |
| | | esdId: row.esdId |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | const titleSelectJsona = ref({ |
| | | processType: [], |
| | | |
| | | }) |
| | | // const handleInputChangea = async (value: string) => { |
| | | // if (value) { |
| | | // await fetchOptionsa(value); |
| | | // } else { |
| | | // options.value = []; // 清空选项列表 |
| | | // } |
| | | // }; |
| | | onMounted(() => { |
| | | // 在组件挂载后调用 fetchOptions('') 来加载初始数据(如果需要) |
| | | fetchOptionsa(''); |
| | | }); |
| | | // 角色下拉选 |
| | | const fetchOptionsa = async () => { |
| | | try { |
| | | // 发送请求到后端接口 |
| | | const response = await request.post('/loadGlass/sys/role/queryRole',{ |
| | | key: '' |
| | | }); |
| | | if (response.code == 200) { |
| | | titleSelectJsona.value.processTypea = response.data; |
| | | console.log(response.data); |
| | | |
| | | } else { |
| | | ElMessage.warning(response.data); |
| | | } |
| | | } catch (error) { |
| | | console.error('Error fetching options:', error); |
| | | } |
| | | }; |
| | | // 处理编辑按钮点击 |
| | | function handleEdit(row) { |
| | | editingUser.value = { ...row }; // 使用展开运算符复制当前行数据 |
| | | adda.value = true; // 显示对话框 |
| | | } |
| | | // 添加 |
| | | const getTableRow = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/user/saveUser', { |
| | | userName: userName.value, |
| | | password: password.value, |
| | | name: selectedProjectNoa.value, |
| | | }); |
| | | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | add.value = false; |
| | | // tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | // 编辑 |
| | | const getTableRowa = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/user/updateUser', { |
| | | userName: userName.value, |
| | | password: password.value, |
| | | name: selectedProjectNoa.value, |
| | | }); |
| | | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | ElMessage.success(response.message); |
| | | editingUser.value = {}; |
| | | adda.value = false; |
| | | tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | }; |
| | | // 删除 |
| | | const opena = async(row) => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否删除该用户?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/loadGlass/sys/user/deleteUser", { |
| | | ids: [row.id], |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | // //js层,实战版本,与后台接口交互 |
| | | // const gettableList = (id) = >{ |
| | | // xxx接口.({ |
| | | // id:id |
| | | // }).then((res)=>{ |
| | | // //将数据传给el-table绑定的:data=>data.tableList |
| | | // data.tableList = res.data |
| | | |
| | | // }) |
| | | // } |
| | | |
| | | // //最后将请求函数挂载到vue视图上 |
| | | // onMounted(() => { |
| | | // gettableList () |
| | | |
| | | // }) |
| | | // const delete = () => { |
| | | // ElMessageBox.confirm( |
| | | // '是否删除该条信息?', |
| | | // '提示', |
| | | // { |
| | | // confirmButtonText: '是', |
| | | // cancelButtonText: '取消', |
| | | // type: 'warning', |
| | | // } |
| | | // ) |
| | | // .then(() => { |
| | | |
| | | // }) |
| | | // } |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | |
| | | 'long': '5', |
| | | 'wide': '1005', |
| | | 'thick': '183.6', |
| | | 'time': '2024/4/1', |
| | | } |
| | | ] |
| | | }) |
| | | |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">添加用户</el-button> |
| | | <el-input |
| | | clearable |
| | | placeholder="请输入用户名" |
| | | size="mini" |
| | | style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;" |
| | | /> |
| | | <el-input |
| | | clearable |
| | | placeholder="请输入邮箱" |
| | | size="mini" |
| | | style="margin-right: 20px; width: 200px;margin-left: 10px;margin-top: 10px;" |
| | | /> |
| | | <el-button type="primary" size="mini" @click="searchSubmit" style="margin-top: 10px;">查询</el-button > |
| | | <el-button type="primary" size="mini" @click="empty" style="margin-top: 10px;">清空</el-button> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;"> |
| | | <el-table height="100%" ref="table" |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> |
| | | <el-table height="240" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="id" align="center" label="用户名" min-width="80" /> |
| | | <el-table-column prop="long" align="center" label="邮箱" min-width="120" /> |
| | | <el-table-column prop="time" align="center" label="创建时间" min-width="120" /> |
| | | <el-table-column align="center" prop="changer" label="是否禁用" min-width="140" > |
| | | <el-table-column prop="userName" align="center" label="用户名" min-width="180" /> |
| | | <el-table-column align="center" label="角色" min-width="80"> |
| | | <template #default="scope"> |
| | | <el-switch v-model="scope.row.changer" :before-change="beforeChange" /> |
| | | <el-tag v-for="role in scope.row.roleList"> |
| | | {{role.name}} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default> |
| | | <el-button size="mini" type="text" plain @click="dialogForm">重置密码</el-button> |
| | | <el-button size="mini" type="text" plain @click="adda = true">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="dialogForma">删除</el-button> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain @click="open(scope.row)">重置密码</el-button> |
| | | <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | |
| | | </div> |
| | | |
| | | <el-dialog v-model="add" top="23vh" width="37%" title="添加用户" > |
| | | <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="用户名:" :required="true" style="width: 25vw"> |
| | | <el-input autocomplete="off" /> |
| | | <el-input v-model="userName" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | v-model="selectedProjectNoa" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择角色" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="邮箱:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="是否禁用" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择是否禁用" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in optionsa" |
| | | :key="item.valuea" |
| | | :label="item.labela" |
| | | :value="item.valuea" |
| | | v-for="item in titleSelectJsona['processTypea']" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="密码:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | <el-input style="width: 340px;" |
| | | v-model="password" |
| | | autocomplete="off" |
| | | :prefix-icon="Lock" |
| | | show-password/> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow('edit')"> |
| | | <el-button type="primary" @click="getTableRow"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="add = false">取消</el-button> |
| | |
| | | </el-dialog> |
| | | <el-dialog v-model="adda" top="23vh" width="37%" title="修改用户" > |
| | | <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> |
| | | <el-form size="mini" label-width="150px"> |
| | | <el-form :model="editingUser" ref="formRef" size="mini" label-width="150px"> |
| | | <el-form label-width="100px" label-position="right"> |
| | | <el-row style="margin-top: -15px;margin-bottom: -2px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="用户名:" :required="true" style="width: 25vw"> |
| | | <el-input autocomplete="off" /> |
| | | <el-input v-model="editingUser.userName" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <!-- <el-table-column align="center" label="角色" min-width="80"> |
| | | <template #default="scope"> |
| | | <el-tag v-for="role in scope.row.roleList"> |
| | | {{role.name}} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | v-model="selectedProjectNoa" |
| | | filterable |
| | | clearable |
| | | placeholder="请选择角色" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in options" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="邮箱:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row style="margin-top: 10px;"> |
| | | <el-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="是否禁用" :required="true" style="width: 25vw;"> |
| | | <el-select |
| | | v-model="value" |
| | | clearable |
| | | placeholder="请选择是否禁用" |
| | | style="width: 330px" |
| | | > |
| | | <el-option |
| | | v-for="item in optionsa" |
| | | :key="item.valuea" |
| | | :label="item.labela" |
| | | :value="item.valuea" |
| | | v-for="item in titleSelectJsona['processTypea']" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.name" |
| | | /> |
| | | </el-select> |
| | | </el-form-item></div></div> |
| | |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="密码:" :required="true" style="width: 25vw;"> |
| | | <el-input autocomplete="off" /> |
| | | <el-input style="width: 340px;" |
| | | v-model="editingUser.password" |
| | | autocomplete="off" |
| | | :prefix-icon="Lock" |
| | | show-password/> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </div> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow('edit')"> |
| | | <el-button type="primary" @click="getTableRowa"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="adda = false">取消</el-button> |
| | |
| | | margin-left: 28%; |
| | | } |
| | | #awatch{ |
| | | height: 450px; |
| | | } |
| | | #main-body{ |
| | | margin-top: -20px; |
| | | margin-left: 300px; |
| | | } |
| | | #main-bodya{ |
| | | margin-top: -10px; |
| | | margin-left: 100px; |
| | | height: 460px; |
| | | /* margin-top: -60px; */ |
| | | } |
| | | </style> |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB11.0", |
| | | "plcAddressLenght":"80", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "A06_request_word", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "A05_scanning_ID", |
| | | "addressIndex":"2", |
| | | "addressLenght":"30", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "Current_slot", |
| | | "addressIndex":"36", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MES_confirmation_word", |
| | | "addressIndex":"38", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "A08_glass_status", |
| | | "addressIndex":"68", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "A10_glass_status", |
| | | "addressIndex":"70", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "A09_prohibit_film_production", |
| | | "addressIndex":"72", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "A10_prohibit_film_production", |
| | | "addressIndex":"74", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB.0", |
| | | "plcAddressLenght":"72", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "D01Request", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "D01ID1", |
| | | "addressIndex":"2", |
| | | "addressLenght":"6", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D04Request", |
| | | "addressIndex":"8", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D04ID1", |
| | | "addressIndex":"10", |
| | | "addressLenght":"6", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D02Go", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "D05Go", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "DeviceStatus", |
| | | "addressIndex":"70", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin":"DB1.2000", |
| | | "plcAddressLenght":"100", |
| | | "dataType":"word", |
| | | "parameteInfor":[ |
| | | { |
| | | "codeId": "loadRequest", |
| | | "addressIndex":"0", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"m/min" |
| | | }, |
| | | { |
| | | "codeId": "PlcStatus", |
| | | "addressIndex":"10", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesToPlc", |
| | | "addressIndex":"20", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "InkageStatus", |
| | | "addressIndex":"22", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "WorkId", |
| | | "addressIndex":"24", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "GlassWidth", |
| | | "addressIndex":"26", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "GlassHeight", |
| | | "addressIndex":"28", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | , |
| | | { |
| | | "codeId": "MesToPlcStatus", |
| | | "addressIndex":"40", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesToPlcStatusId", |
| | | "addressIndex":"42", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | }, |
| | | { |
| | | "codeId": "MesTaskStatus", |
| | | "addressIndex":"56", |
| | | "addressLenght":"2", |
| | | "ratio":"1", |
| | | "unit":"" |
| | | } |
| | | ] |
| | | } |
New file |
| | |
| | | { |
| | | "plcAddressBegin": "DB100.0", |
| | | "plcAddressLenght": "142", |
| | | "dataType": "word", |
| | | "parameteInfor": [ |
| | | { |
| | | "codeId": "RequestWord", |
| | | "addressIndex": "0", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G04ID", |
| | | "addressIndex": "2", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G06RobotTaskRequestWord", |
| | | "addressIndex": "4", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G06ID", |
| | | "addressIndex": "6", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G11RobotTaskRequestWord", |
| | | "addressIndex": "8", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G011ID", |
| | | "addressIndex": "10", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "12", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "14", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "16", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "18", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "MESSendingWord", |
| | | "addressIndex": "20", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InputGrid", |
| | | "addressIndex": "22", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "OutputGrid", |
| | | "addressIndex": "24", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "OutputID", |
| | | "addressIndex": "26", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "FrontOrRearLowerSlice", |
| | | "addressIndex": "28", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "30", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G06RobotTaskReply", |
| | | "addressIndex": "32", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G06Rack", |
| | | "addressIndex": "34", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G11RobotTaskReply", |
| | | "addressIndex": "36", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G11Rack", |
| | | "addressIndex": "38", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "40", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "42", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "44", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "46", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "48", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "50", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "52", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "54", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "MESTaskState", |
| | | "addressIndex": "56", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "58", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "AlarmState", |
| | | "addressIndex": "60", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "Alarm1", |
| | | "addressIndex": "62", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "Alarm2", |
| | | "addressIndex": "64", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "Alarm3", |
| | | "addressIndex": "66", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "Alarm4", |
| | | "addressIndex": "68", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "neirong", |
| | | "addressIndex": "70", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "device", |
| | | "addressIndex": "72", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "74", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "76", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut1", |
| | | "addressIndex": "78", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut2", |
| | | "addressIndex": "80", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut3", |
| | | "addressIndex": "82", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut4", |
| | | "addressIndex": "84", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut5", |
| | | "addressIndex": "86", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut6", |
| | | "addressIndex": "88", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "InOut7", |
| | | "addressIndex": "90", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "92", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "94", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "96", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "98", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "spare", |
| | | "addressIndex": "100", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G04ActionState", |
| | | "addressIndex": "102", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G05ActionState", |
| | | "addressIndex": "104", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G06ActionState", |
| | | "addressIndex": "106", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G07ActionState", |
| | | "addressIndex": "108", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G08ActionState", |
| | | "addressIndex": "110", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G09ActionState", |
| | | "addressIndex": "112", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G10ActionState", |
| | | "addressIndex": "114", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G11ActionState", |
| | | "addressIndex": "116", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G12ActionState", |
| | | "addressIndex": "118", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G13ActionState", |
| | | "addressIndex": "120", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G04IDS", |
| | | "addressIndex": "122", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G05IDS", |
| | | "addressIndex": "124", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G06IDS", |
| | | "addressIndex": "126", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G07IDS", |
| | | "addressIndex": "128", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G08IDS", |
| | | "addressIndex": "130", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G09IDS", |
| | | "addressIndex": "132", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G10IDS", |
| | | "addressIndex": "134", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G11IDS", |
| | | "addressIndex": "136", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G12IDS", |
| | | "addressIndex": "138", |
| | | "addressLenght": "2" |
| | | }, |
| | | { |
| | | "codeId": "G13ID", |
| | | "addressIndex": "140", |
| | | "addressLenght": "2" |
| | | } |
| | | ] |
| | | } |
| | |
| | | <groupId>com.github.yulichang</groupId> |
| | | <artifactId>mybatis-plus-join-boot-starter</artifactId> |
| | | <version>1.4.12</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-websocket</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-thymeleaf</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/24 10:33 |
| | |
| | | public static final Integer GLASS_CACHE_TYPE_IN = 1; |
| | | public static final Integer GLASS_CACHE_TYPE_OUT = 2; |
| | | public static final Integer GLASS_CACHE_TYPE_THROUGH = 3; |
| | | public static final List<Integer> GLASS_CACHE_TYPE_OUT_ALL = Arrays.asList(2, 3); |
| | | |
| | | /** |
| | | * 磨边任务玻璃状态 |
New file |
| | |
| | | package com.mes.common.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.socket.server.standard.ServerEndpointExporter; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Configuration |
| | | public class WebSocketConfig { |
| | | /** |
| | | * bean注册:会自动扫描带有@ServerEndpoint注解声明的Websocket Endpoint(端点),注册成为Websocket bean。 |
| | | * 要注意,如果项目使用外置的servlet容器,而不是直接使用springboot内置容器的话,就不要注入ServerEndpointExporter,因为它将由容器自己提供和管理。 |
| | | */ |
| | | @Bean |
| | | public ServerEndpointExporter serverEndpointExporter() { |
| | | return new ServerEndpointExporter(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.device; |
| | | |
| | | import com.github.xingshuangs.iot.utils.IntegerUtil; |
| | | import com.github.xingshuangs.iot.utils.ShortUtil; |
| | | |
| | | import java.lang.reflect.Array; |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | |
| | | Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]); |
| | | } |
| | | if (plcParameterInfo.getAddressLength() == 2) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2short(valueList))); |
| | | plcParameterInfo.setValue(String.valueOf(ShortUtil.toUInt16(valueList))); |
| | | } else if (plcParameterInfo.getAddressLength() == 4) { |
| | | plcParameterInfo.setValue(String.valueOf(byte2int(valueList))); |
| | | plcParameterInfo.setValue(String.valueOf(IntegerUtil.toUInt32(valueList))); |
| | | } |
| | | else if (plcParameterInfo.getAddressLength() >10) { |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } else { |
| | | String valuestr = new String(valueList); |
| | | plcParameterInfo.setValue(valuestr); |
| | | plcParameterInfo.setValue((byteToHexString(valueList))); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | }*/ |
| | | } |
| | | /** |
| | | * 把写入值转化为byte[] |
| | | * @param param 参数实例 |
| | | * @param data 写入值的字符类型 |
| | | */ |
| | | public byte[] setValueToBytes(PlcParameterInfo param, String data) { |
| | | if (param.getAddressLength() == 2) { |
| | | return ShortUtil.toByteArray(Integer.parseInt(data)); |
| | | |
| | | } else if (param.getAddressLength() == 4) { |
| | | |
| | | return IntegerUtil.toByteArray(Long.parseLong(data)); |
| | | } |
| | | else if (param.getAddressLength() >10) { |
| | | return data.getBytes(); |
| | | } else { |
| | | return data.getBytes(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * short类型转byte[] |
| | |
| | | public static byte[] short2byte(short s) { |
| | | byte[] b = new byte[2]; |
| | | for (int i = 0; i < 2; i++) { |
| | | int offset = 16 - (i + 1) * 8; //因为byte占4个字节,所以要计算偏移量 |
| | | int offset = 16 - (i + 1) * 8; //计算偏移量 |
| | | b[i] = (byte) ((s >> offset) & 0xff); //把16位分为2个8位进行分别存储 |
| | | } |
| | | return b; |
| | |
| | | * |
| | | * @param b byte[]类型值 |
| | | */ |
| | | public static short byte2int(byte[] b) { |
| | | short l = 0; |
| | | public static int byte2int(byte[] b) { |
| | | int l = 0; |
| | | for (int i = 0; i < 4; i++) { |
| | | l <<= 8; //<<=和我们的 +=是一样的,意思就是 l = l << 8 |
| | | l |= (b[3-i] & 0xff); //和上面也是一样的 l = l | (b[i]&0xff) |
| | | } |
| | | return l; |
| | | } |
| | | public static byte[] int2byte(int s){ |
| | | byte[] b = new byte[2]; |
| | | for(int i = 0; i < 4; i++){ |
| | | int offset = 16 - (i+1)*8; //因为byte占4个字节,所以要计算偏移量 |
| | | b[i] = (byte)((s >> offset)&0xff); //把32位分为4个8位进行分别存储 |
| | | } |
| | | return b; |
| | | } |
| | | public static String byteToHexString(byte[] bytes) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8).trim(); |
| | | return str; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private String filmsid; |
| | | |
| | | /** |
| | | * 层数 |
| | | */ |
| | | private int layer; |
| | | |
| | | /** |
| | | * 总层数 |
| | | */ |
| | | private int totalLayer; |
| | | |
| | | /** |
| | | * 磨前宽 |
| | | */ |
| | | private Double edgWidth; |
| | |
| | | private String glassType; |
| | | |
| | | /** |
| | | * 层数 |
| | | */ |
| | | private int layer; |
| | | |
| | | /** |
| | | * 总层数 |
| | | */ |
| | | private int totalLayer; |
| | | |
| | | /** |
| | | * 小片宽(加磨量) |
| | | */ |
| | | private Double pWidth; |
| | |
| | | package com.mes.glassinfo.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.entity.OptimizeGlassinfo; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | List<OptimizeGlassinfo> optimizeGlassinfos=null; |
| | | if (engineeringId != null) { |
| | | optimizeGlassinfos = optimizeProjectMapper.selectJoinList(OptimizeGlassinfo.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id") |
| | | .select("b.process_id,t.type,b.width,b.height,t.glass_thickness,t.glass_type,b.p_width,b.p_height,b.layer, b.total_layer, b.stock_id,b.heat_layout_id,b.heat_layout_sort,b.x_axis,b.y_axis,b.project_no,b.glass_id") |
| | | .leftJoin("optimize_detail b on t.project_no=b.project_no") |
| | | .eq("t.state",100) |
| | | //.eq("t.state",100) |
| | | .eq("t.project_no", engineeringId)); |
| | | } |
| | | |
| | |
| | | glassInfo.setWidth(map.getWidth()); |
| | | glassInfo.setHeight(map.getHeight()); |
| | | glassInfo.setEdgWidth(map.getPWidth()); |
| | | glassInfo.setLayer(map.getLayer()); |
| | | glassInfo.setTotalLayer(map.getTotalLayer()); |
| | | glassInfo.setEdgHeight(map.getPHeight()); |
| | | glassInfo.setThickness(map.getGlassThickness()); |
| | | glassInfo.setPatternSequence(map.getStockId());// |
| | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * 将工程信息更新状态为已领取 |
| | | */ |
| | | void changeTask(String engineeringId, int i); |
| | | /** |
| | | * 完成工程任务改为300 |
| | | * |
| | | * @return |
| | | */ |
| | | boolean overTask(UpPattenUsage sequence, int state); |
| | | } |
| | |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Slf4j |
| | | public class OptimizeProjectServiceImpl extends MPJBaseServiceImpl<OptimizeProjectMapper, OptimizeProject> implements OptimizeProjectService { |
| | | |
| | | @Resource |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | @Override |
| | | public List<OptimizeProject> listByState(OptimizeRequest optimizeRequest) { |
| | | log.info("将参数传入到查询类里,工程号做非空判断模糊查询"); |
| | | //将参数传入到查询类里,工程号做非空判断模糊查询 |
| | | LambdaQueryWrapper<OptimizeProject> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(OptimizeProject::getState,optimizeRequest.getState()) |
| | | .or(qw -> qw.eq(OptimizeProject::getState, 200)) |
| | | .like(StringUtils.isNotBlank(optimizeRequest.getProjectNo()),OptimizeProject::getProjectNo,optimizeRequest.getProjectNo()) |
| | | //.groupBy(OptimizeProject::getProjectNo) |
| | | ; |
| | | log.info("返回工程信息"); |
| | | //返回工程信息 |
| | | return this.list(wrapper); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean overTask(UpPattenUsage sequence, int state) { |
| | | if(sequence.getState()==100){ |
| | | UpdateWrapper<OptimizeProject> wrapper=new UpdateWrapper<>(); |
| | | wrapper.eq("project_no",sequence.getEngineeringId()) |
| | | .set("state",state); |
| | | boolean updateSuccess = this.update(wrapper); |
| | | log.info("工程完成更新状态{}",updateSuccess); |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | | public void CloseS7client() { |
| | | if (s7PLC == null) { |
| | | public void closeS7client() { |
| | | if (s7PLC != null) { |
| | | s7PLC.close(); |
| | | } |
| | | s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * 重启西门子s7通讯连接 |
| | | */ |
| | | public boolean reStartS7client() { |
| | | if (s7PLC != null) { |
| | | try { |
| | | s7PLC.hotRestart(); |
| | | return true; |
| | | } catch (Exception ex) { |
| | | return false; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * s7通讯连接状态 |
| | | */ |
| | | public boolean CheckConnected() { |
| | | public boolean checkConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void WriteWord(String address, short data) { |
| | | public boolean writeWord(String address, int data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | s7PLC.writeInt16(address, data); |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeUInt16(address, data); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(String address, List<Short> datas) { |
| | | public boolean writeWord(String address, List<Integer> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 16); |
| | | List<String> addresslist = getAddressList(address, datas.size(), 16); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addInt16(addresslist.get(i), datas.get(i)); |
| | | addressWrite.addUInt16(addresslist.get(i), datas.get(i)); |
| | | } |
| | | do { |
| | | try { |
| | | s7PLC.writeMultiData(addressWrite); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param data Bit的值 |
| | | */ |
| | | public void WriteBit(String address, Boolean data) { |
| | | public boolean writeBit(String address, Boolean data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeBoolean(address, data); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas bit的值 |
| | | */ |
| | | public void WriteBit(List<String> address, List<Boolean> datas) { |
| | | public boolean writeBit(List<String> address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | addressWrite.addBoolean(address.get(i), datas.get(i)); |
| | | } |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeMultiData(addressWrite); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteBit(String address, List<Boolean> datas) { |
| | | public boolean writeBit(String address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 1); |
| | | List<String> addresslist = getAddressList(address, datas.size(), 1); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addBoolean(addresslist.get(i), datas.get(i)); |
| | | } |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeMultiData(addressWrite); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | public boolean writeByte(String address, byte[] datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeByte(address, datas); |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(List<String> address) { |
| | | public List<Integer> readWord(List<String> address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> result = null; |
| | | try { |
| | | return s7PLC.readInt16(address); |
| | | result = s7PLC.readUInt16(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | |
| | | } finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | | |
| | | // 可以解析出地址中的数字部分,并转换为整数 |
| | | return 0; |
| | | } |
| | | |
| | | private String getAddressFromIndex(int index) { |
| | | |
| | | // 整数转换为地址格式的字符串 |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | |
| | | * @param count 连续读多少个word |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(String address, int count) { |
| | | public List<Integer> readWord(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | List<Integer> result = null; |
| | | List<String> addresslist = getAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | | result = s7PLC.readUInt16(addresslist); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | | } finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | public byte[] readByte(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | |
| | | byte[] bytes = null; |
| | | try { |
| | | return s7PLC.readByte(address, count); |
| | | bytes = s7PLC.readByte(address, count); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } finally { |
| | | return bytes; |
| | | } |
| | | |
| | | } |
| | |
| | | * @param addresslist 地址集 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(List<String> addresslist) { |
| | | public List<Boolean> readBits(List<String> addresslist) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | return s7PLC.readBoolean(addresslist); |
| | | List<Boolean> values = new ArrayList<>(); |
| | | try { |
| | | values = s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | s7PLC.hotRestart(); |
| | | } finally { |
| | | return values; |
| | | } |
| | | } |
| | | |
| | | //读取不连续地址bit |
| | | /* //读取不连续地址bit |
| | | public List<Boolean> readBits(List<String> addressList) { |
| | | if (s7PLC == null || addressList.isEmpty()) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | }*/ |
| | | |
| | | |
| | | //读取StringList |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | //读取字符串 |
| | | public String readString(String address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | String result = null; |
| | | try { |
| | | return s7PLC.readString(address); |
| | | result = s7PLC.readString(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | //不连续地址写入Word |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | String addr = address.get(i); |
| | | short data = datas.get(i); |
| | | |
| | | if (addr.contains("-")) { |
| | | outmesid(String.valueOf(data), addr); // 单独处理带破折号的地址 |
| | | } else { |
| | | s7PLC.writeInt16(addr, data); // 将数据写入单个地址 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //字符串写入 |
| | | public void outmesid(String data, String addr) { |
| | | // System.out.println("outmesid: " + data); |
| | | List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | | addr = parts[0]; // 只保留 "-" 前面的部分 |
| | | } |
| | | for (char iditem : data.toCharArray()) { |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | WriteByte(addr, bytes); |
| | | } |
| | | |
| | | //读取不连续word |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | try { |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | } |
| | | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | //读取单个word |
| | | public Short readWord(String address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | // 单个地址 |
| | | return s7PLC.readInt16(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | //读取时间 |
| | | public Long readtime(String address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | Long result = null; |
| | | try { |
| | | return s7PLC.readTime(address); |
| | | result = s7PLC.readTime(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | public void writetime(String address, long datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | |
| | | public boolean writetime(String address, long datas) { |
| | | if (s7PLC == null) { |
| | | return false; |
| | | } |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | } |
| | | |
| | | |
| | |
| | | * @param count 长度 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | public List<Boolean> readBits(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Boolean> values = new ArrayList<>(); |
| | | List<String> addresslist = getAddressList(address, count, 1); |
| | | try { |
| | | values = s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | } finally { |
| | | return values; |
| | | } |
| | | } |
| | | |
| | | ; |
| | | |
| | | |
| | | private List<String> GetAddressList(String address, int count, int addedbit) { |
| | | private List<String> getAddressList(String address, int count, int addedbit) { |
| | | List<String> addresslist = new ArrayList<String>(); |
| | | |
| | | String[] stringdatas = address.trim().split("\\."); |
File was renamed from hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/common/WebSocketServer.java |
| | |
| | | package com.mes.common; |
| | | package com.mes.tools; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | |
| | | |
| | | public static ConfigurableApplicationContext applicationContext; |
| | | |
| | | // 解决无法注入mapper问题 //使用方法 |
| | | // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class); |
| | | public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) { |
| | | WebSocketServer.applicationContext = configurableApplicationContext; |
| | | } |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class); |
| | | private List<String> messages; |
| | | /** |
| | |
| | | */ |
| | | public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>(); |
| | | |
| | | String username; |
| | | Session session; |
| | | public String username; |
| | | public Session session; |
| | | |
| | | public WebSocketServer() { |
| | | this.messages = new ArrayList<>(); |
| | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.set("message", text); |
| | | this.messages.add(text); |
| | | this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject) |
| | | |
| | | } |
| | | |
| | | @OnError |
| | |
| | | <artifactId>sqljdbc4</artifactId> |
| | | <version>4.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.samba.jcifs</groupId> |
| | | <artifactId>jcifs</artifactId> |
| | | <version>1.2.19</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.yulichang</groupId>--> |
| | | <!-- <artifactId>mybatis-plus-join-boot-starter</artifactId>--> |
| | |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private String ip = "192.168.10.11"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues = plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | if (getplcvlues != null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.common; |
| | | |
| | | import jcifs.smb.NtlmPasswordAuthentication; |
| | | import jcifs.smb.SmbFile; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class SmbTool { |
| | | public static String USER_DOMAIN=null;//共享计算机ip "192.168.3.102"; |
| | | public static String USER_ACCOUNT=null;//登录共享文件夹 用户名 "aaa",如果是共享是无密码模式 此处值设置为 null; |
| | | public static String USER_PWS=null;//登录共享文件夹 密码"guoyujie",如果是共享是无密码模式 此处值设置为 null; |
| | | |
| | | /** |
| | | * test 测试示例 |
| | | */ |
| | | private void test() |
| | | { |
| | | int index= SmbTool.getDescriptionIndex("log","P20240522");//输入切割机共享文件夹名字、工程号,返回当前工程正在切割的版图号 |
| | | System.out.print(index); |
| | | } |
| | | /** |
| | | * smbGetall 返回指定目录下的文件名字 |
| | | * @param GoalUrl 远端目录("smb://192.168.2.100//ceshi//") |
| | | */ |
| | | public static String[] smbGetallFilenames(String GoalUrl) { |
| | | NtlmPasswordAuthentication auth=new NtlmPasswordAuthentication(USER_DOMAIN,USER_ACCOUNT,USER_PWS); |
| | | List<String> filenames=new ArrayList<>(); |
| | | try { |
| | | SmbFile remoteFile = new SmbFile(GoalUrl,auth); |
| | | if (remoteFile == null) { |
| | | return filenames.toArray(new String[]{}); |
| | | } |
| | | if (remoteFile.exists()) |
| | | { |
| | | SmbFile[] listFiles = remoteFile.listFiles(); |
| | | for(int i = 0; i < listFiles.length; i++) { |
| | | filenames.add(listFiles[i].getName()); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return filenames.toArray(new String[]{}); |
| | | } |
| | | /** |
| | | * getDescriptionIndex 根据工程号,返回当前正在切割的版图号 |
| | | * @param folderName 共享文件夹名字 |
| | | * @param project_no 工程号 |
| | | */ |
| | | public static int getDescriptionIndex(String folderName,String project_no) |
| | | { |
| | | SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMdd"); |
| | | Date date = new Date(System.currentTimeMillis()); |
| | | System.out.println(formatter.format(date)); |
| | | String[] getfilenames= smbGetallFilenames("smb://"+USER_DOMAIN+"/"+folderName+"/"+formatter.format(date)+"/"); |
| | | for (int i = 0; i < getfilenames.length; i++) { |
| | | String[] splitvalues= getfilenames[i].split("_"); |
| | | if (splitvalues.length>=3&&splitvalues[1].trim().equals(project_no)) |
| | | { |
| | | String[] indexstr= splitvalues[2].trim().split("\\."); |
| | | if (indexstr.length>1) { |
| | | return Integer.parseInt(indexstr[0]); |
| | | } |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 设备id |
| | | */ |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 查询笼内离指定格子最近空格 |
| | | * |
| | | * @return |
| | | */ |
| | | EdgStorageCage selectNearestEmpty(int currentSlot); |
| | | EdgStorageCage selectNearestEmpty(int currentSlot, boolean flag); |
| | | |
| | | /** |
| | | * 查询笼内空格 |
| | |
| | | UpPattenUsageMapper upPattenUsageMapper; |
| | | |
| | | @Override |
| | | public EdgStorageCage selectNearestEmpty(int currentSlot) { |
| | | public EdgStorageCage selectNearestEmpty(int currentSlot, boolean flag) { |
| | | List<EdgStorageCage> emptyList = this.selectJoinList(EdgStorageCage.class, new MPJLambdaWrapper<EdgStorageCage>() |
| | | .selectAll(EdgStorageCage.class) |
| | | .leftJoin(EdgStorageCageDetails.class, on -> on |
| | |
| | | .isNull(EdgStorageCageDetails::getSlot) |
| | | .last("order by abs(t.slot - " + currentSlot + ") asc limit 2") |
| | | ); |
| | | if (CollectionUtil.isEmpty(emptyList) || emptyList.size() < 2) { |
| | | if (flag && CollectionUtil.isNotEmpty(emptyList)) { |
| | | return emptyList.get(0); |
| | | } |
| | | if (CollectionUtil.isEmpty(emptyList) || emptyList.size() == 1) { |
| | | return null; |
| | | } |
| | | return emptyList.get(0); |
| | |
| | | .select(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight, EdgStorageCageDetails::getId) |
| | | .leftJoin(EdgStorageCageDetails.class, on -> on |
| | | .eq(EdgStorageCageDetails::getDeviceId, EdgStorageCage::getDeviceId) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(EdgStorageCageDetails::getSlot, EdgStorageCage::getSlot)) |
| | | ); |
| | | // return baseMapper.selectJoinMaps(new MPJQueryWrapper<EdgStorageCage>().selectAll(EdgStorageCage.class) |
| | | // .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") |
| | | // .leftJoin("edg_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") |
| | | // ); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.WebSocketServer; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | @Value("${mes.sequence.order}") |
| | | private boolean sequenceOrder; |
| | | |
| | | @Scheduled(fixedDelay = 30000000) |
| | | @Value("${mes.firstLength}") |
| | | private String firstLength; |
| | | |
| | | @Value("${mes.secondLength}") |
| | | private String secondLength; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue(); |
| | |
| | | return; |
| | | } |
| | | log.info("2、获取到的请求字为0,将确认字改为0"); |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 0); |
| | | S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 0); |
| | | return; |
| | | } |
| | | if (!"0".equals(confirmationWrodValue)) { |
| | |
| | | } else if ("3".equals(taskRequestTypeValue)) { |
| | | log.info("2、进片和出片都空闲,执行出片任务"); |
| | | //加笼子里面是否有玻璃,有先出,无玻璃先进 |
| | | if (("1".equals(out08Glassstate) || "1".equals(out10Glassstate))) { |
| | | boolean outFlase = outTo(Integer.parseInt(out08Glassstate), |
| | | Integer.parseInt(out10Glassstate), confirmationWrodAddress, glassIdeValue, Integer.parseInt(currentSlot)); |
| | | log.info("出片任务是否完成:{},失败且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue); |
| | | if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) { |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } |
| | | } else { |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } |
| | | } |
| | |
| | | * @param confirmationWrodAddress |
| | | * @param currentSlot |
| | | */ |
| | | private void inTo(String glassId, String confirmationWrodAddress, String currentSlot) { |
| | | public void inTo(String glassId, String confirmationWrodAddress, String currentSlot) { |
| | | log.info("1、按照玻璃id:{}获取玻璃小片信息,当前格子为:{}", glassId, currentSlot); |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); |
| | | if (glassInfo == null) { |
| | | log.info("2、此玻璃编号不存在"); |
| | | return; |
| | | } |
| | | log.info("2、获取到的玻璃信息为{}", glassInfo); |
| | | //添加进片任务 查找空格 |
| | | EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot)); |
| | | EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(Integer.parseInt(currentSlot), Boolean.FALSE); |
| | | Assert.isTrue(null != nearestEmpty, "格子已满"); |
| | | log.info("3、查询卧式理片笼里面的空格:{}", nearestEmpty); |
| | | log.info("2、查询卧式理片笼里面的空格:{}", nearestEmpty); |
| | | |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | //查询玻璃并进行交换 |
| | | GlassInfo glassInfo = queryAndChangeGlass(glassId); |
| | | log.info("3、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | EdgStorageCageDetails details = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(Const.GLASS_STATE_IN); |
| | | details.setSlot(nearestEmpty.getSlot()); |
| | | details.setDeviceId(nearestEmpty.getDeviceId()); |
| | | edgStorageCageDetailsService.save(details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | log.info("4、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | //添加进片任务 |
| | | boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | log.info("6、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | log.info("5、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | log.info("7、发送确认字完成"); |
| | | S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1); |
| | | log.info("6、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 查询玻璃并进行交换 |
| | | * |
| | | * @param glassId |
| | | * @return |
| | | */ |
| | | public GlassInfo queryAndChangeGlass(String glassId) { |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId) |
| | | .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); |
| | | Assert.isFalse(null == glassInfo, "玻璃信息不存在"); |
| | | //按照玻璃尺寸 |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getWidth, glassInfo.getWidth()) |
| | | .eq(GlassInfo::getHeight, glassInfo.getHeight()) |
| | | .eq(GlassInfo::getThickness, glassInfo.getThickness()) |
| | | .eq(GlassInfo::getFilmsid, glassInfo.getFilmsid()) |
| | | .eq(GlassInfo::getTotalLayer, glassInfo.getTotalLayer()) |
| | | .eq(GlassInfo::getLayer, glassInfo.getLayer()) |
| | | .eq(GlassInfo::getEngineerId, glassInfo.getEngineerId()) |
| | | .notInSql(GlassInfo::getGlassId, "select distinct glass_id from edg_storage_cage_details " + |
| | | "where engineer_id = '" + glassInfo.getEngineerId() + "' and width = " + glassInfo.getWidth() + " and height = " + glassInfo.getHeight()) |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence) |
| | | .last("Limit 1"); |
| | | GlassInfo swapGlassInfo = glassInfoService.getOne(queryWrapper); |
| | | if (swapGlassInfo != null && !glassInfo.getGlassId().equals(swapGlassInfo.getGlassId())) { |
| | | String swapGlassId = swapGlassInfo.getGlassId(); |
| | | log.info("将玻璃{}和玻璃{},信息互换,进玻璃 {}", glassInfo, swapGlassInfo, swapGlassInfo); |
| | | swapGlassInfo.setGlassId(glassId); |
| | | glassInfo.setGlassId(swapGlassId); |
| | | glassInfoService.updateById(swapGlassInfo); |
| | | glassInfoService.updateById(glassInfo); |
| | | return swapGlassInfo; |
| | | } |
| | | return glassInfo; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param glassId |
| | | * @param currentSlot |
| | | */ |
| | | private boolean outTo(int out08Glassstate, int out10Glassstate, String confirmationWrodAddress, String glassId, int currentSlot) { |
| | | public boolean outTo(int out08Glassstate, int out10Glassstate, String confirmationWrodAddress, String glassId, int currentSlot) { |
| | | //逻辑步骤: |
| | | // 0、A09、A10是否空闲,是否可以执行出片任务 |
| | | // 1、获取钢化版图是否超过阈值 |
| | |
| | | // 1.2.3、按照出片信息去详情表查询格子在笼子里面剩余相同尺寸的玻璃数据且以版图id、版序升序排序 取第一块玻璃出片 |
| | | // 2、如果没有历史出片任务 |
| | | // 2.1、出当前版图id最小版序最小的玻璃(问题:两条线都没有历史任务,出片时两条线的玻璃尺寸相同,是否找尺寸不同的) |
| | | Assert.isFalse(out08Glassstate == 0 && out10Glassstate == 0, "A09、A10都有玻璃,无法出片"); |
| | | if (out08Glassstate == 2 && out10Glassstate == 2) { |
| | | log.info("A09、A10为{},{}非自动状态,无法出片"); |
| | | return Boolean.FALSE; |
| | | } |
| | | log.info("0、出片任务出的状态:A09:【{}】;A10:【{}】)", out08Glassstate, out10Glassstate); |
| | | //定义出片玻璃信息 |
| | | int endcell = 0; |
| | |
| | | log.info("笼子内和待进片没有玻璃"); |
| | | return Boolean.FALSE; |
| | | } |
| | | EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); |
| | | EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); |
| | | EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL); |
| | | EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL); |
| | | endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out10Glassstate); |
| | | } else { |
| | | //判断两条线是否都空闲 |
| | | endcell = out08Glassstate == 1 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | if (out08Glassstate == 1 && out10Glassstate == 1) { |
| | | EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); |
| | | EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); |
| | | endcell = out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | |
| | | if ((out08Glassstate == 0 && out10Glassstate == 0) || (out08Glassstate == 1 && out10Glassstate == 1)) { |
| | | EdgStorageCageDetails a09EdgGlass = queryGlassByTaskCache(Const.A09_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL); |
| | | EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT_ALL); |
| | | if (a09EdgGlass == null && a10EdgGlass == null) { |
| | | MPJLambdaWrapper<EdgStorageCageDetails> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .selectCount(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getCount) |
| | | .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .last("order by count(t.glass_id) desc limit 2"); |
| | | MPJQueryWrapper<EdgStorageCageDetails> wrapper = new MPJQueryWrapper<>(); |
| | | wrapper.select("count(t.glass_id), t.width, t.height") |
| | | .eq("t.state", Const.GLASS_STATE_IN) |
| | | .groupBy("t.width, t.height"); |
| | | if (endcell == Const.A10_OUT_TARGET_POSITION) { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getGlassId, glassId)); |
| | | MPJQueryWrapper<GlassInfo> queryWrapper = new MPJQueryWrapper<GlassInfo>() |
| | | .selectAll(GlassInfo.class).eq("t.glass_id", glassId) |
| | | .inSql("t.engineer_id", "select engineer_id from engineering where state = 1"); |
| | | if (endcell == Const.A10_OUT_TARGET_POSITION) { |
| | | queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from glass_info) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); |
| | | } |
| | | GlassInfo one = glassInfoService.getOne(queryWrapper); |
| | | if (one != null) { |
| | | EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(one, resultDetails); |
| | | glassInfo = resultDetails; |
| | | } else { |
| | | log.info("获取笼内玻璃和带进片玻璃为空或者不符合磨边尺寸"); |
| | | } |
| | | } else { |
| | | glassInfo = queryMinGlass(list.get(0).getWidth(), list.get(0).getHeight(), glassId); |
| | | } |
| | | } else if (a09EdgGlass != null && a10EdgGlass != null) { |
| | | List<EdgStorageCageDetails> a09Count = queryGlassByTaskLine(Const.A09_OUT_TARGET_POSITION); |
| | | List<EdgStorageCageDetails> a10Count = queryGlassByTaskLine(Const.A09_OUT_TARGET_POSITION); |
| | | List<EdgStorageCageDetails> a10Count = queryGlassByTaskLine(Const.A10_OUT_TARGET_POSITION); |
| | | endcell = a09Count.size() > a10Count.size() ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | glassInfo = a09Count.size() > a10Count.size() ? queryMinGlass(a09EdgGlass.getWidth(), a09EdgGlass.getHeight(), glassId) |
| | | : queryMinGlass(a10EdgGlass.getWidth(), a10EdgGlass.getHeight(), glassId); |
| | | } else { |
| | | endcell = a09EdgGlass != null ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | //按照历史任务获取需要执行的路线,如果该条线笼内无玻璃 走其他逻辑 |
| | | endcell = a09EdgGlass == null ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | List<EdgStorageCageDetails> details = queryGlassByTaskLine(endcell); |
| | | if (CollectionUtil.isEmpty(details)) { |
| | | int othercell = endcell == Const.A10_OUT_TARGET_POSITION ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | glassInfo = queryChangeGlassInfo(othercell, glassId); |
| | | } else { |
| | | glassInfo = a09EdgGlass != null ? queryMinGlass(a09EdgGlass.getWidth(), a09EdgGlass.getHeight(), glassId) |
| | | : queryMinGlass(a10EdgGlass.getWidth(), a10EdgGlass.getHeight(), glassId); |
| | | } |
| | | } |
| | | } else { |
| | | List<EdgStorageCageDetails> edgStorageCageDetails = queryGlassByTaskLine(endcell); |
| | |
| | | } else { |
| | | //获取笼内所有玻璃信息,包括待进片的 |
| | | List<EdgStorageCageDetails> glassList = queryEdgAllGlass(glassId); |
| | | Assert.isTrue(CollectionUtil.isNotEmpty(glassList), "笼内和待进片都没有玻璃"); |
| | | if (CollectionUtil.isEmpty(glassList)) { |
| | | log.info("笼内和待进片都没有玻璃"); |
| | | return Boolean.FALSE; |
| | | } |
| | | if (glassList.size() == 1 && glassId.equals(glassList.get(0).getGlassId())) { |
| | | glassInfo = glassList.get(0); |
| | | } else { |
| | |
| | | private List<EdgStorageCageDetails> queryEdgAllGlass(String glassId) { |
| | | List<EdgStorageCageDetails> glassList = new ArrayList<>(); |
| | | //获取待进片玻璃 |
| | | //todo: 获取正在执行的工程信息 |
| | | if (StringUtils.isNotBlank(glassId)) { |
| | | GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getGlassId, glassId)); |
| | | .eq(GlassInfo::getGlassId, glassId) |
| | | .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); |
| | | EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(one, resultDetails); |
| | | glassList.add(resultDetails); |
| | |
| | | return glassDetails; |
| | | } |
| | | GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getGlassId, glassId)); |
| | | .eq(GlassInfo::getGlassId, glassId) |
| | | .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1") |
| | | ); |
| | | EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(one, resultDetails); |
| | | if (null == glassDetails) { |
| | |
| | | */ |
| | | private List<EdgStorageCageDetails> queryGlassByTaskLine(int line) { |
| | | //获取任务表中最后一次出片的玻璃id |
| | | LambdaQueryWrapper<TaskCache> queryWrapper = new LambdaQueryWrapper<TaskCache>().eq(TaskCache::getTaskType, Const.GLASS_CACHE_TYPE_OUT) |
| | | .eq(TaskCache::getEndCell, line).orderByDesc(TaskCache::getCreateTime); |
| | | List<TaskCache> taskCacheList = taskCacheService.list(queryWrapper); |
| | | if (CollectionUtil.isEmpty(taskCacheList)) { |
| | | TaskCache taskCache = taskCacheService.queryGlassByTaskCache(line, Const.GLASS_CACHE_TYPE_OUT_ALL); |
| | | if (null == taskCache) { |
| | | log.info("没有找到{}线任务信息", line); |
| | | return new ArrayList<>(); |
| | | } |
| | | TaskCache taskCache = taskCacheList.get(0); |
| | | MPJQueryWrapper<EdgStorageCageDetails> mpjLambdaWrapper = new MPJQueryWrapper<>(); |
| | | mpjLambdaWrapper.select("t1.*") |
| | | .innerJoin("edg_storage_cage_details t1 on t.width = t1.width and t.height = t1.height") |
| | |
| | | * 按照任务类型、线号获取任务信息 |
| | | * |
| | | * @param line |
| | | * @param taskType |
| | | * @param taskTypes |
| | | * @return |
| | | */ |
| | | private EdgStorageCageDetails queryGlassByTaskCache(int line, int taskType) { |
| | | LambdaQueryWrapper<TaskCache> queryWrapper = new LambdaQueryWrapper<TaskCache>().eq(TaskCache::getTaskType, taskType) |
| | | .eq(TaskCache::getEndCell, line).orderByDesc(TaskCache::getCreateTime); |
| | | List<TaskCache> list = taskCacheService.list(queryWrapper); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | private EdgStorageCageDetails queryGlassByTaskCache(int line, List<Integer> taskTypes) { |
| | | TaskCache taskCache = taskCacheService.queryGlassByTaskCache(line, taskTypes); |
| | | if (null == taskCache) { |
| | | log.info("没有找到{}线任务信息", line); |
| | | return null; |
| | | } |
| | | return edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId, list.get(0).getGlassId())); |
| | | return edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId()) |
| | | .inSql(EdgStorageCageDetails::getEngineerId, "select engineer_id from engineering where state = 1").last(" limit 1 ")); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer queryLineByGlassInfo(EdgStorageCageDetails a08EdgStorageCageDetails, EdgStorageCageDetails a10EdgStorageCageDetails, |
| | | EdgStorageCageDetails glassInfo, int out08Glassstate, int out10Glassstate) { |
| | | if (a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) |
| | | && a08EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()) && out08Glassstate == 1) { |
| | | return Const.A09_OUT_TARGET_POSITION; |
| | | boolean b08 = a08EdgStorageCageDetails != null && a08EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) |
| | | && a08EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()); |
| | | boolean b10 = a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) |
| | | && a10EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()); |
| | | //存在出片任务 07为空 |
| | | if (b10) { |
| | | return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | if (a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) |
| | | && a10EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()) && out10Glassstate == 1) { |
| | | return Const.A10_OUT_TARGET_POSITION; |
| | | if (b08) { |
| | | return out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION; |
| | | } |
| | | if (out08Glassstate == 1) { |
| | | return Const.A09_OUT_TARGET_POSITION; |
| | | } |
| | | if (out10Glassstate == 1) { |
| | | return Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | Assert.isTrue(Boolean.FALSE, "没有找到出片路径"); |
| | | return 0; |
| | | return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param glassId |
| | | * @return |
| | | */ |
| | | private EdgStorageCageDetails queryChangeGlassInfo(int endcell, String glassId) { |
| | | public EdgStorageCageDetails queryChangeGlassInfo(int endcell, String glassId) { |
| | | //获取笼子内数量前二的玻璃数量 |
| | | MPJLambdaWrapper<EdgStorageCageDetails> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.select(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .selectCount(EdgStorageCageDetails::getGlassId, EdgStorageCageDetails::getCount) |
| | | .eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .last("order by count(t.glass_id) desc limit 2"); |
| | | MPJQueryWrapper<EdgStorageCageDetails> wrapper = new MPJQueryWrapper<>(); |
| | | wrapper.select("count(t.glass_id), t.width, t.height") |
| | | .eq("t.state", Const.GLASS_STATE_IN) |
| | | .groupBy("t.width, t.height"); |
| | | if (endcell == Const.A09_OUT_TARGET_POSITION) { |
| | | wrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + |
| | | "case when width < height then width else height end as second_length from edg_storage_cage_details) t1 " + |
| | | "on t.glass_id = t1.glass_id and (t1.first_length <=" + firstLength + " and t1.second_length<=" + secondLength + ") "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return null; |
| | |
| | | } else { |
| | | log.info("获取玻璃数量前2的玻璃占比为{},小于2", mix); |
| | | //获取任务表中最后一次出片的玻璃id |
| | | LambdaQueryWrapper<TaskCache> queryWrapper = new LambdaQueryWrapper<TaskCache>().eq(TaskCache::getTaskType, Const.GLASS_CACHE_TYPE_OUT) |
| | | .eq(TaskCache::getEndCell, endcell).orderByDesc(TaskCache::getCreateTime); |
| | | List<TaskCache> taskCacheList = taskCacheService.list(queryWrapper); |
| | | log.info("获取任务表中{}线最后一次出片的玻璃任务信息:{}", endcell, taskCacheList); |
| | | if (CollectionUtil.isEmpty(taskCacheList)) { |
| | | TaskCache taskCache = taskCacheService.queryGlassByTaskCache(endcell, Const.GLASS_CACHE_TYPE_OUT_ALL); |
| | | log.info("获取任务表中{}线最后一次出片的玻璃任务信息:{}", endcell, taskCache); |
| | | if (null == taskCache) { |
| | | log.info("{}线没有出片任务信息,直接出片", endcell); |
| | | return queryMinGlass(firstSize.getWidth(), firstSize.getHeight(), glassId); |
| | | } |
| | | TaskCache taskCache = taskCacheList.get(0); |
| | | EdgStorageCageDetails outGlassInfo = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>() |
| | | .eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId())); |
| | | log.info("{}线有出片任务信息,任务信息为{},玻璃信息为{}", endcell, taskCache, outGlassInfo); |
| | |
| | | log.info("5、直通任务,将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | EdgStorageCageDetails details = new EdgStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot); |
| | | EdgStorageCage nearestEmpty = edgStorageCageService.selectNearestEmpty(currentSlot, Boolean.TRUE); |
| | | Assert.isTrue(null != nearestEmpty, "格子已满,无法执行直通任务"); |
| | | log.info("3、查询卧式理片笼里面的空格:{}", nearestEmpty); |
| | | details.setSlot(nearestEmpty.getSlot()); |
| | |
| | | } |
| | | boolean glassSizeStatus = saveGlassSize(glassInfo); |
| | | log.info("7、添加出片玻璃尺寸信息到磨边前玻璃表是否完成:{}", glassSizeStatus); |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1); |
| | | log.info("8、发送确认字已完成"); |
| | | return Boolean.TRUE; |
| | | } |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @DS("salve_hangzhoumes") |
| | | public interface TaskCacheMapper extends BaseMapper<TaskCache> { |
| | | |
| | | TaskCache queryGlassByTaskCache(@Param(value = "line") int line, @Param(value = "taskTypes") List<Integer> taskTypes); |
| | | } |
| | |
| | | boolean insertTaskCache(TaskCache taskCache); |
| | | /** |
| | | * 查询磨边任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | List<Map<String,Object>> selectEdgInfo(String line); |
| | | |
| | | /** |
| | | * 查询磨边任务 |
| | | * |
| | | * @param line |
| | | * @return |
| | | */ |
| | | TaskCache queryGlassByTaskCache(int line, List<Integer> taskTypes); |
| | | |
| | | /** |
| | | * 查询理片任务 |
| | | * |
| | | * @return |
| | | */ |
| | | List<TaskCache> selectCacheInfo(); |
| | |
| | | // return baseMapper.selectList(new QueryWrapper<TaskCache>().eq("end_cell",line)); |
| | | } |
| | | |
| | | @Override |
| | | public TaskCache queryGlassByTaskCache(int line, List<Integer> taskTypes) { |
| | | return baseMapper.queryGlassByTaskCache(line, taskTypes); |
| | | } |
| | | |
| | | /** |
| | | * 查询待理片工作的任务 |
| | | * @return |
| | |
| | | mes: |
| | | threshold: 3 |
| | | ratio: 10 |
| | | firstLength: 3500 |
| | | secondLength: 2500 |
| | | sequence: |
| | | order: false |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.taskcache.mapper.TaskCacheMapper"> |
| | | |
| | | <select id="queryGlassByTaskCache" resultType="com.mes.taskcache.entity.TaskCache"> |
| | | SELECT top 1 |
| | | glass_id |
| | | ,start_cell |
| | | , end_cell |
| | | , task_type |
| | | , task_status |
| | | , create_time |
| | | FROM task_cache |
| | | <where> |
| | | end_cell = #{line} |
| | | AND task_type in |
| | | <foreach collection="taskTypes" item="item" open='(' close=')' separator=','> |
| | | #{item} |
| | | </foreach> |
| | | </where> |
| | | ORDER BY create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.WebSocketServer; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgstoragetask.service.TaskCacheService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.menu.service.SysMenuService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues = plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | if(getplcvlues!=null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.mes.engineering.controller; |
| | | |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author wu |
| | | * @since 2024-04-22 |
| | | */ |
| | | @RestController |
| | | @Slf4j |
| | | @RequestMapping("/engineering/engineering") |
| | | public class EngineeringController { |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private UpPattenUsageService upPattenUsageService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @ApiOperation("开始/暂停任务/传递工程号和状态,开始是1 暂停是0") |
| | | @PostMapping("/pauseTask") //调用上片任务 |
| | | @ResponseBody |
| | | public Result <List<UpPattenUsage>> pauseTask(@RequestBody Engineering engineering) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | log.info("StartorStop:{},{}", work,engineering); |
| | | return Result.build(200, engineering.getEngineerId(),glass); |
| | | } |
| | | |
| | | @ApiOperation("开始上片") |
| | | @PostMapping("/changeTask") //调用上片任务 |
| | | @ResponseBody |
| | | public Result <Boolean> changeTask(@RequestBody Engineering engineering) { |
| | | log.info("engineeringId:{}", engineering); |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectedEngineering(engineering.getEngineerId()); |
| | | if (upPattenUsage != null) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | optimizeProjectService.changeTask(engineering.getEngineerId(), 200); |
| | | return Result.build(200, "已保存过", work); |
| | | } else { |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineering.getEngineerId()); |
| | | log.info("将查询出的UpPattenUsage数据保存到数据库表里"); |
| | | upPattenUsageService.saveUpPattenUsage(upPattenUsages); |
| | | log.info("从PP表查询glassinfo的数据并保存到表里"); |
| | | List<GlassInfo> glassinfo = glassInfoService.selectGlassInfo(engineering.getEngineerId()); |
| | | glassInfoService.saveGlassInfo(glassinfo); |
| | | log.info("从PP表查询engineering的数据并保存到表里"); |
| | | List<Engineering> listEngineering = engineeringService.selectEngineering(engineering.getEngineerId()); |
| | | engineeringService.saveEngineering(listEngineering); |
| | | log.info("更改pp表状态为已领取"); |
| | | //将engineering表状态为正在上片 |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | optimizeProjectService.changeTask(engineering.getEngineerId(), 200); |
| | | return Result.build(200, "保存成功", work); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ApiOperation("查询可以上片的工程号") |
| | | @GetMapping("/selectTask") //调用上片任务 |
| | | @ResponseBody |
| | | public Result <List<Engineering>> selectTask() { |
| | | List<Engineering> engineering=engineeringService.selectTask(); |
| | | log.info("可领取任务返回:{}", engineering); |
| | | return Result.build(200, "",engineering); |
| | | } |
| | | } |
| | | |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/engineering/mapper/EngineeringMapper.java |
| | |
| | | package com.mes.engineering.mapper; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.engineering.entity.Engineering; |
| | | |
| | | /** |
| | | * <p> |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/engineering/service/EngineeringService.java |
| | |
| | | package com.mes.engineering.service; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.engineering.entity.Engineering; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @return Engineering |
| | | */ |
| | | Engineering selectInitiate(Integer state); |
| | | |
| | | /** |
| | | * 查询上片任务 |
| | | * @return Engineering |
| | | */ |
| | | List<Engineering> selectTask(); |
| | | } |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/engineering/service/impl/EngineeringServiceImpl.java |
| | |
| | | package com.mes.engineering.service.impl; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.mapper.EngineeringMapper; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.common.S7object; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private UpPattenUsageService upPattenUsageService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | |
| | |
| | | @Scheduled(fixedDelay = 3000000) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | | //获取联机状态 |
| | | String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | //获取是否有上片请求 |
| | | String loadRequest = plcParameterObject.getPlcParameter("loadRequest").getValue(); |
| | | //mes状态 |
| | | String mesToPlc = plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | if("1".equals(inkageStatus)&&"1".equals(loadRequest)) { |
| | | //判断开始上片的工程号 |
| | | Engineering engineering = engineeringService.selectInitiate(1); |
| | | if ("1".equals(loadRequest) && engineering != null) { |
| | | if (engineering != null) { |
| | | log.info("开始上片任务"); |
| | | UpPattenUsage upPattenUsage = upWorkstationService.selectPriority(engineering); |
| | | log.info("当有请求时查询当前上片顺序的玻璃信息{}", upPattenUsage); |
| | |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | if("1".equals(mesToPlc)&& "0".equals(loadRequest)){ |
| | | //请求字为零时,任务字清零 |
| | |
| | | switch (loadStatus) { |
| | | case "1": |
| | | log.info("收到汇报任务完成"); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus, 100); |
| | | break; |
| | | case "2": |
| | | log.info("收到汇报未完成任务"); |
| | |
| | | overTask(loadStatus, 0); |
| | | break; |
| | | case "0": |
| | | log.info("收到汇报清0状态"); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus, 100); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void loadGlassHome(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist(); |
| | | jsonObject.append("prioritylist", upPattenUsages); |
| | | //工位信息 |
| | | List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | jsonObject.append("list", upWorkstations); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void loadGlassStatus(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | //String inkageStatus =plcParameterObject.getPlcParameter("MesToPlc").getValue(); |
| | | String inkageStatus ="1"; |
| | | jsonObject.append("InkageStatus", inkageStatus); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask(); |
| | | if (upPattenUsage != null) { |
| | | log.info("收到汇报清{}状态", loadStatus); |
| | |
| | | upWorkstationService.reduceWorkstationNumber(upPattenUsage.getState()); |
| | | //完成上片表状态 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, state); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0); |
| | | //判断是否是最后一块玻璃 |
| | | UpPattenUsage sequence=upPattenUsageService.selectSequence(upPattenUsage); |
| | | //如果是最后一块时完成工程任务 |
| | | optimizeProjectService.overTask(sequence,300); |
| | | } |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.uppattenusage.controller; |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/up-patten-usage") |
| | | @Slf4j |
| | | public class UpPattenUsageController { |
| | | |
| | | @Autowired |
| | | private UpPattenUsageService upPattenUsageService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | @Autowired |
| | | private EngineeringService engineeringService; |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @ApiOperation("显示正在出片的工程信息") |
| | | @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<List<UpPattenUsage>> prioritylist() { |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | log.info("显示正在出片的工程信息:{}", glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | | |
| | | @ApiOperation("选择工程号后显示上片顺序预览") |
| | | @PostMapping("/selectUpPattenUsage") //查询现在上片机的玻璃信息 |
| | | @ResponseBody |
| | | public Result<List<UpPattenUsage>> selectUpPattenUsage(@RequestBody Engineering engineering) { |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineering.getEngineerId()); |
| | | return Result.build(200, "", upPattenUsages); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/service/UpPattenUsageService.java |
| | |
| | | * @return UpPattenUsage |
| | | */ |
| | | UpPattenUsage selectOverTask(); |
| | | /** |
| | | * 查询上片最后一块的玻璃 |
| | | * @return UpPattenUsage |
| | | */ |
| | | UpPattenUsage selectSequence(UpPattenUsage upPattenUsage); |
| | | |
| | | } |
| | | |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/service/impl/UpPattenUsageServiceImpl.java |
| | |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public List<UpPattenUsage> prioritylist() { |
| | | //获取正在上片的任务id |
| | | Engineering engineering= engineeringService.selectInitiate(1); |
| | | log.info("将参数传入到查询类里{}",engineering); |
| | | //log.info("将参数传入到查询类里{}",engineering); |
| | | if(engineering!=null){ |
| | | LambdaQueryWrapper<UpPattenUsage> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(UpPattenUsage::getEngineeringId,engineering.getEngineerId()); |
| | |
| | | List<OptimizeUpPattenUsage> upPattenUsageList = null; |
| | | if (engineeringId != null) { |
| | | upPattenUsageList = optimizeProjectMapper.selectJoinList(OptimizeUpPattenUsage.class, new MPJQueryWrapper<OptimizeProject>() |
| | | .select("t.project_no,t.glass_type,b.width,b.height,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id") |
| | | .select("t.project_no,t.glass_type,b.realwidth as width,b.realheight as height ,REGEXP_REPLACE(t.glass_thickness,'\\D','')as glass_thickness,b.stock_id") |
| | | .leftJoin("optimize_layout b on t.project_no=b.project_no") |
| | | .eq("b.project_no", engineeringId)); |
| | | } |
| | |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | //获取最后一块玻璃 |
| | | public UpPattenUsage selectSequence(UpPattenUsage upPattenUsage) { |
| | | QueryWrapper<UpPattenUsage>wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("engineering_id",upPattenUsage.getEngineeringId()) |
| | | .orderByDesc("layout_sequence") |
| | | .last("limit 1"); |
| | | return this.getOne(wrapper); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public Result<String> updateMesInkageLoad(@RequestBody short inKageWord) { |
| | | String result = upWorkstationService.updateMesInkageLoad(inKageWord); |
| | | return Result.success(result); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public String updateMesInkageLoad(short inKageWord) { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | log.info("修改设备两栋请求为{}:0联线;1联动", inKageWord); |
| | | S7object.getinstance().plccontrol.WriteWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord); |
| | | return "success"; |
| | | log.info("修改设备联动请求为{}:0离线;1联动", inKageWord); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord); |
| | | //读取plc的值 |
| | | return plcParameterObject.getPlcParameter("InkageStatus").getValue(); |
| | | } |
| | | |
| | | } |
| | |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | # configuration: |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 打印sql语句 |
| | | # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.entity.OptimizeProject; |
| | | import com.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.impl.UpPattenUsageServiceImpl; |
| | |
| | | engineeringService.saveEngineering(glass); |
| | | log.info("glassinfo:{}", Arrays.asList(glass)); |
| | | } |
| | | @Test |
| | | public void textengineering2(){ |
| | | //更新工程表状态为已领取 |
| | | //optimizeProjectService.changeTask("P24050801",200); |
| | | engineeringService.changeTask("P24051102",1); |
| | | } |
| | | |
| | | @Test |
| | | public void textengineering3(){ |
| | | //判断是否已保存过工程号到上片表 |
| | | UpPattenUsage upPattenUsage=upPattenUsageService.selectOverTask(); |
| | | log.info("上片表任务中的数据{}",upPattenUsage); |
| | | //上片表最后一片 |
| | | UpPattenUsage upPattenUsage=new UpPattenUsage(); |
| | | upPattenUsage.setEngineeringId("P24051103"); |
| | | UpPattenUsage upPattenUsage1=upPattenUsageService.selectSequence(upPattenUsage); |
| | | log.info("上片表任务中的数据{}",upPattenUsage1); |
| | | boolean isOver= optimizeProjectService.overTask(upPattenUsage1,300); |
| | | log.info("更改是否成功{}",isOver); |
| | | } |
| | | @Test |
| | | public void textengineering4(){ |
| | | //判断是否已保存过工程号到上片表 |
| | | List<Engineering> engineerings=engineeringService.selectTask(); |
| | | log.info("上片表任务中的数据{}",engineerings); |
| | | |
| | | } |
| | | @Test |
| | | public void textengineering5(){ |
| | | //显示选择工程 |
| | | OptimizeRequest optimizeRequest=new OptimizeRequest(); |
| | | optimizeRequest.setState(100); |
| | | List<OptimizeProject> engineerings=optimizeProjectService.listByState(optimizeRequest); |
| | | log.info("上片表任务中的数据{}",engineerings); |
| | | } |
| | | |
| | | } |
| | |
| | | // } |
| | | //发送坐标信息 |
| | | public void SendCoordinate(short glassX, short glassY) { |
| | | s7control.WriteWord("DB100.10", glassX); |
| | | s7control.WriteWord("DB100.10", glassY); |
| | | s7control.writeWord("DB100.10", glassX); |
| | | s7control.writeWord("DB100.10", glassY); |
| | | } |
| | | |
| | | //判断是否可以发送进炉信号 |
| | |
| | | |
| | | //发送进炉信号 |
| | | public void SendIntoGlass(short start) { |
| | | s7control.WriteWord("DB100.10", start); |
| | | s7control.writeWord("DB100.10", start); |
| | | } |
| | | |
| | | //接受完成字回复确认字 |
| | | public void SendIntoGlass() { |
| | | s7control.WriteWord("DB100.10", (short) 1); |
| | | s7control.writeWord("DB100.10", (short) 1); |
| | | } |
| | | |
| | | //显示等待中的版图 |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingAgoService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.impl.UpPattenUsageServiceImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | <artifactId>sqljdbc4</artifactId> |
| | | <version>4.0</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <properties> |
| | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | log.info("启动完成"); |
| | | S7object.getinstance().start(); |
| | | //S7object.getinstance().start(); |
| | | |
| | | } |
| | | } |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.context.ConfigurableApplicationContext; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | |
| | | @EnableScheduling |
| | | public class UnLoadGlassApplication { |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication springApplication = new SpringApplication(UnLoadGlassApplication.class); |
| | | ConfigurableApplicationContext applicationContext = springApplication.run(args); |
| | | WebSocketServer.setApplicationContext(applicationContext); |
| | | SpringApplication.run(UnLoadGlassApplication.class, args); |
| | | } |
| | | |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | |
| | | package com.mes.downglassinfo.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.mapper.DownWorkstationMapper; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.downworkstation.service.DownWorkstationTaskService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { |
| | |
| | | @Override |
| | | public List<DownGlassTask> getUnloadingTaskState() { |
| | | QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_stauts", 0); |
| | | queryWrapper.eq("task_stauts", 0).eq("task_type", 2).or().eq("task_stauts", 3); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | */ |
| | | |
| | | List<DownStorageCageDetails> CacheOut1(int start, int end); |
| | | |
| | | |
| | | /** |
| | | * @return 直通查询 |
| | | */ |
| | | List<GlassInfo> DirectConnection(); |
| | | } |
| | |
| | | // |
| | | // } |
| | | |
| | | @Override |
| | | public List<GlassInfo> DirectConnection(){ |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper2 = Wrappers.lambdaQuery(); |
| | | queryWrapper2.select(GlassInfo::getFlowCardId, |
| | | GlassInfo::getGlassId, |
| | | GlassInfo::getTemperingLayoutId, |
| | | GlassInfo::getTemperingFeedSequence) |
| | | .notInSql(GlassInfo::getGlassId, "SELECT glass_id FROM down_glass_info") |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence) |
| | | .last("LIMIT 1"); |
| | | |
| | | // 查询 GlassInfo 表 |
| | | log.info("直通查询"); |
| | | return glassInfoMapper.selectList(queryWrapper2); |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> CacheOut1(int start, int end) { |
| | |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("获取工位显示图1") |
| | | @ApiOperation("获取工位显示图2") |
| | | @GetMapping("/getwo2") |
| | | public ResponseEntity<Map<String, Object>> getw2o() { |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.lang.Assert; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.common.S7object; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.downglassinfo.entity.DownGlassInfo; |
| | | import com.mes.downglassinfo.mapper.DownGlassInfoMapper; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassInfoService; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.entity.DownWorkstationTask; |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.downworkstation.service.DownWorkstationTaskService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.downglassinfo.entity.DownGlassTask; |
| | | import com.mes.downglassinfo.service.DownGlassTaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | // String G06RobotTaskRequestWord = plcParameterObject.getPlcParameter("G06RobotTaskRequestWord").getAddress(); |
| | | |
| | | |
| | | String taskRequestTypeValue ="3"; |
| | | String taskRequestTypeValue ="0"; |
| | | String glassIdeValue ="NG24041101C002-2-6-1-6"; |
| | | String confirmationWrodValue ="1"; |
| | | String outGlassstate="1"; |
| | | String confirmationWrodAddress="1"; |
| | | String G11RobotTaskRequestWord ="1"; |
| | | String G06RobotTaskRequestWord ="1"; |
| | | String G13RobotTaskRequestWord ="1"; |
| | | String G11RobotTaskRequestWord ="0"; |
| | | String G06RobotTaskRequestWord ="0"; |
| | | String G13RobotTaskRequestWord ="0"; |
| | | |
| | | log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态为:{}", |
| | | taskRequestTypeValue, glassIdeValue, confirmationWrodValue, outGlassstate); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | log.info("2、获取到的玻璃信息为{}", glassInfo); |
| | | |
| | | // if(glassInfo.getFlowCardId()=){ |
| | | // |
| | | // } |
| | | if (glassInfo.getGlassId().equals(downStorageCageDetailsService.DirectConnection()) ) { |
| | | //直通 |
| | | log.info("3、如果当前玻璃属于版图id和片序的顺序则直通,执行下片任务"); |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); |
| | | int WorkstationId=downWorkstation.getWorkstationId(); |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", String.valueOf(WorkstationId), "3"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | }else{ |
| | | |
| | | log.info("4、如果不属于版图id和片序的顺序执行进片任务"); |
| | | |
| | | |
| | | //添加进片任务 查找空格 |
| | | List<DownStorageCageDetails> list = downStorageCageService.selectCacheEmpty(); |
| | | if(list.size()>0){ |
| | |
| | | |
| | | |
| | | |
| | | log.info("3、查询卧式理片笼里面的空格:{}", list); |
| | | log.info("4、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | log.info("5、查询卧式理片笼里面的空格:{}", list); |
| | | log.info("6、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); |
| | | DownStorageCageDetails details = new DownStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(1); |
| | |
| | | details.setSlot(item.getSlot()); |
| | | details.setDeviceId(item.getDeviceId()); |
| | | downStorageCageDetailsService.save(details); |
| | | log.info("5、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | log.info("7、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", item.getSlot() + "", "1"); |
| | | //添加进片任务 |
| | | log.info("6、生成进片任务信息存入任务表{}", downGlassTask); |
| | | log.info("8、生成进片任务信息存入任务表{}", downGlassTask); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | log.info("9、发送确认字完成"); |
| | | //S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | log.info("7、发送确认字完成"); |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.mes.job;
|
| | |
|
| | | import cn.hutool.json.JSONObject;
|
| | | import com.mes.downworkstation.entity.DownWorkstation;
|
| | | import com.mes.downworkstation.service.DownWorkstationService;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | @Slf4j
|
| | | @Component
|
| | | public class Downpush {
|
| | |
|
| | |
|
| | | @Autowired
|
| | | private DownWorkstationService downWorkstationService;
|
| | | @Scheduled(fixedDelay = 1000)
|
| | | public void Downpush() {
|
| | |
|
| | |
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | JSONObject jsonObject2 = new JSONObject();
|
| | | JSONObject jsonObject3 = new JSONObject();
|
| | |
|
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6);
|
| | | List<Map<String, Object>> glassinfodata = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
|
| | | List<Map<String, Object>> glassinfodata2 = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
|
| | | jsonObject.append("params",data);
|
| | | jsonObject2.append("glassinfo",glassinfodata);
|
| | | jsonObject3.append("glassinfo2",glassinfodata2);
|
| | | log.info(jsonObject.toString());
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
|
| | | ArrayList<WebSocketServer> sendwServer2 = WebSocketServer.sessionMap.get("unloadglass2");
|
| | | ArrayList<WebSocketServer> sendwServer3 = WebSocketServer.sessionMap.get("unloadglass3");
|
| | | // log.info(sendwServer.toString());
|
| | | if (sendwServer != null) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | |
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | if (sendwServer2 != null) {
|
| | | for (WebSocketServer webserver : sendwServer2) {
|
| | |
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject2.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | if (sendwServer3 != null) {
|
| | | for (WebSocketServer webserver : sendwServer3) {
|
| | |
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject3.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | active: prod |
| | | application: |
| | | name: unLoadGlass |
| | | |
| | | |
| | | mybatis-plus: |
| | | mapper-locations: classpath*:mapper/*.xml |
| | | configuration: |