Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
# Conflicts:
# UI-Project/src/views/Returns/returns.vue
18个文件已修改
11 文件已重命名
1个文件已删除
| | |
| | | } |
| | | ] |
| | | }, |
| | | |
| | | /*----------- 系统管理 ----------------*/ |
| | | { |
| | | 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', |
| | |
| | | <!-- <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 |
| | | })); |
| | |
| | | const adda = ref(false) |
| | | const flake = ref(false) |
| | | const flakea = ref(false) |
| | | const state = reactive({updateKey: 0}) |
| | | // const value = ref('') |
| | | // const patternHeight = ref(''); |
| | | // const patternWidth = ref(''); |
| | | // const filmsId = ref(''); |
| | | // const patternThickness = ref(''); |
| | | // const number = ref(''); |
| | | // patternHeight.value = ''; |
| | | // patternWidth.value = ''; |
| | | // filmsId.value = ''; |
| | | // patternThickness.value = ''; |
| | | // number.value = ''; |
| | | import request from "@/utils/request" |
| | | const ida = ref(null); |
| | | import { ref, onMounted } from "vue"; |
| | | import { ref, onMounted, onUnmounted } from "vue"; |
| | | // import http from "@/http/index"; |
| | | |
| | | let ruleForm = ref({ |
| | |
| | | } |
| | | } catch (error) { |
| | | // 处理请求失败的情况 |
| | | ElMessage.error('获取表格数据失败,请重试'); |
| | | // ElMessage.error('获取表格数据失败,请重试'); |
| | | } |
| | | }; |
| | | request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | if (res.code === 200) { |
| | | console.log(res.data); |
| | | tableDataa.value = res.data; |
| | | onMounted(async () => { |
| | | await fetchTableData(); |
| | | |
| | | // 设置定时器来定期刷新数据 |
| | | const intervalId = setInterval(async () => { |
| | | await fetchTableData(); |
| | | }, 1000); // 每1秒刷新一次 |
| | | |
| | | // 组件卸载时清除定时器 |
| | | onUnmounted(() => { |
| | | clearInterval(intervalId); |
| | | }); |
| | | }); |
| | | onMounted(async () => { |
| | | await fetchTableDataa(); |
| | | |
| | | // 设置定时器来定期刷新数据 |
| | | const intervalId = setInterval(async () => { |
| | | await fetchTableDataa(); |
| | | }, 1000); // 每1秒刷新一次 |
| | | |
| | | // 组件卸载时清除定时器 |
| | | onUnmounted(() => { |
| | | clearInterval(intervalId); |
| | | }); |
| | | }); |
| | | // request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | // if (res.code === 200) { |
| | | // console.log(res.data); |
| | | // tableDataa.value = res.data; |
| | | |
| | | if (tableDataa.value.length === 2) { |
| | | if (tableDataa.value[0].patternWidth > 0) { |
| | | flake.value = true; |
| | | } |
| | | // if (tableDataa.value.length === 2) { |
| | | // if (tableDataa.value[0].patternWidth > 0) { |
| | | // flake.value = true; |
| | | // } |
| | | |
| | | if (tableDataa.value[1].patternWidth > 0) { |
| | | flakea.value = true; |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | // router.push("/login"); |
| | | } |
| | | }); |
| | | // if (tableDataa.value[1].patternWidth > 0) { |
| | | // flakea.value = true; |
| | | // } |
| | | // } |
| | | // } else { |
| | | // ElMessage.warning(res.msg); |
| | | // // router.push("/login"); |
| | | // } |
| | | // }); |
| | | async function fetchTableDataa() { |
| | | try { |
| | | const res = await request.get("/loadGlass/LoadGlass/list"); |
| | | if (res.code === 200) { |
| | | tableDataa.value = res.data; |
| | | |
| | | // 根据数据更新 flake 和 flakea 的值 |
| | | if (res.data.length >= 2) { |
| | | if (res.data[0].patternWidth > 0) { |
| | | flake.value = true; |
| | | } else { |
| | | flake.value = false; |
| | | } |
| | | |
| | | if (res.data[1].patternWidth > 0) { |
| | | flakea.value = true; |
| | | } else { |
| | | flakea.value = false; |
| | | } |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg); |
| | | } |
| | | } catch (error) { |
| | | console.error('获取表格数据失败', error); |
| | | // 可以在这里添加额外的错误处理逻辑 |
| | | } |
| | | } |
| | | // request.get("/loadGlass/LoadGlass/list").then((res) => { |
| | | // window.localStorage.setItem('patternWidth', res.data.patternWidth) |
| | | // window.localStorage.setItem('workstationId', res.data.workstationId) |
| | |
| | | // window.location.reload() |
| | | add.value = false; |
| | | tableDataa.value = response.data; |
| | | // patternHeight = ''; |
| | | // patternWidth.value = ''; |
| | | // filmsId.value = ''; |
| | | // patternThickness.value = ''; |
| | | // number.value = ''; |
| | | window.localStorage.setItem('workstationId', response.data.workstationId) |
| | | let workstationId = window.localStorage.getItem('workstationId') |
| | | if (workstationId == '1') { |
| | |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | dialogFormVisible.value = false; |
| | | selectedProjectNo.value = '' |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | // window.location.reload() |
| | | blind.value = false; |
| | | tableData.splice(0, tableData.length, ...response.data); |
| | | |
| | | selectedProjectNoa.value = '' |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | blinda.value = false; |
| | | // tableData.value = response.data |
| | | // tableData.value = []; |
| | | tableData.splice([]); |
| | | console.log(response) |
| | | console.log(tableData) |
| | | // state.updateKey ++ |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | ElMessage.success(response.message); |
| | | // window.location.reload() |
| | | blindb.value = false; |
| | | state.updateKey ++ |
| | | tableData.splice([]); |
| | | |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.msg); |
| | |
| | | } |
| | | } |
| | | onMounted(fetchTableData); |
| | | onMounted(fetchTableDataa); |
| | | function getStatusText(state: number) { |
| | | switch (state) { |
| | | case 0: |
| | |
| | | <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" |
| | |
| | | :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" |
| | | > |
| | | <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-form-item label="高:" :required="true" style="width: 14vw"> |
| | | <el-input v-model="patternHeight" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | |
| | | <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) |
| | | 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: '删除成功!', |
| | | }) |
| | | 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 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 |
| | | }) |
| | | .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); |
| | | }); |
| | | }; |
| | | |
| | | // //js层,实战版本,与后台接口交互 |
| | | // const gettableList = (id) = >{ |
| | | // xxx接口.({ |
| | | // id:id |
| | | // }).then((res)=>{ |
| | | // //将数据传给el-table绑定的:data=>data.tableList |
| | | // data.tableList = res.data |
| | | |
| | | // }) |
| | | // } |
| | | 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: [], |
| | | |
| | | // //最后将请求函数挂载到vue视图上 |
| | | // onMounted(() => { |
| | | // gettableList () |
| | | }) |
| | | // 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/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 opena = async(row) => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否删除该用户?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.GlassId, |
| | | controlsId: 301 |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | // }) |
| | | // 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="userName" align="center" label="用户名" min-width="180" /> |
| | | <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-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="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-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-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="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> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </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"> |
| | |
| | | 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> |
| | |
| | | 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.StandardCharsets; |
| | | import java.util.*; |
| | |
| | | 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.mes.pp.entity.request.OptimizeRequest; |
| | | import com.mes.pp.mapper.OptimizeProjectMapper; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.mapper.UpPattenUsageMapper; |
| | | 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("将参数传入到查询类里,工程号做非空判断模糊查询"); |
| | |
| | | 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 void reStartS7client() { |
| | | if (s7PLC != null) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * s7通讯连接状态 |
| | | */ |
| | | public boolean CheckConnected() { |
| | | public boolean checkConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void WriteWord(String address, short data) { |
| | | public void writeWord(String address, int data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeInt16(address, data); |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | s7PLC.writeUInt16(address, data); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(String address, List<Short> datas) { |
| | | public void writeWord(String address, List<Integer> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | // 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)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param data Bit的值 |
| | | */ |
| | | public void WriteBit(String address, Boolean data) { |
| | | public void writeBit(String address, Boolean data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeBoolean(address, data); |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | s7PLC.writeBoolean(address, data); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas bit的值 |
| | | */ |
| | | public void WriteBit(List<String> address, List<Boolean> datas) { |
| | | public void writeBit(List<String> address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | // s7PLC.write(address, data); |
| | | |
| | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | addressWrite.addBoolean(address.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteBit(String address, List<Boolean> datas) { |
| | | public void writeBit(String address, List<Boolean> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | // 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)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | public void writeByte(String address, byte[] datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | // s7PLC.write(address, data); |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | |
| | | * @param address 地址 |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(List<String> address) { |
| | | public List<Integer> readWord(List<String> address) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | try { |
| | | return s7PLC.readInt16(address); |
| | | return s7PLC.readUInt16(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | 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<String> addresslist = getAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | | return s7PLC.readUInt16(addresslist); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | public byte[] readByte(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | |
| | | return s7PLC.readByte(address, count); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | |
| | | * @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); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | s7PLC.hotRestart(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | //读取不连续地址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) { |
| | |
| | | try { |
| | | return s7PLC.readString(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | //不连续地址写入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) { |
| | |
| | | try { |
| | | return s7PLC.readTime(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | |
| | | |
| | | |
| | | public void writetime(String address, long datas) { |
| | | if (s7PLC == null) |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | else if(!s7PLC.checkConnected()) |
| | | { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | |
| | | |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | } |
| | | |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | | } |
| | | |
| | | |
| | |
| | | * @param count 长度 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(String address, int count) { |
| | | if (s7PLC == null) |
| | | public List<Boolean> readBits(String address, int count) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | } |
| | | List<String> addresslist = getAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | |
| | | ; |
| | | |
| | | |
| | | 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("\\."); |
| | |
| | | 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()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询笼内离指定格子最近空格 |
| | | * |
| | | * @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); |
| | |
| | | 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 { |
| | | 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); |
| | | } |
| | | } |
| | |
| | | private 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)); |
| | | //TODO: 查询玻璃 |
| | | 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); |
| | | |
| | |
| | | boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); |
| | | log.info("6、生成进片任务信息存入任务表是否完成:{}", taskCache); |
| | | |
| | | S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 1); |
| | | S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1); |
| | | log.info("7、发送确认字完成"); |
| | | |
| | | |
| | |
| | | // 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; |
| | |
| | | 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) { |
| | | endcell = out08Glassstate == 1 || 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); |
| | | EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); |
| | | if (a09EdgGlass == null && a10EdgGlass == null) { |
| | |
| | | } else { |
| | | //获取笼内所有玻璃信息,包括待进片的 |
| | | List<EdgStorageCageDetails> glassList = queryEdgAllGlass(glassId); |
| | | Assert.isTrue(CollectionUtil.isNotEmpty(glassList), "笼内和待进片都没有玻璃"); |
| | | int othercell = endcell == Const.A10_OUT_TARGET_POSITION ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | glassInfo = queryChangeGlassInfo(othercell, glassId); |
| | | if (CollectionUtil.isEmpty(glassList)) { |
| | | log.info("笼内和待进片都没有玻璃"); |
| | | return Boolean.FALSE; |
| | | } |
| | | if (glassList.size() == 1 && glassId.equals(glassList.get(0).getGlassId())) { |
| | | glassInfo = glassList.get(0); |
| | | } else { |
| | | int othercell = endcell == Const.A10_OUT_TARGET_POSITION ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | glassInfo = queryChangeGlassInfo(othercell, glassId); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | private List<EdgStorageCageDetails> queryEdgAllGlass(String glassId) { |
| | | List<EdgStorageCageDetails> glassList = new ArrayList<>(); |
| | | //获取待进片玻璃 |
| | | if(StringUtils.isNotBlank(glassId)){ |
| | | //todo: 获取正在执行的工程信息 |
| | | if (StringUtils.isNotBlank(glassId)) { |
| | | GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() |
| | | .eq(GlassInfo::getGlassId, glassId)); |
| | | EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); |
| | |
| | | */ |
| | | 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 (a08EdgStorageCageDetails == null && a10EdgStorageCageDetails == null) { |
| | | return queryLineNoTask(out08Glassstate, out10Glassstate); |
| | | } else { |
| | | if (b08) { |
| | | return queryLineHasTask(out08Glassstate); |
| | | } |
| | | if (b10) { |
| | | return queryLineHasTask(out10Glassstate); |
| | | } |
| | | return queryLineNoTask(out08Glassstate, out10Glassstate); |
| | | } |
| | | if (a10EdgStorageCageDetails != null && a10EdgStorageCageDetails.getHeight().equals(glassInfo.getHeight()) |
| | | && a10EdgStorageCageDetails.getWidth().equals(glassInfo.getWidth()) && out10Glassstate == 1) { |
| | | return Const.A10_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; |
| | | } |
| | | |
| | | /** |
| | | * 获取有任务后的出片逻辑 |
| | | */ |
| | | private Integer queryLineHasTask(int outGlassstate) { |
| | | return outGlassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION; |
| | | } |
| | | |
| | | /** |
| | | * 获取无任务后的出片逻辑 |
| | | * |
| | | * @return |
| | | */ |
| | | private Integer queryLineNoTask(int out08Glassstate, int out10Glassstate) { |
| | | if (out08Glassstate == 2) { |
| | | return Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | if (out10Glassstate == 2 || out08Glassstate == 1) { |
| | | return Const.A09_OUT_TARGET_POSITION; |
| | | } |
| | | return Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 按照尺寸出玻璃 |
| | |
| | | .groupBy(EdgStorageCageDetails::getWidth, EdgStorageCageDetails::getHeight) |
| | | .last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | | if (CollectionUtil.isEmpty(list)){ |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | log.info("获取笼子内数量前二的玻璃数量:{}", list); |
| | |
| | | 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; |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues = plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/engineering/controller/EngineeringController.java |
| | |
| | | |
| | | |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.utils.Result; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | |
| | | import java.util.List; |
| | | |
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; |
| | | |
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; |
| | |
| | | int workId = upwork.getWorkstationId();//工位id |
| | | double width = upwork.getPatternWidth();//宽度 |
| | | double height = upwork.getPatternHeight();//高度 |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("WorkId").getAddress(), workId); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (long) width); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (long) height); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 1); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("WorkId").getAddress(), (short) workId); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("GlassWidth").getAddress(), (short) width); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("GlassHeight").getAddress(), (short) height); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), (short) 1); |
| | | //更改上片表状态 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId); |
| | | |
| | | } |
| | | } |
| | | if("1".equals(mesToPlc)&& "0".equals(loadRequest)){ |
| | | if ("1".equals(mesToPlc) && "0".equals(loadRequest)) { |
| | | //请求字为零时,任务字清零 |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0); |
| | | } |
| | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport(){ |
| | | public void plcLoadGlassReport() { |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | | if (loadStatus != null) { |
| | |
| | | } |
| | | } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | public void overTask(String loadStatus, int state) { |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask(); |
| | | if (upPattenUsage != null) { |
| | | log.info("收到汇报清{}状态", loadStatus); |
File was renamed from hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/controller/UpPattenUsageController.java |
| | |
| | | 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.entity.OptimizeProject; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | public String updateMesInkageLoad(short inKageWord) { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | log.info("修改设备两栋请求为{}:0联线;1联动", inKageWord); |
| | | S7object.getinstance().plccontrol.WriteWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord); |
| | | return "success"; |
| | | } |
| | | |
| | |
| | | // } |
| | | //发送坐标信息 |
| | | 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; |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |