Merge remote-tracking branch 'origin/master'
| | |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | const toggleEnableState = async (row) => { |
| | | const newState = row.enable_state === 1 ? 0 : 1; |
| | | // 发送请求到后端更新状态(这里省略了实际的请求逻辑) |
| | | const response = await request.post('/unLoadGlass/downStorage/updateDownStorageCage', { id: row.id, enablestate: newState }); |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | row.enable_state = newState; |
| | | }; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/unLoadGlass/api/talk/unloadglass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | |
| | | <el-table-column prop="width" align="center" label="宽" min-width="120" /> |
| | | <el-table-column prop="height" align="center" label="高" min-width="120" /> |
| | | <el-table-column |
| | | align="center" |
| | | align="center" |
| | | label="启用状态" |
| | | min-width="80" |
| | | prop="enable_state" |
| | | > |
| | | <template #default="scope"> |
| | | <template #default="scope"> |
| | | <el-tag |
| | | :type="scope.row.enable_state === 1 ? 'success' : 'danger'" |
| | | @click="toggleEnableState(scope.row)" |
| | | > |
| | | {{ scope.row.enable_state === 1 ? '启用' : '禁用' }} |
| | | </el-tag> |
| | | </template> |
| | | <!-- <template #default="scope"> |
| | | <el-tag type="success" >{{ scope.row.enable_state==1?"启用":"未启用" }}</el-tag> |
| | | </template> |
| | | </template> --> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <template #default="scope"> |
| | |
| | | </el-scrollbar> |
| | | </el-card> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import { Delete, Upload } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | import request from "@/utils/request" |
| | | |
| | | import { ref, onMounted } from 'vue'; |
| | | // import { ref } from 'vue' |
| | | |
| | | import { ref, onMounted, onBeforeUnmount } from 'vue'; |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | const dialogFormVisible = ref(true) |
| | | const dialogFormVisiblea = ref(false) |
| | | const dialogFormVisibleb = ref(false) |
| | |
| | | const adjustedRectsa = ref([]); |
| | | const adjustedRectsb = ref([]); |
| | | // 进炉中 |
| | | onMounted(async () => { |
| | | try { |
| | | const response = await request.get('/temperingGlass/temperingGlassInfo/SelectIntoGlass'); |
| | | if (response.code === 200) { |
| | | const rawRects = response.data; // 设置矩形数据 |
| | | console.log(response.data); |
| | | const { height: newheight,width: newwidth } = response.data; // 获取尺寸 |
| | | height.value = newheight; |
| | | width.value = newwidth; |
| | | |
| | | adjustedRects.value = rawRects.map(rect => ({ |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/temperingGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | adjustedRects.value = data.intoGlass[0].map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | ycoordinate: rect.ycoordinate, |
| | | width: rect.width , |
| | | height: rect.height , |
| | | })); |
| | | adjustedRectsa.value = data.waitingGlass[0].map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | ycoordinate: rect.ycoordinate, |
| | | width: rect.width , |
| | | height: rect.height , |
| | | })); |
| | | console.log(rect); |
| | | |
| | | adjustedRectsb.value = data.outGlass[0].map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | ycoordinate: rect.ycoordinate, |
| | | width: rect.width , |
| | | height: rect.height , |
| | | })); |
| | | }; |
| | | |
| | | // console.log( (rect.width*100) / 300 ); |
| | | } else { |
| | | // console.error('Failed to fetch rectangles from API.'); |
| | | console.error('Failed to fetch rects from API.'); |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error fetching rectangles :', error); |
| | | console.error('Error fetching rects :', error); |
| | | } |
| | | }); |
| | | // 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | onMounted(() => { |
| | | // fetchFlowCardId(); |
| | | // fetchTableData(); // 获取数据 |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | // onMounted(async () => { |
| | | // try { |
| | | // const response = await request.get('/temperingGlass/temperingGlassInfo/SelectIntoGlass'); |
| | | // if (response.code === 200) { |
| | | // const rawRects = response.data; // 设置矩形数据 |
| | | // console.log(response.data); |
| | | // const { height: newheight,width: newwidth } = response.data; // 获取尺寸 |
| | | // height.value = newheight; |
| | | // width.value = newwidth; |
| | | |
| | | // adjustedRects.value = rawRects.map(rect => ({ |
| | | // ...rect, // 复制原始对象的其他属性 |
| | | // xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | // ycoordinate: rect.ycoordinate, |
| | | // width: rect.width , |
| | | // height: rect.height , |
| | | // })); |
| | | // console.log(rect); |
| | | |
| | | // // console.log( (rect.width*100) / 300 ); |
| | | // } else { |
| | | // // console.error('Failed to fetch rectangles from API.'); |
| | | // console.error('Failed to fetch rects from API.'); |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rectangles :', error); |
| | | // console.error('Error fetching rects :', error); |
| | | // } |
| | | // }); |
| | | // 进炉前 |
| | | const handleConfirm = async () => { |
| | | try { |
| | | const response = await request.post('/temperingGlass/temperingGlassInfo/SelectWaitingGlass'); |
| | | if (response.code === 200) { |
| | | const rawRects = response.data; // 设置矩形数据 |
| | | console.log(response.data); |
| | | const { height: newheight,width: newwidth } = response.data; // 获取尺寸 |
| | | height.value = newheight; |
| | | width.value = newwidth; |
| | | // const handleConfirm = async () => { |
| | | // try { |
| | | // const response = await request.post('/temperingGlass/temperingGlassInfo/SelectWaitingGlass'); |
| | | // if (response.code === 200) { |
| | | // const rawRects = response.data; // 设置矩形数据 |
| | | // console.log(response.data); |
| | | // const { height: newheight,width: newwidth } = response.data; // 获取尺寸 |
| | | // height.value = newheight; |
| | | // width.value = newwidth; |
| | | |
| | | adjustedRectsa.value = rawRects.map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | ycoordinate: rect.ycoordinate, |
| | | width: rect.width , |
| | | height: rect.height , |
| | | })); |
| | | console.log(rect); |
| | | // adjustedRectsa.value = rawRects.map(rect => ({ |
| | | // ...rect, // 复制原始对象的其他属性 |
| | | // xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | // ycoordinate: rect.ycoordinate, |
| | | // width: rect.width , |
| | | // height: rect.height , |
| | | // })); |
| | | // console.log(rect); |
| | | |
| | | // console.log( (rect.width*100) / 300 ); |
| | | } else { |
| | | // console.error('Failed to fetch rectangles from API.'); |
| | | console.error('Failed to fetch rects from API.'); |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error fetching rectangles :', error); |
| | | console.error('Error fetching rects :', error); |
| | | } |
| | | }; |
| | | // // console.log( (rect.width*100) / 300 ); |
| | | // } else { |
| | | // // console.error('Failed to fetch rectangles from API.'); |
| | | // console.error('Failed to fetch rects from API.'); |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rectangles :', error); |
| | | // console.error('Error fetching rects :', error); |
| | | // } |
| | | // }; |
| | | |
| | | // 已出炉 |
| | | const handleConfirma = async () => { |
| | | try { |
| | | const response = await request.get('/temperingGlass/temperingGlassInfo/SelectOutGlass'); |
| | | if (response.code === 200) { |
| | | const rawRects = response.data; // 设置矩形数据 |
| | | console.log(response.data); |
| | | const { height: newheight,width: newwidth } = response.data; // 获取尺寸 |
| | | height.value = newheight; |
| | | width.value = newwidth; |
| | | // const handleConfirma = async () => { |
| | | // try { |
| | | // const response = await request.get('/temperingGlass/temperingGlassInfo/SelectOutGlass'); |
| | | // if (response.code === 200) { |
| | | // const rawRects = response.data; // 设置矩形数据 |
| | | // console.log(response.data); |
| | | // const { height: newheight,width: newwidth } = response.data; // 获取尺寸 |
| | | // height.value = newheight; |
| | | // width.value = newwidth; |
| | | |
| | | adjustedRectsb.value = rawRects.map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | ycoordinate: rect.ycoordinate, |
| | | width: rect.width , |
| | | height: rect.height , |
| | | })); |
| | | console.log(rect); |
| | | // adjustedRectsb.value = rawRects.map(rect => ({ |
| | | // ...rect, // 复制原始对象的其他属性 |
| | | // xcoordinate: rect.xcoordinate, // 将x值除以3 |
| | | // ycoordinate: rect.ycoordinate, |
| | | // width: rect.width , |
| | | // height: rect.height , |
| | | // })); |
| | | // console.log(rect); |
| | | |
| | | // console.log( (rect.width*100) / 300 ); |
| | | } else { |
| | | // console.error('Failed to fetch rectangles from API.'); |
| | | console.error('Failed to fetch rects from API.'); |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error fetching rectangles :', error); |
| | | console.error('Error fetching rects :', error); |
| | | } |
| | | }; |
| | | // // console.log( (rect.width*100) / 300 ); |
| | | // } else { |
| | | // // console.error('Failed to fetch rectangles from API.'); |
| | | // console.error('Failed to fetch rects from API.'); |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rectangles :', error); |
| | | // console.error('Error fetching rects :', error); |
| | | // } |
| | | // }; |
| | | const gridOptions = reactive({ |
| | | border: "full",//表格加边框 |
| | | keepSource: true,//保持源数据 |
| | |
| | | <el-scrollbar height="630px"> |
| | | <div style="position: relative;width: 1400px;"> |
| | | <div |
| | | v-for="(rect, index) in adjustedRects" |
| | | v-for="(rect, index) in adjustedRectsa" |
| | | :key="index" |
| | | class="rect" |
| | | :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }" |
| | |
| | | <el-scrollbar height="630px"> |
| | | <div style="position: relative;width: 1400px;"> |
| | | <div |
| | | v-for="(rect, index) in adjustedRects" |
| | | v-for="(rect, index) in adjustedRectsb" |
| | | :key="index" |
| | | class="rect" |
| | | :style="{ position: 'absolute', top: `${rect.ycoordinate}px`, left: `${rect.xcoordinate}px`, width: `${rect.width}px`, height: `${rect.height}px` }" |
| | |
| | | <el-button style="margin-top: 5px;margin-left: 15px;" id="searchButton" type="primary" @click="dialogFormVisible = true">选择工程</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="primary" @click="handleBind">开始上片</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="warning" @click="handleBinda">暂停</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="danger" @click="handleBindb">停止任务</el-button> |
| | | <!-- <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="danger" @click="handleBindb">停止任务</el-button> --> |
| | | |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 15px;" v-loading="loading"> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> |
| | |
| | | // 更新 tableData 的数据 |
| | | |
| | | tableData.splice(0, tableData.length, ...data.params[0]); |
| | | // console.log("更新后数据", tableData); |
| | | // console.log("更新后数据", data.params[0]); |
| | | |
| | | }; |
| | | |
| | |
| | | * @param param 参数实例 |
| | | */ |
| | | public void addPlcBit(PlcBitInfo param) { |
| | | if (plcBitMap != null) |
| | | plcBitMap.put(param.getCodeId(),param); |
| | | if (plcBitMap != null) { |
| | | plcBitMap.put(param.getCodeId(), param); |
| | | } |
| | | else { |
| | | plcBitMap = new LinkedHashMap<String,PlcBitInfo>(); |
| | | plcBitMap.put(param.getCodeId(),param); |
| | |
| | | // 2、全局配置 |
| | | // 全局配置 |
| | | GlobalConfig gc = new GlobalConfig(); |
| | | gc.setOutputDir("D:\\Documents\\hangzhoumesParent3\\"); |
| | | gc.setOutputDir("D:\\Documents\\hangzhoumesParent4\\"); |
| | | |
| | | gc.setServiceName("%sService"); //去掉Service接口的首字母I |
| | | gc.setAuthor("wu"); |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.utils.Result; |
| | |
| | | @Autowired |
| | | private BigStorageCageService bigStorageCageService; |
| | | |
| | | @ApiOperation("查询理片笼信息") |
| | | @GetMapping("/bigStorageCage") |
| | | public Result querybigStorageCageDetail(int deviceId) { |
| | | return Result.build(200,"查询成功",bigStorageCageService.querybigStorageCageDetail(deviceId)); |
| | | @ApiOperation("理片笼启用禁用") |
| | | @GetMapping("/updateStorageCageDisabled") |
| | | public Result updateStorageCageDisabled(int slot,int enableState) { |
| | | bigStorageCageService.updateStorageCageDisabled(slot,enableState); |
| | | return Result.build(200,"启用/禁用成功",1); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.utils.Result; |
| | |
| | | @Autowired |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | |
| | | @ApiOperation("理片笼详情") |
| | | @PostMapping("/queryBigStorageCageDetails") |
| | | public Result queryBigStorageCageDetails() { |
| | | return Result.build(200,"查询成功",bigStorageCageDetailsService.list()); |
| | | |
| | | @ApiOperation("玻璃详情查询") |
| | | @PostMapping("/selectBigStorageCageDetails") |
| | | public Result selectBigStorageCageDetails(String glassId) { |
| | | BigStorageCageDetails bigStorageCageDetails=bigStorageCageDetailsService.selectBigStorageCageDetails(glassId); |
| | | return Result.build(200,"查询成功",bigStorageCageDetails); |
| | | } |
| | | |
| | | @ApiOperation("理片笼详情添加") |
| | | @PostMapping("/insertBigStorageCageDetails") |
| | | public Result insertBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.save(bigStorageCageDetails); |
| | | bigStorageCageDetailsService.insertBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200,"添加成功",1); |
| | | } |
| | | |
| | | @ApiOperation("理片笼详情删除") |
| | | @PostMapping("/deleteBigStorageCageDetails") |
| | | public Result deleteBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.removeById(bigStorageCageDetails.getId()); |
| | | bigStorageCageDetailsService.deleteBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200,"删除成功",1); |
| | | } |
| | | |
| | | @ApiOperation("理片笼任务查询") |
| | | @PostMapping("/selectBigStorageCageDetails") |
| | | public Result selectBigStorageCageDetails(int state) { |
| | | LambdaQueryWrapper<BigStorageCageDetails> selectWrapper = new LambdaQueryWrapper<>(); |
| | | selectWrapper.eq(BigStorageCageDetails::getState,state); |
| | | return Result.build(200,"查询成功",bigStorageCageDetailsService.list(selectWrapper)); |
| | | @ApiOperation("理片笼任务破损") |
| | | @PostMapping("/damageBigStorageCageDetails") |
| | | public Result damageBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.damageBigStorageCageDetails(bigStorageCageDetails.getGlassId()); |
| | | return Result.build(200,"破损成功",1); |
| | | } |
| | | |
| | | @ApiOperation("理片笼任务完成") |
| | | @PostMapping("/finishBigStorageCageDetails") |
| | | public Result finishBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.finishBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200,"破损成功",1); |
| | | } |
| | | |
| | | @ApiOperation("理片笼任务出片") |
| | | @PostMapping("/outBigStorageCageDetails") |
| | | public Result outBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.outBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200,"破损成功",1); |
| | | } |
| | | } |
| | | |
| | |
| | | * 启用状态 |
| | | */ |
| | | @ApiModelProperty(value = "启用状态", position = 5) |
| | | private String enableState; |
| | | private Integer enableState; |
| | | |
| | | /** |
| | | * 剩余宽度 |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import feign.Param; |
| | | |
| | |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageDetailsMapper extends BaseMapper<BigStorageCageDetails> { |
| | | public interface BigStorageCageDetailsMapper extends MPJBaseMapper<BigStorageCageDetails> { |
| | | |
| | | } |
| | |
| | | package com.mes.bigstorage.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | public interface BigStorageCageMapper extends BaseMapper<BigStorageCage> { |
| | | public interface BigStorageCageMapper extends MPJBaseMapper<BigStorageCage> { |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | List<BigStorageCageDetails> selectTask(int taskType); |
| | | |
| | | boolean selectGetBoard(GlassInfo glassInfo, String plcFeedReqLine); |
| | | double selectGetBoard(String plcFeedReqLine); |
| | | |
| | | void deleteBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails); |
| | | |
| | | void damageBigStorageCageDetails(String glassId); |
| | | |
| | | BigStorageCageDetails selectBigStorageCageDetails(String glassId); |
| | | |
| | | void insertBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails); |
| | | |
| | | void finishBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails); |
| | | |
| | | void outBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails); |
| | | } |
| | |
| | | |
| | | List<Map<String, Object>> selectBigStorageCageUsage(); |
| | | |
| | | boolean selectWidthSufficient(BigStorageCageDetails layoutSlotInfo,double width); |
| | | void updateStorageCageDisabled(int slot,int enableState); |
| | | } |
| | |
| | | package com.mes.bigstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper; |
| | | import com.mes.bigstoragetask.mapper.BigStorageCageOutTaskMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | * @since 2024-03-27 |
| | | */ |
| | | @Service |
| | | public class BigStorageCageDetailsServiceImpl extends ServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService { |
| | | public class BigStorageCageDetailsServiceImpl extends MPJBaseServiceImpl<BigStorageCageDetailsMapper, BigStorageCageDetails> implements BigStorageCageDetailsService { |
| | | |
| | | @Resource |
| | | private BigStorageCageOutTaskMapper bigStorageCageOutTaskMapper; |
| | | @Resource |
| | | private BigStorageCageFeedTaskMapper bigStorageCageFeedTaskMapper; |
| | | @Resource |
| | | private TemperingGlassInfoMapper temperingGlassInfoMapper; |
| | | @Resource |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Resource |
| | | private GlassInfoMapper glassInfoMapper; |
| | | |
| | | /** |
| | | * 查询进/出片任务 |
| | |
| | | * 判断当前玻璃是否能上车 |
| | | */ |
| | | @Override |
| | | public boolean selectGetBoard(GlassInfo glassInfo, String plcFeedReqLine){ |
| | | public double selectGetBoard(String plcFeedReqLine){ |
| | | double carWidth=5000; |
| | | LambdaQueryWrapper<BigStorageCageDetails> feedWrapper = new LambdaQueryWrapper<>(); |
| | | feedWrapper.eq(BigStorageCageDetails::getState, plcFeedReqLine); |
| | | |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList=baseMapper.selectList(feedWrapper); |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTaskList=bigStorageCageFeedTaskMapper.selectList(null); |
| | | |
| | | LambdaQueryWrapper<BigStorageCageFeedTask> bigStorageCageFeedTaskWrapper = new LambdaQueryWrapper<>(); |
| | | bigStorageCageFeedTaskWrapper |
| | | .eq(BigStorageCageFeedTask::getTaskState,plcFeedReqLine) |
| | | .eq(BigStorageCageFeedTask::getLine,plcFeedReqLine); |
| | | |
| | | List<BigStorageCageFeedTask> bigStorageCageFeedTaskList=bigStorageCageFeedTaskMapper.selectList(bigStorageCageFeedTaskWrapper); |
| | | Map<String, BigStorageCageFeedTask> listMap = bigStorageCageFeedTaskList.stream() |
| | | .collect(Collectors.toMap(BigStorageCageFeedTask::getGlassId, task -> task)); |
| | | for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList) { |
| | |
| | | carWidth -= Integer.parseInt(bigStorageCageDetails.getWidth().toString()) + bigStorageCageDetails.getGap(); |
| | | } |
| | | } |
| | | if(carWidth>=0){ |
| | | return true; |
| | | return carWidth; |
| | | |
| | | } |
| | | |
| | | |
| | | //栓除出片任务.更新格子宽度 |
| | | @Override |
| | | public void deleteBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails){ |
| | | baseMapper.deleteById(bigStorageCageDetails.getId()); |
| | | bigStorageCageService.updateRemainWidth(bigStorageCageDetails.getSlot()); |
| | | } |
| | | |
| | | //理片笼详情破损 |
| | | @Override |
| | | public void damageBigStorageCageDetails(String glassId){ |
| | | LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoWrapper=new LambdaQueryWrapper<>(); |
| | | temperingGlassInfoWrapper.eq(TemperingGlassInfo::getGlassId,glassId); |
| | | TemperingGlassInfo temperingGlassInfo=temperingGlassInfoMapper.selectOne(temperingGlassInfoWrapper); |
| | | |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailsWrapper=new LambdaQueryWrapper<>(); |
| | | bigStorageCageDetailsWrapper.eq(BigStorageCageDetails::getGlassId,glassId); |
| | | BigStorageCageDetails bigStorageCageDetails=baseMapper.selectOne(bigStorageCageDetailsWrapper); |
| | | |
| | | if(temperingGlassInfo.getState()==-2){ |
| | | temperingGlassInfoMapper.deleteById(temperingGlassInfo); |
| | | }else{ |
| | | return false; |
| | | temperingGlassInfo.setState(5); |
| | | temperingGlassInfoMapper.updateById(temperingGlassInfo); |
| | | } |
| | | baseMapper.deleteById(bigStorageCageDetails.getId()); |
| | | bigStorageCageService.updateRemainWidth(bigStorageCageDetails.getSlot()); |
| | | //todo:插入破损数据 |
| | | |
| | | } |
| | | |
| | | //查询玻璃信息 |
| | | @Override |
| | | public BigStorageCageDetails selectBigStorageCageDetails(String glassId){ |
| | | LambdaQueryWrapper<GlassInfo> glassInfoWrapper=new LambdaQueryWrapper<>(); |
| | | glassInfoWrapper.eq(GlassInfo::getGlassId,glassId); |
| | | GlassInfo glassInfo=glassInfoMapper.selectOne(glassInfoWrapper); |
| | | BigStorageCageDetails bigStorageCageDetails=new BigStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, bigStorageCageDetails); |
| | | bigStorageCageDetails.setState(0); |
| | | bigStorageCageDetails.setGap(20); |
| | | return bigStorageCageDetails; |
| | | } |
| | | |
| | | //理片笼详情添加 |
| | | @Override |
| | | public void insertBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails){ |
| | | baseMapper.insert(bigStorageCageDetails); |
| | | bigStorageCageService.updateRemainWidth(bigStorageCageDetails.getSlot()); |
| | | } |
| | | |
| | | //理片笼详情完成 |
| | | @Override |
| | | public void finishBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails){ |
| | | if(bigStorageCageDetails.getState()==1||bigStorageCageDetails.getState()==2){ |
| | | bigStorageCageDetails.setState(0); |
| | | baseMapper.updateById(bigStorageCageDetails); |
| | | bigStorageCageFeedTaskMapper.deleteById(bigStorageCageDetails.getBigStorageCageFeedTask().getId()); |
| | | }else{ |
| | | baseMapper.deleteById(bigStorageCageDetails.getId()); |
| | | bigStorageCageOutTaskMapper.deleteById(bigStorageCageDetails.getBigStorageCageOutTask().getId()); |
| | | } |
| | | |
| | | } |
| | | |
| | | //手动出片 |
| | | @Override |
| | | public void outBigStorageCageDetails(BigStorageCageDetails bigStorageCageDetails){ |
| | | LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoWrapper =new LambdaQueryWrapper<>(); |
| | | temperingGlassInfoWrapper |
| | | .eq(TemperingGlassInfo::getGlassId,bigStorageCageDetails.getGlassId()); |
| | | TemperingGlassInfo temperingGlassInfo=temperingGlassInfoMapper.selectOne(temperingGlassInfoWrapper); |
| | | if(temperingGlassInfo.getGlassId()==null){ |
| | | LambdaQueryWrapper<GlassInfo> glassInfoWrapper=new LambdaQueryWrapper<>(); |
| | | glassInfoWrapper |
| | | .eq(GlassInfo::getGlassId,bigStorageCageDetails.getGlassId()); |
| | | GlassInfo glassInfo=glassInfoMapper.selectOne(glassInfoWrapper); |
| | | TemperingGlassInfo temperingGlassInfo1=new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(glassInfo, temperingGlassInfo1); |
| | | |
| | | if(temperingGlassInfo.getTemperingLayoutId()!=null){ |
| | | temperingGlassInfo1.setState(-1); |
| | | }else{ |
| | | temperingGlassInfo1.setState(-2); |
| | | } |
| | | temperingGlassInfoMapper.insert(temperingGlassInfo1); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class BigStorageCageServiceImpl extends ServiceImpl<BigStorageCageMapper, BigStorageCage> implements BigStorageCageService { |
| | | public class BigStorageCageServiceImpl extends MPJBaseServiceImpl<BigStorageCageMapper, BigStorageCage> implements BigStorageCageService { |
| | | @Resource |
| | | private BigStorageCageMapper bigStorageCageMapper; |
| | | |
| | |
| | | //进片逻辑 |
| | | @Override |
| | | public BigStorageCageDetails feedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails) { |
| | | |
| | | LambdaQueryWrapper<BigStorageCageDetails> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .eq(BigStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence() - 1); |
| | | BigStorageCageDetails layoutSlotInfo; |
| | | layoutSlotInfo= bigStorageCageDetailsMapper.selectOne(wrapper); |
| | | log.info("1、查询理片笼内片序-1等于当前玻璃片序的玻璃"+layoutSlotInfo); |
| | | BeanUtils.copyProperties(glassInfo, bigStorageCageDetails); |
| | | //玻璃不钢化时 |
| | | if(glassInfo.getTemperingLayoutId()==null){ |
| | | |
| | | log.info("2、查询理片笼内片序-1等于当前玻璃片序的玻璃的结果不为空时"+layoutSlotInfo.getSlot()); |
| | | if (layoutSlotInfo.getSlot() != null&&selectWidthSufficient(layoutSlotInfo,bigStorageCageDetails.getWidth())) { |
| | | bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot()); |
| | | } else { |
| | | log.info("3、查询理片笼内片序-1等于当前玻璃片序的玻璃的结果为空时获取当前玻璃版图id是否存在理片笼内"); |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | bigStorageCageDetailslambdaQueryWrapper |
| | | .select(BigStorageCageDetails::getTemperingLayoutId); |
| | | layoutSlotInfo = bigStorageCageDetailsMapper.selectOne(bigStorageCageDetailslambdaQueryWrapper); |
| | | BigStorageCage bigStorageCage=baseMapper.selectJoinOne(BigStorageCage.class, new MPJLambdaWrapper<BigStorageCage>() |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, on -> on |
| | | .eq(BigStorageCage::getDeviceId, BigStorageCageDetails::getDeviceId) |
| | | .eq(BigStorageCage::getSlot, BigStorageCageDetails::getSlot)) |
| | | .isNull(BigStorageCageDetails::getTemperingLayoutId) |
| | | .gt(BigStorageCage::getRemainWidth, 2000) |
| | | .orderByAsc(BigStorageCage::getDeviceId, BigStorageCage::getSlot) |
| | | .last("limit 1") |
| | | ); |
| | | |
| | | if(layoutSlotInfo != null&&selectWidthSufficient(layoutSlotInfo,bigStorageCageDetails.getWidth())){ |
| | | log.info("4、获取笼子内适合的格子"); |
| | | BigStorageCage bigStorageCage=bigStorageCageSlot(layoutSlotInfo.getDeviceId()); |
| | | if(bigStorageCage.getSlot()!=null){ |
| | | bigStorageCageDetails.setSlot(bigStorageCage.getSlot()); |
| | | }else{ |
| | | log.info("5、获取每个笼子版图id的个数"); |
| | | QueryWrapper<BigStorageCageDetails> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("a.device_id", "COUNT(DISTINCT b.tempering_layout_id) AS layoutCount") |
| | | .groupBy("a.device_id") |
| | | .apply("LEFT JOIN (SELECT device_id, tempering_layout_id FROM big_storage_cage_details) b ON a.device_id = b.device_id AND a.slot = b.slot") |
| | | .orderByAsc("layoutCount") |
| | | .orderByAsc("a.device_id"); |
| | | List<Map<String, Object>> bigStorageCageDetailsCount= bigStorageCageDetailsMapper.selectMaps(queryWrapper); |
| | | bigStorageCageDetails.setDeviceId(bigStorageCage.getDeviceId()); |
| | | } |
| | | }else{ |
| | | //玻璃钢化时 |
| | | BigStorageCage bigStorageCage=new BigStorageCage(); |
| | | |
| | | log.info("5、查询笼子内是否有合适的格子"); |
| | | boolean found=false; |
| | | for (Map<String, Object> map : bigStorageCageDetailsCount) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | int deviceId = Integer.parseInt(entry.getKey()); |
| | | BigStorageCage bigStorageCage=bigStorageCageSlot(deviceId); |
| | | if(bigStorageCage!=null){ |
| | | bigStorageCageDetails.setSlot(bigStorageCage.getSlot()); |
| | | found=true; |
| | | bigStorageCage=baseMapper.selectJoinOne(BigStorageCage.class, new MPJLambdaWrapper<BigStorageCage>() |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, on -> on |
| | | .eq(BigStorageCage::getDeviceId, BigStorageCageDetails::getDeviceId) |
| | | .eq(BigStorageCage::getSlot, BigStorageCageDetails::getSlot)) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .eq(BigStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence() - 1) |
| | | .gt(BigStorageCage::getRemainWidth, glassInfo.getWidth()) |
| | | ); |
| | | log.info("1、查询理片笼内片序-1等于当前玻璃片序的玻璃"+bigStorageCage); |
| | | |
| | | log.info("2、查询理片笼内片序-1等于当前玻璃片序的玻璃的结果不为空时"+bigStorageCage.getSlot()); |
| | | if (bigStorageCage.getSlot() != null) { |
| | | bigStorageCageDetails.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageCageDetails.setDeviceId(bigStorageCage.getDeviceId()); |
| | | } else { |
| | | log.info("3、查询理片笼内片序-1等于当前玻璃片序的玻璃的结果为空时获取当前玻璃版图id是否存在理片笼内"); |
| | | |
| | | bigStorageCage=baseMapper.selectJoinOne(BigStorageCage.class, new MPJLambdaWrapper<BigStorageCage>() |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, on -> on |
| | | .eq(BigStorageCage::getDeviceId, BigStorageCageDetails::getDeviceId) |
| | | .eq(BigStorageCage::getSlot, BigStorageCageDetails::getSlot)) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .gt(BigStorageCage::getRemainWidth, glassInfo.getWidth()) |
| | | ); |
| | | |
| | | if(bigStorageCage != null){ |
| | | log.info("4、获取笼子内适合的格子"); |
| | | BigStorageCage bigStorageCages=bigStorageCageSlot(bigStorageCage.getDeviceId()); |
| | | bigStorageCageDetails.setSlot(bigStorageCages.getSlot()); |
| | | bigStorageCageDetails.setDeviceId(bigStorageCages.getDeviceId()); |
| | | }else{ |
| | | log.info("5、获取每个笼子版图id的个数"); |
| | | QueryWrapper<BigStorageCageDetails> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.select("a.device_id", "COUNT(DISTINCT b.tempering_layout_id) AS layoutCount") |
| | | .groupBy("a.device_id") |
| | | .apply("LEFT JOIN (SELECT device_id, tempering_layout_id FROM big_storage_cage_details) b ON a.device_id = b.device_id AND a.slot = b.slot") |
| | | .orderByAsc("layoutCount") |
| | | .orderByAsc("a.device_id"); |
| | | List<Map<String, Object>> bigStorageCageDetailsCount= bigStorageCageDetailsMapper.selectMaps(queryWrapper); |
| | | |
| | | log.info("5、查询笼子内是否有合适的格子"); |
| | | boolean found=false; |
| | | for (Map<String, Object> map : bigStorageCageDetailsCount) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | int deviceId = Integer.parseInt(entry.getKey()); |
| | | BigStorageCage bigStorageCages=bigStorageCageSlot(deviceId); |
| | | if(bigStorageCage!=null){ |
| | | bigStorageCageDetails.setSlot(bigStorageCages.getSlot()); |
| | | bigStorageCageDetails.setDeviceId(deviceId); |
| | | found=true; |
| | | break; |
| | | } |
| | | } |
| | | if(found){ |
| | | break; |
| | | } |
| | | } |
| | | if(found){ |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (bigStorageCageDetails.getSlot() != null) { |
| | | log.info("6、当找到合适的格子时添加玻璃到笼子表"); |
| | |
| | | return true; |
| | | }else{ |
| | | log.info("3、没有可出的玻璃时获取是否有小片到齐的版图"); |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | bigStorageCageDetailslambdaQueryWrapper |
| | | .select(BigStorageCageDetails::getTemperingLayoutId) |
| | | .groupBy(BigStorageCageDetails::getTemperingLayoutId); |
| | | List<Map<String, Object>> temperingLayoutIdList = bigStorageCageDetailsMapper.selectMaps(bigStorageCageDetailslambdaQueryWrapper); |
| | | for (Map<String, Object> map : temperingLayoutIdList) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String layoutId = entry.getKey().substring(0, entry.getKey().indexOf('-')); |
| | | String layoutNum = entry.getKey().substring(entry.getKey().indexOf('-') + 1); |
| | | if (layoutNum.equals(entry.getValue())) { |
| | | log.info("4、添加此钢化版图id所有小片小片到钢化小片表"); |
| | | |
| | | QueryWrapper<BigStorageCageDetails> wrapper = Wrappers.query(); |
| | | wrapper.select("tempering_layout_id", "count(tempering_layout_id)") |
| | | .groupBy("tempering_layout_id"); |
| | | List<Map<String, Object>> temperingLayoutIdList = bigStorageCageDetailsMapper.selectMaps(wrapper); |
| | | |
| | | boolean key=false; |
| | | for (Map<String, Object> row : temperingLayoutIdList) { |
| | | for (Map.Entry<String, Object> entry : row.entrySet()) { |
| | | String temperingId = entry.getKey(); |
| | | Object temperingNo = entry.getValue(); |
| | | |
| | | LambdaQueryWrapper<GlassInfo> glassInfoWrapper=new LambdaQueryWrapper<>(); |
| | | glassInfoWrapper.select(GlassInfo::getTemperingLayoutId) |
| | | glassInfoWrapper.eq(GlassInfo::getTemperingLayoutId,temperingId) |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence); |
| | | List<GlassInfo> glassInfoList= glassInfoService.list(glassInfoWrapper); |
| | | for (GlassInfo glassInfo:glassInfoList |
| | | ) { |
| | | TemperingGlassInfo temperingGlassInfo=new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(glassInfo, temperingGlassInfo); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | if(glassInfoList.size()==Integer.parseInt(temperingNo.toString())){ |
| | | for (GlassInfo glassInfo:glassInfoList |
| | | ) { |
| | | |
| | | TemperingGlassInfo temperingGlassInfo=new TemperingGlassInfo(); |
| | | BeanUtils.copyProperties(glassInfo, temperingGlassInfo); |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | |
| | | } |
| | | key=true; |
| | | } |
| | | if(key){ |
| | | return false; |
| | | } |
| | | } |
| | |
| | | //查询大理片信息,前端展示用 |
| | | @Override |
| | | public List<BigStorageCage> querybigStorageCageDetail(int deviceId) { |
| | | LambdaQueryWrapper<BigStorageCage> bigStorageCageWrapper =new LambdaQueryWrapper<>(); |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailsWrapper =new LambdaQueryWrapper<>(); |
| | | if(deviceId!=0){ |
| | | bigStorageCageWrapper.eq(BigStorageCage::getDeviceId,deviceId); |
| | | bigStorageCageDetailsWrapper.eq(BigStorageCageDetails::getDeviceId,deviceId); |
| | | } |
| | | |
| | | LambdaQueryWrapper<BigStorageCage> BigStorageCageWrapper =new LambdaQueryWrapper<>(); |
| | | BigStorageCageWrapper.eq(BigStorageCage::getSlot,deviceId); |
| | | |
| | | LambdaQueryWrapper<BigStorageCageDetails> BigStorageCageDetailsWrapper =new LambdaQueryWrapper<>(); |
| | | BigStorageCageDetailsWrapper.eq(BigStorageCageDetails::getSlot,deviceId); |
| | | |
| | | List<BigStorageCage> bigStorageCages = bigStorageCageMapper.selectList(BigStorageCageWrapper); |
| | | List<BigStorageCage> bigStorageCages = bigStorageCageMapper.selectList(bigStorageCageWrapper); |
| | | log.info("1、获取大理片笼信息完成,获取到的数据{}", bigStorageCages.size()); |
| | | |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsMapper.selectList(BigStorageCageDetailsWrapper); |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsMapper.selectList(bigStorageCageDetailsWrapper); |
| | | |
| | | Map<Integer, List<BigStorageCageDetails>> listMap = bigStorageCageDetailsList.stream().collect(Collectors.groupingBy(BigStorageCageDetails::getSlot)); |
| | | for (BigStorageCage bigStorageCage : bigStorageCages) { |
| | |
| | | @Override |
| | | public List<Map<String, Object>> selectBigStorageCageUsage() { |
| | | QueryWrapper<BigStorageCage> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("device_id") |
| | | .select("ROUND(1 - SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) / COUNT(device_id), 2) AS percentage") |
| | | .select("COUNT(device_id) - SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) AS count") |
| | | wrapper.select("device_id,ROUND(1 - SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) / COUNT(device_id), 2) AS percentage,COUNT(device_id) - SUM(CASE WHEN remain_width = 5000 THEN 1 ELSE 0 END) AS count") |
| | | |
| | | .groupBy("device_id"); |
| | | List<Map<String, Object>> bigStorageCageUsages=baseMapper.selectMaps(wrapper); |
| | | |
| | | return bigStorageCageUsages; |
| | | } |
| | | |
| | | //判断笼子剩余宽度是否足够 |
| | | //笼子的启用/禁用 |
| | | @Override |
| | | public boolean selectWidthSufficient(BigStorageCageDetails layoutSlotInfo,double width) { |
| | | LambdaQueryWrapper<BigStorageCage> BigStorageCageWrapper = new LambdaQueryWrapper<>(); |
| | | BigStorageCageWrapper.eq(BigStorageCage::getSlot,layoutSlotInfo.getSlot()); |
| | | BigStorageCage bigStorageCage=baseMapper.selectOne(BigStorageCageWrapper); |
| | | if(bigStorageCage.getRemainWidth()>width){ |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | public void updateStorageCageDisabled(int slot,int enableState){ |
| | | BigStorageCage bigStorageCage=new BigStorageCage(); |
| | | bigStorageCage.setEnableState(enableState); |
| | | LambdaQueryWrapper<BigStorageCage> bigStorageCageWrapper = new LambdaQueryWrapper<>(); |
| | | bigStorageCageWrapper.eq(BigStorageCage::getSlot,slot); |
| | | baseMapper.update(bigStorageCage,bigStorageCageWrapper); |
| | | } |
| | | } |
| | |
| | | |
| | | @Autowired |
| | | private BigStorageCageFeedTaskService bigStorageCageFeedTaskService; |
| | | @ApiOperation("进片任务信息") |
| | | @GetMapping("/querybigStorageCageTask") |
| | | public List<BigStorageCageFeedTask> querybigStorageCageFeedTask(int taskState) { |
| | | return bigStorageCageFeedTaskService.querybigStorageCageFeedTask(taskState); |
| | | } |
| | | // @ApiOperation("进片任务信息") |
| | | // @GetMapping("/querybigStorageCageFeedTask") |
| | | // public List<BigStorageCageFeedTask> querybigStorageCageFeedTask(int taskState) { |
| | | // return bigStorageCageFeedTaskService.querybigStorageCageFeedTask(taskState); |
| | | // } |
| | | } |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private BigStorageCageOutTaskService bigStorageCageOutTaskService; |
| | | @ApiOperation("进片任务信息") |
| | | @GetMapping("/querybigStorageCageTask") |
| | | public List<BigStorageCageOutTask> querybigStorageCageOutTask(int taskState) { |
| | | return bigStorageCageOutTaskService.querybigStorageCageOutTask(taskState); |
| | | } |
| | | // @ApiOperation("出片任务信息") |
| | | // @GetMapping("/querybigStorageCageOutTask") |
| | | // public List<BigStorageCageOutTask> querybigStorageCageOutTask(int taskState) { |
| | | // return bigStorageCageOutTaskService.querybigStorageCageOutTask(taskState); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @ApiModel(description = "<p> </p>") |
| | | @ApiModel(description = "<p> 理片进笼任务 </p>") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCageFeedTask implements Serializable { |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-16 |
| | | */ |
| | | @ApiModel(description = "<p> </p>") |
| | | @ApiModel(description = "<p> 理片出笼任务 </p>") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | public class BigStorageCageOutTask implements Serializable { |
| | |
| | | package com.mes.edgglasstask.entity; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import net.sf.jsqlparser.expression.DateTimeLiteralExpression; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | @ApiModelProperty(value = "线路", position = 8) |
| | | private Integer line; |
| | | |
| | | /** |
| | | * 线路 |
| | | */ |
| | | @ApiModelProperty(value = "时间", position = 9) |
| | | private DateTime time; |
| | | |
| | | } |
| | |
| | | */ |
| | | public interface EdgGlassTaskInfoService extends IService<EdgGlassTaskInfo> { |
| | | |
| | | int judgeTasktype(String plcFeedReqLine); |
| | | |
| | | int startTask(); |
| | | } |
| | |
| | | package com.mes.edgglasstask.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.edgglasstask.entity.EdgGlassTaskInfo; |
| | | import com.mes.edgglasstask.mapper.EdgGlassTaskInfoMapper; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class EdgGlassTaskInfoServiceImpl extends ServiceImpl<EdgGlassTaskInfoMapper, EdgGlassTaskInfo> implements EdgGlassTaskInfoService { |
| | | |
| | | @Resource |
| | | BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Override |
| | | public int judgeTasktype(String plcFeedReqLine){ |
| | | LambdaQueryWrapper<EdgGlassTaskInfo> edgGlassTaskInfoWrapper=new LambdaQueryWrapper<>(); |
| | | edgGlassTaskInfoWrapper |
| | | .eq(EdgGlassTaskInfo::getLine,plcFeedReqLine) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | EdgGlassTaskInfo edgGlassTaskInfo=baseMapper.selectOne(edgGlassTaskInfoWrapper); |
| | | double width=bigStorageCageDetailsService.selectGetBoard(plcFeedReqLine); |
| | | if(edgGlassTaskInfo.getWidth()<width){ |
| | | return 0; |
| | | }else{ |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public int startTask(){ |
| | | |
| | | double line1Width=bigStorageCageDetailsService.selectGetBoard("1"); |
| | | double line2Width=bigStorageCageDetailsService.selectGetBoard("2"); |
| | | |
| | | LambdaQueryWrapper<EdgGlassTaskInfo> edgGlassTaskInfoWrapper=new LambdaQueryWrapper<>(); |
| | | edgGlassTaskInfoWrapper |
| | | .eq(EdgGlassTaskInfo::getLine,1) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | List<EdgGlassTaskInfo> edgGlassTaskInfoList1=baseMapper.selectList(edgGlassTaskInfoWrapper); |
| | | int i=0; |
| | | for (EdgGlassTaskInfo edgGlassTaskInfo:edgGlassTaskInfoList1 |
| | | ) { |
| | | if(edgGlassTaskInfo.getWidth()<line1Width){ |
| | | i+=1; |
| | | line1Width-=edgGlassTaskInfo.getWidth()+20; |
| | | } |
| | | } |
| | | if(i==2){ |
| | | return 2; |
| | | } |
| | | |
| | | edgGlassTaskInfoWrapper |
| | | .eq(EdgGlassTaskInfo::getLine,2) |
| | | .orderByDesc(EdgGlassTaskInfo::getTime); |
| | | List<EdgGlassTaskInfo> edgGlassTaskInfoList2=baseMapper.selectList(edgGlassTaskInfoWrapper); |
| | | i=0; |
| | | for (EdgGlassTaskInfo edgGlassTaskInfo:edgGlassTaskInfoList2 |
| | | ) { |
| | | if(edgGlassTaskInfo.getWidth()<line2Width){ |
| | | i+=1; |
| | | line2Width-=edgGlassTaskInfo.getWidth()+20; |
| | | } |
| | | } |
| | | if(i==2) { |
| | | return 1; |
| | | }else{ |
| | | return 2; |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public interface TaskCacheService extends IService<TaskCache> { |
| | | |
| | | int judgeTasktype(); |
| | | } |
| | |
| | | @Qualifier("") |
| | | @Service |
| | | public class TaskCacheServiceImpl extends ServiceImpl<TaskCacheMapper, TaskCache> implements TaskCacheService { |
| | | @Resource |
| | | private BigStorageCageFeedTaskMapper bigStorageCageFeedTaskMapper; |
| | | @Override |
| | | public int judgeTasktype(){ |
| | | //判断根据当前卧转立任务与磨边线任务判断是否启动卧转立 |
| | | // for (int i=1;i<=2;i++){ |
| | | // //查询卧转立当前任务 |
| | | // int width=5000; |
| | | // int num=0; |
| | | // List<BigStorageCageFeedTask> bgStorageCageFeedTask =bigStorageCageFeedTaskMapper.(); |
| | | // //查询磨边线当前任务 |
| | | // LambdaQueryWrapper<TaskCache> taskCacheWrapper=new LambdaQueryWrapper<>(); |
| | | // taskCacheWrapper.eq(TaskCache::getTaskStauts,"0"); |
| | | // List<TaskCache> taskCacheList=taskCacheService.list(taskCacheWrapper); |
| | | // //判断当前线路还需要再上几片才能满足小车宽度 |
| | | // for (TaskCache taskCache:taskCacheList |
| | | // ) { |
| | | // if(taskCache.getId().equals("1")){ |
| | | // //进片车宽度减去小片宽度 |
| | | // } |
| | | // } |
| | | // //片数小于等于2时另一条线卧转立启动 |
| | | // log.info("发送卧转立启动信号"); |
| | | // } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageFeedTask; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService; |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import com.mes.common.S7object; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgstoragetask.service.TaskCacheService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.menu.service.SysMenuService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import com.mes.tools.WebSocketServer; |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author SNG-015 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PlcSlicecage { |
| | |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | |
| | | //报警信息 |
| | | jsonObject.append("bigStorageCageFullAlarm", PlcStorageCageTask.bigStorageCageFullAlarm); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home"); |
| | | //理片笼表格信息 |
| | | jsonObject.append("bigStorageCageInfo", bigStorageCageService.querybigStorageCageDetail(0)); |
| | | |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("slicecage"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | |
| | | import com.mes.bigstoragetask.service.BigStorageCageOutTaskService; |
| | | import com.mes.common.S7object; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.edgglasstask.service.EdgGlassTaskInfoService; |
| | | import com.mes.edgstoragetask.service.TaskCacheService; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author SNG-015 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PlcStorageCageTask { |
| | |
| | | @Resource |
| | | private BigStorageCageOutTaskService bigStorageCageOutTaskService; |
| | | @Resource |
| | | private TaskCacheService taskCacheService; |
| | | private EdgGlassTaskInfoService edgGlassTaskInfoService; |
| | | @Resource |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | |
| | | public static boolean bigStorageCageFullAlarm = false; |
| | | |
| | | private int line1Time=0; |
| | | private int line2Time=0; |
| | | |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | |
| | | plcFeedReqLine = "2"; |
| | | plcFeedGlassid=plcParameterObject.getPlcParameter("D04ID1").getValue(); |
| | | } |
| | | line1Time+=1; |
| | | line2Time+=1; |
| | | |
| | | if (!("0".equals(plcFeedReqLine))) { |
| | | log.info("1、Plc进片请求时"); |
| | | BigStorageCageDetails bigStorageCageDetails = new BigStorageCageDetails(); |
| | | GlassInfo glassInfo = glassInfoService.getById(plcFeedGlassid); |
| | | log.info("2、根据玻璃id获取玻璃信息" + glassInfo); |
| | | if(bigStorageCageDetailsService.selectGetBoard(glassInfo,plcFeedReqLine)){ |
| | | if(bigStorageCageDetailsService.selectGetBoard(plcFeedReqLine)>=0){ |
| | | BigStorageCageDetails slotInfo = bigStorageCageService.feedGlass(glassInfo, bigStorageCageDetails); |
| | | if (slotInfo != null) { |
| | | int taskType = taskCacheService.judgeTasktype(); |
| | | int taskType = edgGlassTaskInfoService.judgeTasktype(plcFeedReqLine); |
| | | log.info("3、查询任务表判断当前任务类型为上车等到还是上车启动" + taskType); |
| | | bigStorageCageFeedTaskService.addFeedTask(slotInfo, Integer.parseInt(plcFeedReqLine), taskType); |
| | | log.info("4、添加任务到任务表"); |
| | |
| | | bigStorageCageFeedTaskService.removeById(bigStorageCageFeedTask); |
| | | log.info("7、删除已经完成的进片任务"); |
| | | } |
| | | //启动阈值 |
| | | if(line1Time>=300){ |
| | | if("0".equals(plcParameterObject.getPlcParameter("D05Go").getValue())){ |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("D02Go").getAddress(), 1); |
| | | } |
| | | } |
| | | if(line2Time>=300){ |
| | | if("0".equals(plcParameterObject.getPlcParameter("D02Go").getValue())){ |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("D05Go").getAddress(), 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //查询出片表是否有任务未完成的任务 |
| | | List<BigStorageCageOutTask> bigStorageCageOutTask=bigStorageCageOutTaskService.querybigStorageCageOutTask(0); |
| | | if(bigStorageCageOutTask.size()==0){ |
| | | bigStorageCageService.outGlass(); |
| | | boolean result=bigStorageCageService.outGlass(); |
| | | log.info("8、没有未完成任务时调用出片接口"); |
| | | if (result==false){ |
| | | temperingGlassInfoService.schedulingTask(); |
| | | } |
| | | } |
| | | bigStorageCageOutTaskService.updateOutTask(); |
| | | log.info("9、根据任务表状态修改钢化小片表任务状态"); |
| | | |
| | | //来不及送时直接走 |
| | | String line=Integer.toString(edgGlassTaskInfoService.startTask()); |
| | | |
| | | if(!(line.equals(plcFeedReqLine))){ |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("D02Go").getAddress(), 1); |
| | | }else{ |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("D05Go").getAddress(), 1); |
| | | } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | |
| | | |
| | | |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | |
| | | |
| | | @Autowired |
| | | private TemperingGlassInfoService temperingGlassInfoService; |
| | | @Autowired |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | |
| | | @ApiOperation("钢化小片信息") |
| | | @GetMapping("/queryTemperingGlassInfo") |
| | | public Result queryTemperingGlassInfo() { |
| | | return Result.build(200,"查询成功",temperingGlassInfoService.list()); |
| | | @ApiOperation("出片任务删除") |
| | | @PostMapping("/deleteTemperingGlassInfo") |
| | | public Result deleteTemperingGlassInfo(TemperingGlassInfo temperingGlassInfo) { |
| | | temperingGlassInfoService.removeById(temperingGlassInfo); |
| | | return Result.build(200,"删除成功",1); |
| | | } |
| | | |
| | | @ApiOperation("手动添加出片任务") |
| | | @PostMapping("/insertTemperingGlassInfo") |
| | | public Result insertBigStorageCageDetail(TemperingGlassInfo temperingGlassInfo) { |
| | | temperingGlassInfoService.save(temperingGlassInfo); |
| | | return Result.build(200,"添加成功",1); |
| | | @ApiOperation("出片任务破损") |
| | | @PostMapping("/damageTemperingGlassInfo") |
| | | public Result damageTemperingGlassInfo(TemperingGlassInfo temperingGlassInfo) { |
| | | bigStorageCageDetailsService.damageBigStorageCageDetails(temperingGlassInfo.getGlassId()); |
| | | return Result.build(200,"破损成功",1); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList); |
| | | |
| | | void schedulingTask(); |
| | | } |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | | import com.mes.bigstoragetask.entity.BigStorageCageOutTask; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.service.TemperingGlassInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TemperingGlassInfoServiceImpl extends ServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingGlassInfoService { |
| | | |
| | | @Resource |
| | | private BigStorageCageDetailsMapper bigStorageCageDetailsMapper; |
| | | @Resource |
| | | private BigStorageCageMapper bigStorageCageMapper; |
| | | |
| | | @Override |
| | | public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList) { |
| | | double carWidth=5000; |
| | |
| | | if((carWidth-temperingGlassInfo.getWidth())>0){ |
| | | carWidth-=temperingGlassInfo.getWidth()+gap; |
| | | log.info("2、添加钢化小片表信息到任务表"); |
| | | temperingGlassInfo.setState(0); |
| | | temperingGlassInfo.setState(-1); |
| | | baseMapper.updateById(temperingGlassInfo); |
| | | log.info("3、修改钢化小片表任务状态"); |
| | | BigStorageCageOutTask bigStorageCageOutTask =new BigStorageCageOutTask(); |
| | |
| | | } |
| | | } |
| | | |
| | | //调度 |
| | | @Override |
| | | public void schedulingTask(){ |
| | | QueryWrapper<BigStorageCageDetails> detailsWrapper1 = Wrappers.query(); |
| | | detailsWrapper1.select("tempering_layout_id", "count(distinct slot)") |
| | | .groupBy("tempering_layout_id"); |
| | | List<Map<String, Object>> temperingLayoutIdList = bigStorageCageDetailsMapper.selectMaps(detailsWrapper1); |
| | | |
| | | boolean key=false; |
| | | for (Map<String, Object> row : temperingLayoutIdList) { |
| | | for (Map.Entry<String, Object> entry : row.entrySet()) { |
| | | String temperingId = entry.getKey(); |
| | | int temperingNo = Integer.parseInt(entry.getValue().toString()); |
| | | if(temperingNo>8){ |
| | | QueryWrapper<BigStorageCageDetails> detailsWrapper2 = Wrappers.query(); |
| | | detailsWrapper2.select("tempering_layout_id", "slot") |
| | | .select("max(tempering_feed_sequence) as max_sequence", "min(tempering_feed_sequence) as min_sequence") |
| | | .groupBy("tempering_layout_id", "slot") |
| | | .orderByAsc("tempering_layout_id") |
| | | .orderByDesc("min_sequence"); |
| | | |
| | | List<Map<String, Object>> result = bigStorageCageDetailsMapper.selectMaps(detailsWrapper2); |
| | | for (Map<String, Object> rows : result) { |
| | | // 获取每行的值 |
| | | Object temperingLayoutId = rows.get("tempering_layout_id"); |
| | | int slot = Integer.parseInt(rows.get("slot").toString()); |
| | | int maxSequence = Integer.parseInt(rows.get("max_sequence").toString()); |
| | | int minSequence = Integer.parseInt(rows.get("min_sequence").toString()); |
| | | |
| | | LambdaQueryWrapper<BigStorageCage> bigStorageCageWrapper=new LambdaQueryWrapper<>(); |
| | | bigStorageCageWrapper.eq(BigStorageCage::getSlot,slot); |
| | | BigStorageCage bigStorageCage=bigStorageCageMapper.selectOne(bigStorageCageWrapper); |
| | | Integer remainWidth=5000-bigStorageCage.getRemainWidth(); |
| | | |
| | | BigStorageCage bigStorageCages=bigStorageCageMapper.selectJoinOne(BigStorageCage.class, new MPJLambdaWrapper<BigStorageCage>() |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, on -> on |
| | | .eq(BigStorageCage::getDeviceId, BigStorageCageDetails::getDeviceId) |
| | | .eq(BigStorageCage::getSlot, BigStorageCageDetails::getSlot)) |
| | | .gt(BigStorageCage::getRemainWidth,remainWidth) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId,temperingLayoutId) |
| | | .eq(BigStorageCageDetails::getTemperingFeedSequence,minSequence-1) |
| | | ); |
| | | |
| | | if(bigStorageCages.getSlot()!=null){ |
| | | LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailsWrapper=new LambdaQueryWrapper<>(); |
| | | bigStorageCageDetailsWrapper |
| | | .eq(BigStorageCageDetails::getSlot,slot) |
| | | .orderByDesc(BigStorageCageDetails::getTemperingFeedSequence); |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList=bigStorageCageDetailsMapper.selectList(bigStorageCageDetailsWrapper); |
| | | for (BigStorageCageDetails bigStorageCageDetails:bigStorageCageDetailsList |
| | | ) { |
| | | BigStorageCageOutTask bigStorageCageOutTask=new BigStorageCageOutTask(); |
| | | bigStorageCageOutTask.setTaskState(-3); |
| | | bigStorageCageOutTask.setStartSlot(slot); |
| | | bigStorageCageOutTask.setEndSlot(bigStorageCages.getSlot()); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @ApiOperation("开始/暂停任务/传递工程号和状态,开始是1 暂停是0") |
| | | @PostMapping("/pauseTask") //调用上片任务 |
| | | @PostMapping("/pauseTask") //暂停上片任务 |
| | | @ResponseBody |
| | | public Result <List<UpPattenUsage>> pauseTask(@RequestBody Engineering engineering) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | |
| | | return Result.build(200, engineering.getEngineerId(),glass); |
| | | } |
| | | |
| | | @ApiOperation("暂停") |
| | | @PostMapping("/pause") //暂停上片任务 |
| | | @ResponseBody |
| | | public Result <List<UpPattenUsage>> pause(@RequestBody Engineering engineering) { |
| | | boolean work=engineeringService.changeTask(engineering.getEngineerId(),engineering.getState()); |
| | | List<UpPattenUsage> glass = upPattenUsageService.prioritylist(); |
| | | log.info("StartorStop:{},{}", work,engineering); |
| | | return Result.build(200, engineering.getEngineerId(),glass); |
| | | } |
| | | |
| | | @ApiOperation("开始上片") |
| | | @PostMapping("/changeTask") //调用上片任务 |
| | | @ResponseBody |
| | |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 3000000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | | //获取联机状态 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 30000000) |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport(){ |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | /** |
| | |
| | | @SpringBootApplication |
| | | @EnableSwagger2 |
| | | @EnableDiscoveryClient |
| | | @EnableScheduling |
| | | @MapperScan(basePackages = "com.mes.*.mapper") |
| | | public class TemperingGlassModuleApplication { |
| | | public static void main(String[] args) { |
New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.service.TemperingAgoService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PlcTemperingGlassTask { |
| | | |
| | | @Autowired |
| | | private TemperingAgoService temperingAgoService; |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void loadGlassHome(){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在等待进片的玻璃 |
| | | List<TemperingGlassInfo> waitingGlass = temperingAgoService.selectWaitingGlass(); |
| | | jsonObject.append("waitingGlass", waitingGlass); |
| | | //进炉中的玻璃 |
| | | List<TemperingGlassInfo> intoGlass = temperingAgoService.selectIntoGlass(); |
| | | jsonObject.append("intoGlass", intoGlass); |
| | | //出炉后的玻璃 |
| | | List<TemperingGlassInfo> outGlass = temperingAgoService.selectOutGlass(); |
| | | jsonObject.append("outGlass", outGlass); |
| | | //过旋转台钢化后的玻璃 |
| | | TemperingGlassInfo overGlass = temperingAgoService.selectOverGlass(); |
| | | jsonObject.append("overGlass", overGlass); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("temperingGlass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | TemperingService temperingService; |
| | | @Autowired |
| | | private TemperingOverService temperingOverService; |
| | | @Autowired |
| | | private TemperingAgoService temperingAgoService; |
| | | |
| | | @ApiOperation("查询钢化等片中的版图信息,状态为1的为已到,状态为0的为等待中") |
| | |
| | | @ApiOperation("//钢化后显示出炉的版图信息。") |
| | | @GetMapping("/selectOutGlass") //钢化后显示出炉的版图信息 |
| | | public Result <List<TemperingGlassInfo>> selectOutGlass() { |
| | | List<TemperingGlassInfo> glass = temperingAgoService.SelectOutGlass(); |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectOutGlass(); |
| | | log.info("钢化出炉后的玻璃信息{}",glass); |
| | | return Result.build(200, "", glass); |
| | | } |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | |
| | | * @author zhoush |
| | | * @since 2024-04-07 |
| | | */ |
| | | @DS("salve_hangzhoumes") |
| | | public interface TemperingGlassInfoMapper extends BaseMapper<TemperingGlassInfo>, MPJBaseMapper<TemperingGlassInfo> { |
| | | |
| | | } |
| | |
| | | package com.mes.temperingglass.mapper; |
| | | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @DS("salve_hangzhoumes") |
| | | public interface TemperingMapper extends BaseMapper<TemperingGlassInfo> { |
| | | |
| | | |
| | | //查询该玻璃的尺寸和坐标 |
| | | //@Select("select *from glass_info where id=#{glassid};") |
| | | //GlassInfo SelectGlass(String glassid); |
| | | //是否可以发送进炉信号 |
| | | @Select("select count(*) from glass_info where id=#{glassid};") |
| | | int SelectTempering(String glassid); |
| | | |
| | | //查询等待中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,count(state)state from tempering_glass_info GROUP BY flowcard_id,state)b on a.flowcard_id=b.flowcard_id where b.state=2") |
| | | List<TemperingGlassInfo> SelectWaitingGlass(); |
| | | |
| | | //查询进炉中的钢化版图玻璃信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=1)b on a.flowcard_id=b.flowcard_id where b.state1=1") |
| | | List<TemperingGlassInfo> SelectInGlass(); |
| | | |
| | | //查询钢化后的钢化版图信息 |
| | | @Select("select*from tempering_glass_info a left join (select flowcard_id,min(state)state1 from tempering_glass_info GROUP BY flowcard_id having state1=2)b on a.flowcard_id=b.flowcard_id where b.state1=2") |
| | | List<TemperingGlassInfo> SelectOutGlass(); |
| | | |
| | | |
| | | } |
| | |
| | | package com.mes.temperingglass.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import java.util.List; |
| | |
| | | |
| | | List<TemperingGlassInfo> selectIntoGlass(); |
| | | |
| | | List<TemperingGlassInfo> SelectOutGlass(); |
| | | List<TemperingGlassInfo> selectOutGlass(); |
| | | |
| | | TemperingGlassInfo selectOverGlass(); |
| | | } |
| | |
| | | package com.mes.temperingglass.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.temperingglass.mapper.TemperingGlassInfoMapper; |
| | | import com.mes.temperingglass.mapper.TemperingMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @since 2024-04-07 |
| | | */ |
| | | @Service |
| | | @DS("salve_hangzhoumes") |
| | | public class TemperingAgoServiceImpl extends MPJBaseServiceImpl<TemperingGlassInfoMapper, TemperingGlassInfo> implements TemperingAgoService { |
| | | @Autowired |
| | | TemperingMapper temperingMapper; |
| | |
| | | public List<TemperingGlassInfo> selectWaitingGlass() { |
| | | //获取等待进炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.inSql("flowcard_id", "select flowcard_id from tempering_glass_info GROUP BY flowcard_id,state having count(state) = 2"); |
| | | //wrapper.eq("state",1); |
| | | wrapper.in("state",1,0); |
| | | return temperingMapper.selectList(wrapper); |
| | | } |
| | | |
| | |
| | | public List<TemperingGlassInfo> selectIntoGlass() { |
| | | //获取进炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wrapper = new QueryWrapper<>(); |
| | | wrapper.inSql("flowcard_id", "select flowcard_id from tempering_glass_info where state=1 GROUP BY flowcard_id,state having count(state) = 1"); |
| | | |
| | | wrapper.eq("state",2) |
| | | .orderByAsc("tempering_layout_id","tempering_feed_sequence"); |
| | | return temperingMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<TemperingGlassInfo> SelectOutGlass() { |
| | | public List<TemperingGlassInfo> selectOutGlass() { |
| | | //获取出炉中的玻璃信息 |
| | | QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>(); |
| | | wapper.eq("state", 3); |
| | | wapper.eq("state", 3) |
| | | .orderByAsc("tempering_layout_id","tempering_feed_sequence"); |
| | | return temperingMapper.selectList(wapper); |
| | | } |
| | | |
| | | @Override |
| | | public TemperingGlassInfo selectOverGlass() { |
| | | //获取过旋转台的玻璃 |
| | | QueryWrapper<TemperingGlassInfo> wapper = new QueryWrapper<>(); |
| | | wapper.select("top 1 *").eq("state", 4) |
| | | .orderByAsc("tempering_layout_id") |
| | | .orderByDesc("tempering_feed_sequence"); |
| | | return temperingMapper.selectOne(wapper); |
| | | } |
| | | } |
| | |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | |
| | | username: root |
| | | password: root |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://127.0.0.1:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | |
| | | salve_hangzhoumes: |
| | | url: jdbc:sqlserver://10.153.19.150:1433;databasename=hangzhoumes |
| | | username: sa |
| | | password: beibo.123/ |
| | | driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | @SpringBootTest(classes = TemperingGlassModuleApplication.class) |
| | | public class TemperingApplicationTest { |
| | | |
| | | @Resource |
| | | private OptimizeProjectMapper optimizeProjectMapper; |
| | | @Autowired |
| | | private TemperingAgoService temperingAgoService; |
| | | @Autowired |
| | | private GlassInfoService glassInfoService; |
| | | |
| | | |
| | | @Test |
| | |
| | | } |
| | | @Test |
| | | public void testFindPa2() { |
| | | List<TemperingGlassInfo> glass = temperingAgoService.SelectOutGlass(); |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectOutGlass(); |
| | | log.info("已出中的玻璃:{}", Arrays.asList(glass)); |
| | | } |
| | | |
| | |
| | | List<TemperingGlassInfo> glass = temperingAgoService.selectWaitingGlass(); |
| | | log.info("等待中的玻璃:{}", Arrays.asList(glass)); |
| | | } |
| | | @Test |
| | | public void testFindPa4() { |
| | | TemperingGlassInfo glass = temperingAgoService.selectOverGlass(); |
| | | log.info("等待中的玻璃:{}", Arrays.asList(glass)); |
| | | } |
| | | } |
| | |
| | | private DownStorageCageDetailsService downStorageCageDetailsService; |
| | | @Autowired |
| | | private DownStorageCageService downStorageCageService; |
| | | |
| | | @ApiOperation("添加玻璃") |
| | | @PostMapping("/add") |
| | | public String addDownStorageCageDetails(@RequestBody DownStorageCageDetails details) { |
| | | downStorageCageDetailsService.addDownStorageCageDetails(details); |
| | |
| | | @ResponseBody |
| | | public Result updateDownStorageCage(@RequestBody DownStorageCage downStorageCage) { |
| | | boolean isSucess=downStorageCageService.updateDownStorageCage(downStorageCage); |
| | | return Result.build(200,"更换成功",1); |
| | | return Result.build(200,"更换成功",isSucess); |
| | | } |
| | | @ApiOperation("删除缓存理片笼信息 功能:对笼内栅格玻璃进行【清除】") |
| | | @PostMapping("/deleteDownStorageCage") |
| | |
| | | }else{ |
| | | |
| | | log.info("4、如果不属于版图id和片序的顺序执行进片任务"); |
| | | |
| | | |
| | | //添加进片任务 查找空格 |
| | | List<DownStorageCageDetails> list = downStorageCageService.selectCacheEmpty(); |
| | | if(list.size()>0){ |
| | |
| | | package com.mes.job;
|
| | |
|
| | | import cn.hutool.json.JSONObject;
|
| | | import com.mes.downstorage.service.DownStorageCageService;
|
| | | import com.mes.downworkstation.entity.DownWorkstation;
|
| | | import com.mes.downworkstation.service.DownWorkstationService;
|
| | | import com.mes.tools.WebSocketServer;
|
| | |
| | | @Component
|
| | | public class Downpush {
|
| | |
|
| | |
|
| | | @Autowired
|
| | | private DownWorkstationService downWorkstationService;
|
| | | @Scheduled(fixedDelay = 1000)
|
| | | public void Downpush() {
|
| | | @Autowired
|
| | | private DownStorageCageService downStorageCageService;
|
| | |
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownWorkstations() {
|
| | | log.info("发送工位玻璃信息");
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | JSONObject jsonObject2 = new JSONObject();
|
| | | JSONObject jsonObject3 = new JSONObject();
|
| | |
|
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6);
|
| | | List<Map<String, Object>> glassinfodata = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
|
| | | List<Map<String, Object>> glassinfodata2 = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
|
| | | jsonObject.append("params",data);
|
| | | jsonObject2.append("glassinfo",glassinfodata);
|
| | | jsonObject3.append("glassinfo2",glassinfodata2);
|
| | | log.info(jsonObject.toString());
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
|
| | | ArrayList<WebSocketServer> sendwServer2 = WebSocketServer.sessionMap.get("unloadglass2");
|
| | | ArrayList<WebSocketServer> sendwServer3 = WebSocketServer.sessionMap.get("unloadglass3");
|
| | | // log.info(sendwServer.toString());
|
| | | if (sendwServer != null) {
|
| | | for (WebSocketServer webserver : sendwServer) {
|
| | |
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | log.info("已发送");
|
| | | webserver.sendMessage(jsonObject.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 1000)
|
| | | public void sendGlassInfoData() {
|
| | | log.info("发送工位显示图信息1");
|
| | | JSONObject jsonObject2 = new JSONObject();
|
| | | List<Map<String, Object>> glassinfodata = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
|
| | | jsonObject2.append("glassinfo",glassinfodata);
|
| | | log.info(jsonObject2.toString());
|
| | | ArrayList<WebSocketServer> sendwServer2 = WebSocketServer.sessionMap.get("unloadglass2");
|
| | | if (sendwServer2 != null) {
|
| | | for (WebSocketServer webserver : sendwServer2) {
|
| | |
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject2.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 1000)
|
| | | public void sendGlassInfoData2() {
|
| | | log.info("发送工位显示图信息2");
|
| | | JSONObject jsonObject3 = new JSONObject();
|
| | | List<Map<String, Object>> glassinfodata2 = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
|
| | | jsonObject3.append("glassinfo2",glassinfodata2);
|
| | | log.info(jsonObject3.toString());
|
| | | ArrayList<WebSocketServer> sendwServer3 = WebSocketServer.sessionMap.get("unloadglass3");
|
| | | if (sendwServer3 != null) {
|
| | | for (WebSocketServer webserver : sendwServer3) {
|
| | |
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject3.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownStorageCages() {
|
| | | log.info("发送缓存玻璃信息");
|
| | | JSONObject jsonObject4 = new JSONObject();
|
| | | List<Map<String, Object>> list=downStorageCageService.selectDownStorageCages();
|
| | | jsonObject4.append("params2",list);
|
| | | log.info(jsonObject4.toString());
|
| | | ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("downcache");
|
| | | if (sendwServer4 != null) {
|
| | | for (WebSocketServer webserver : sendwServer4) {
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject4.toString());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import com.mes.UnLoadGlassApplication; |
| | | import com.mes.downglassinfo.service.impl.DownGlassInfoServiceImpl; |
| | | import com.mes.downglassinfo.service.impl.DownGlassTaskServiceImpl; |
| | | import com.mes.downstorage.entity.DownStorageCage; |
| | | import com.mes.downstorage.entity.DownStorageCageDetails; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downstorage.service.DownStorageCageService; |
| | | import com.mes.downstorage.service.impl.DownStorageCageDetailsServiceImpl; |
| | | import com.mes.downstorage.service.impl.DownStorageCageServiceImpl; |
| | | |
| | | import com.mes.downworkstation.service.DownWorkstationService; |
| | | import com.mes.downworkstation.service.impl.DownWorkstationServiceImpl; |
| | | import com.mes.glassinfo.service.impl.GlassInfoServiceImpl; |
| | | import com.mes.utils.Result; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.test.context.junit4.SpringRunner; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | GlassInfoServiceImpl glassInfoServiceImpl; |
| | | @Autowired |
| | | DownWorkstationService downWorkstationService; |
| | | @Autowired |
| | | DownStorageCageService downStorageCageService; |
| | | |
| | | |
| | | |
| | |
| | | glassInfoServiceImpl.getFlowCardId(); |
| | | } |
| | | |
| | | @Test |
| | | public void updateDownStorageCage() { |
| | | |
| | | |
| | | DownStorageCage downStorageCage= new DownStorageCage(); |
| | | downStorageCage.setEnableState("0"); |
| | | downStorageCage.setId(1); |
| | | downStorageCageService.updateDownStorageCage(downStorageCage); |
| | | |
| | | } |
| | | |
| | | |
| | | } |