Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | userStore.$patch({ |
| | | user: null, |
| | | }) |
| | | router.push('/login') |
| | | // router.push('/login') |
| | | let token = window.localStorage.getItem('userInfo') |
| | | console.log(token); |
| | | 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"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //提取菜单模块列表 |
| | |
| | | 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') |
| | |
| | | <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 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); |
| | | } |
| | | }; |
| | | // 编辑 |
| | | 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); |
| | | 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("/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="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="adda = true">编辑</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 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="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) |
| | | 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); |
| | | } |
| | | }; |
| | | // 编辑 |
| | | const getTableRowa = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/sys/role/updateRole', { |
| | | 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); |
| | | } |
| | | }; |
| | | // 删除 |
| | | 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> |
| | | <template #default="scope"> |
| | | <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="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 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="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> |
| | |
| | | // 绑定成功,处理逻辑 |
| | | 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); |
| | | add.value = false; |
| | | tableData.value = response.data; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.GlassId, |
| | | controlsId: 301 |
| | | const response = await request.post("/loadGlass/sys/user/deleteUser", { |
| | | ids: [row.id], |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | |
| | | <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="getTableRowa"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button @click="adda = false">取消</el-button> |
| | |
| | | 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 java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | s7PLC.close(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 重启西门子s7通讯连接 |
| | | */ |
| | | public void reStartS7client() { |
| | | public boolean reStartS7client() { |
| | | if (s7PLC != null) { |
| | | try { |
| | | s7PLC.hotRestart(); |
| | | return true; |
| | | } catch (Exception ex) { |
| | | return false; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void writeWord(String address, int data) { |
| | | public boolean writeWord(String address, int data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | 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<Integer> datas) { |
| | | public boolean writeWord(String address, List<Integer> datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = getAddressList(address, datas.size(), 16); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); 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; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | 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; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | // 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; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | |
| | | // s7PLC.write(address, data); |
| | | 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; |
| | | } |
| | | else if(!s7PLC.checkConnected()) { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | // 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> result = null; |
| | | try { |
| | | return s7PLC.readUInt16(address); |
| | | result = s7PLC.readUInt16(address); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> result = null; |
| | | List<String> addresslist = getAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readUInt16(addresslist); |
| | | result = s7PLC.readUInt16(addresslist); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | | } finally { |
| | | return result; |
| | | } |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<Boolean> values = new ArrayList<>(); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | values = s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | s7PLC.hotRestart(); |
| | | return null; |
| | | } finally { |
| | | return values; |
| | | } |
| | | |
| | | } |
| | | |
| | | /* //读取不连续地址bit |
| | |
| | | }*/ |
| | | |
| | | |
| | | |
| | | |
| | | //读取字符串 |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | //读取时间 |
| | |
| | | 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) { |
| | | public boolean writetime(String address, long datas) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | return false; |
| | | } |
| | | else if(!s7PLC.checkConnected()) |
| | | { |
| | | s7PLC.hotRestart(); |
| | | } |
| | | |
| | | |
| | | boolean result = false; |
| | | int tryCount = 2; |
| | | do { |
| | | try { |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | result = true; |
| | | } catch (Exception ex) { |
| | | reStartS7client(); |
| | | } finally { |
| | | tryCount -= 1; |
| | | } |
| | | } |
| | | while (!result && tryCount > 0); |
| | | return result; |
| | | } |
| | | |
| | | |
| | |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<Boolean> values = new ArrayList<>(); |
| | | List<String> addresslist = getAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | values = s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | s7PLC.hotRestart(); |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } finally { |
| | | return values; |
| | | } |
| | | |
| | | } |
| | | |
| | | ; |
| | |
| | | <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>--> |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | .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; |
| | |
| | | * @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、获取钢化版图是否超过阈值 |
| | |
| | | endcell = queryLineByGlassInfo(a09EdgGlass, a10EdgGlass, glassInfo, out08Glassstate, out10Glassstate); |
| | | } else { |
| | | //判断两条线是否都空闲 |
| | | endcell = out08Glassstate == 1 || out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | 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); |
| | | EdgStorageCageDetails a10EdgGlass = queryGlassByTaskCache(Const.A10_OUT_TARGET_POSITION, Const.GLASS_CACHE_TYPE_OUT); |
| | | 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 <3500 and t1.second_length<2600 "); |
| | | } |
| | | 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); |
| | | 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 <3500 and t1.second_length<2600 "); |
| | | } |
| | | 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); |
| | |
| | | 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 out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | return queryLineNoTask(out08Glassstate, out10Glassstate); |
| | | if (b08) { |
| | | return out08Glassstate == 2 ? Const.A10_OUT_TARGET_POSITION : Const.A09_OUT_TARGET_POSITION; |
| | | } |
| | | return out10Glassstate == 2 ? Const.A09_OUT_TARGET_POSITION : Const.A10_OUT_TARGET_POSITION; |
| | | } |
| | | |
| | | /** |
| | | * 获取有任务后的出片逻辑 |
| | | */ |
| | | 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; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 按照尺寸出玻璃 |
| | |
| | | * @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 <3500 and t1.second_length<2600 "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | byte[] getplcvlues = plccontrol.readByte(PlcMesObject.getPlcAddressBegin(), PlcMesObject.getPlcAddressLength()); |
| | | if(getplcvlues!=null) { |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public String updateMesInkageLoad(short inKageWord) { |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | log.info("修改设备两栋请求为{}:0联线;1联动", inKageWord); |
| | | log.info("修改设备联动请求为{}:0离线;1联动", inKageWord); |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("InkageStatus").getAddress(), inKageWord); |
| | | return "success"; |
| | | } |