Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
| | |
| | | // WebSocketService.js
|
| | |
|
| | | let socket = null;
|
| | | export const initializeWebSocket = (socketUrl, messageHandler) => {
|
| | | let messages='' ;
|
| | |
| | | console.log("Your browser does not support WebSocket");
|
| | | return null;
|
| | | }
|
| | | |
| | | const socket = new WebSocket(socketUrl);
|
| | | |
| | | socket.onopen = function () {
|
| | | console.log("WebSocket is now open");
|
| | | };
|
| | | |
| | | socket.onmessage = (msg) => {
|
| | | if (!msg.data) {
|
| | | return;
|
| | |
| | | if(isLastChunk||msg.data.length<50000) {
|
| | | messages= messages.replace('<END>', '');
|
| | | const obj = JSON.parse(messages);
|
| | | |
| | | messages='';
|
| | | // 调用消息处理函数,将数据传递给 Vue 组件
|
| | | if (messageHandler) {
|
| | | messageHandler(obj);
|
| | | }
|
| | | messages='';
|
| | | }
|
| | | |
| | | |
| | |
|
| | | |
| | | |
| | | };
|
| | | |
| | | return socket;
|
| | | };
|
| | | |
| | |
|
| | | export const closeWebSocket = (socket) => {
|
| | | if (socket && socket.readyState === WebSocket.OPEN) {
|
| | | socket.close();
|
| | |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | tableData.splice(0, tableData.length, ...data.params[0]); |
| | | tableData.value = data.params2[0] |
| | | // tableData.splice(0, tableData.length, ...data.params2[0]); |
| | | // tableData.value = data.params[0] |
| | | // adjustedRects.value = data.EdgStorageCageinfos[0] |
| | | adjustedRects.value = data.params[0].map(rect => ({ |
| | | adjustedRects.value = data.params2[0].map(rect => ({ |
| | | ...rect, // 复制原始对象的其他属性 |
| | | width: rect.width * 0.5 , |
| | | id: rect.id * 10, |
| | |
| | | <template> |
| | | <template> |
| | | <div style="display: flex;"> |
| | | <el-input v-model="inputValue" style="margin-left: 15px;margin-top: 10px;width: 240px" placeholder="请输入工程号" @blur="handleBlur"/> |
| | | <el-pagination |
| | | v-model:current-page="currentPage3" |
| | | v-model:page-size="pageSize3" |
| | | :size="size" |
| | | :disabled="disabled" |
| | | :background="background" |
| | | layout="prev, pager, next, jumper" |
| | | :total="1000" |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | /> |
| | | </div> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 10px;margin-right: 10px;" v-loading="loading"> |
| | | <el-scrollbar height="600px" > |
| | | <el-scrollbar height="550px" > |
| | | <div id="app" style="margin-top: 20px;"> |
| | | <!-- <div |
| | | :style="{ width: `${olWidth}px`, height: `${olHeight}px`,position: 'relative',}" |
| | |
| | | <script setup lang="ts"> |
| | | import { Delete, Upload } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { ref, onMounted, onBeforeUnmount,onUnmounted } from 'vue'; |
| | | import { ref, onMounted, onBeforeUnmount,onUnmounted,watchEffect } from 'vue'; |
| | | import request from "@/utils/request" |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | |
| | | const olHeight = ref(); |
| | | const process_id = ref(); // 用于存储process_id的响应式引用 |
| | | const glass_id = ref(); |
| | | // const rects = ref([]); // 用于存储矩形数据的响应式引用 |
| | | const inputValue = ref(''); |
| | | const currentGlassId = ref(null); // 存储当前点击矩形的 glass_id |
| | | const adjustedRects = ref([]); |
| | | // const handleBind = (row) => { |
| | |
| | | console.error(error); |
| | | } |
| | | } |
| | | const handleBlur = async () => { |
| | | if (inputValue.value !== '') { |
| | | try { |
| | | var url="/cacheGlass/taskCache/cutTerritory?current="+inputValue.value; |
| | | const response = await request.post(url) |
| | | if (response.data && response.data.currentCutTerritory) { |
| | | // 假设返回的数据需要调整坐标和尺寸 |
| | | adjustedRects.value = response.data.currentCutTerritory.map(rect => ({ |
| | | ...rect, |
| | | x_axis: 1360 - (rect.x_axis + rect.width) * 0.37, |
| | | y_axis: (rect.y_axis * 100) * 0.003, |
| | | width: (rect.width * 100) * 0.002, |
| | | height: (rect.height * 100) * 0.002, |
| | | widtha: rect.width , |
| | | heighta: rect.height , |
| | | glass_state: rect.glass_state |
| | | })); |
| | | } |
| | | } catch (error) { |
| | | console.error('请求数据失败:', error); |
| | | } |
| | | } |
| | | }; |
| | | // const handleBlur = async () => { |
| | | // if (inputValue.value !=''){ |
| | | // try { |
| | | // var url="/cacheGlass/taskCache/cutTerritory?current="+inputValue.value; |
| | | // const response = await request.post(url) |
| | | // console.log(response.data.length); |
| | | // if (response.code == 200) { |
| | | // adjustedRects.value = response.data |
| | | // ElMessage.success(response.message); |
| | | // } else { |
| | | // ElMessage.error(response.msg); |
| | | // } |
| | | // } |
| | | function getRectColor(state: number): string { |
| | | switch (state) { |
| | | case 0: |
| | |
| | | closeWebSocket(socket); |
| | | } |
| | | }); |
| | | watchEffect(() => { |
| | | if (inputValue.value === '') { |
| | | handleMessage(); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | |
| | | const cell8=ref(true); |
| | | const cell9=ref(true); |
| | | const selectedRow = ref(null); // 存储选中的行数据 |
| | | |
| | | onMounted(async () => { |
| | | try { |
| | | const response = await request.post('/cacheVerticalGlass/bigStorageCageDetails/selectTemperingGlass'); |
| | | if (response.code === 200) { |
| | | tableDatagh.value = response.data |
| | | } else { |
| | | ElMessage.warning(response.msg) |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error fetching rects :', error); |
| | | } |
| | | }); |
| | | |
| | | // 当前页码和每页显示的条数 |
| | | const currentPage = ref(1); |
| | | const itemsPerPage = computed(() => { |
| | |
| | | dialoglea.value = true; // 打开绑定架子对话框 |
| | | fetchFlowCardId(); |
| | | }; |
| | | const handleganghua = () => { |
| | | dialogFormVisiblec.value = true; // 打开绑定架子对话框 |
| | | fetchFlow(); |
| | | }; |
| | | // 钢化查询 |
| | | |
| | | onMounted(async () => { |
| | | try { |
| | | const response = await request.post('/cacheVerticalGlass/bigStorageCageDetails/selectTemperingGlass'); |
| | | if (response.code === 200) { |
| | | tableDatagh.value = response.data |
| | | } else { |
| | | ElMessage.warning(response.msg) |
| | | } |
| | | } catch (error) { |
| | | // console.error('Error fetching rects :', error); |
| | | } |
| | | }); |
| | | const fetchFlow = async () => { |
| | | try { |
| | | const response = await request.post('/cacheVerticalGlass/bigStorageCageDetails/selectTemperingGlass') |
| | | if (response.code == 200) { |
| | | ElMessage.success(response.message); |
| | | tableDatagh.value = response.data |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | } |
| | | catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } |
| | | // 值班信息 |
| | | const fetchFlowCardId = async () => { |
| | | try { |
| | | const response = await request.post('/cacheVerticalGlass/work_assignment/selectWorkAssignment',{ |
| | |
| | | ElMessage.success(response.message); |
| | | tableDatax.value = response.data; |
| | | console.log(tableDatax.value); |
| | | console |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | |
| | | <div style="height: 600px;"> |
| | | <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary" @click="dialogFormVisiblea = true">{{ $t('searchOrder.cageinformation') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('searchOrder.productionqueue') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="warning" @click="dialogFormVisiblec = true">{{ $t('searchOrder.temperingqueries') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="warning" @click="handleganghua">{{ $t('searchOrder.temperingqueries') }}</el-button> |
| | | <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="info" @click="handlezhiban">{{ $t('searchOrder.dutyinformation') }}</el-button> |
| | | <el-switch style="margin-top: 5px;margin-left: 10px;" v-model="ganghua" class="mb-2" :inactive-text="$t('searchOrder.temperedswitch')" @change="handleChange" /> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 5px;" v-loading="loading"> |
| | |
| | | public static final Integer GLASS_STATE_TAKE = 200; |
| | | public static final Integer GLASS_STATE_DAMAGE = 201; |
| | | public static final List<Integer> GLASS_STATE_IN_ALL = Arrays.asList(100, 102, 103, 104); |
| | | public static final List<Integer> GLASS_STATE_IN_ALL_ZERO = Arrays.asList(0, 100, 102, 103, 104); |
| | | |
| | | /** |
| | | * 卧式理片笼详情表玻璃状态 |
| | |
| | | */ |
| | | public static final List<Integer> G06_WORK_STATION = Arrays.asList(1, 2, 3); |
| | | public static final List<Integer> G11_WORK_STATION = Arrays.asList(4, 5, 6); |
| | | public static final List<Integer> G13_WORK_STATION = Arrays.asList(7); |
| | | public static final int G13_WORK_STATION = 7; |
| | | |
| | | /** |
| | | * 启用 1 |
| | |
| | | import com.mes.glassinfo.service.GlassInfoService; |
| | | import com.mes.taskcache.entity.TaskCache; |
| | | import com.mes.taskcache.service.TaskCacheService; |
| | | import com.mes.temperingglass.entity.TemperingGlassInfo; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang.StringUtils; |
| | |
| | | @Value("${mes.min.two.secondLength}") |
| | | private String minTwoSecondLength; |
| | | |
| | | public static String engineerId=""; |
| | | public static String engineerId = ""; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void plcHomeEdgTask() { |
| | |
| | | Date endDate = new Date(); |
| | | log.info("本次任务结束时间:{},共耗时:{}ms", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void temperingIsRun(){ |
| | | public void temperingIsRun() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<TaskCache>taskCaches=taskCacheService.selectTaskCacheIsRun(); |
| | | List<TaskCache> taskCaches = taskCacheService.selectTaskCacheIsRun(); |
| | | jsonObject.append("taskCaches", taskCaches); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("isRun"); |
| | | if (sendwServer != null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 进片任务 |
| | | * |
| | |
| | | BeanUtils.copyProperties(one, resultDetails); |
| | | glassInfo = resultDetails; |
| | | } else { |
| | | log.info("获取笼内玻璃和带进片玻璃为空或者不符合磨边尺寸"); |
| | | log.info("获取笼内玻璃和待进片玻璃为空或者不符合磨边尺寸"); |
| | | } |
| | | } else { |
| | | glassInfo = queryMinGlass(list.get(0).getWidth(), list.get(0).getHeight(), glassId); |
| | |
| | | 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 between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length >= " + minOneFirstLength + " and t1.second_length >= " + minOneSecondLength); |
| | | } else { |
| | | 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 >=" + minOneFirstLength + " and t1.second_length>=" + minOneSecondLength + ") "); |
| | | "on t.glass_id = t1.glass_id and (t1.first_length between " + minTwoFirstLength + " and " + firstLength |
| | | + " and t1.second_length between " + minTwoSecondLength + " and " + secondLength + ") "); |
| | | } |
| | | wrapper.last("order by count(t.glass_id) desc limit 2"); |
| | | List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); |
| | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void CacheGlassTasks() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<Map<String, Object>> currentCutTerritorys= edgStorageCageDetailsService.selectCutTerritory(); |
| | | List<Map<String, Object>> currentCutTerritorys = edgStorageCageDetailsService.selectCutTerritory(); |
| | | // List<Map<String, Object>> currentCutTerritorys=new ArrayList<>(); |
| | | // if(engineerId==null||engineerId.isEmpty()){ |
| | | // //识别摆片 当前版图数据 |
| | |
| | | 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; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | public interface BigStorageCageMapper extends MPJBaseMapper<BigStorageCage> { |
| | | |
| | | List<Integer> queryFreeDeviceByUsed(@Param(value = "thickness") double thickness); |
| | | |
| | | List<Integer> queryFreeDeviceByNotUsed(@Param(value = "thickness") double thickness); |
| | | } |
| | |
| | | List<Map<String, Object>> selectBigStorageCageUsage(); |
| | | |
| | | void updateStorageCageDisabled(int slot, int enableState); |
| | | |
| | | List<Integer> queryFreeDeviceByUsed(double thickness); |
| | | |
| | | List<Integer> queryFreeDeviceByNotUsed(double thickness); |
| | | } |
| | |
| | | .selectAll(BigStorageCage.class) |
| | | .leftJoin(BigStorageCageDetails.class, BigStorageCageDetails::getSlot, BigStorageCage::getSlot) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_NEW, Const.GLASS_STATE_IN_ALL) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO) |
| | | .eq(BigStorageCageDetails::getEngineerId, glassInfo.getEngineerId()) |
| | | .eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId()) |
| | | .gt(BigStorageCage::getRemainWidth, Math.max(glassInfo.getWidth(), glassInfo.getHeight())) |
| | |
| | | return bigStorageDTO; |
| | | } |
| | | |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select t.device_id from big_storage_cage t left join big_storage_cage_details t1 on t.slot = t1.slot " + |
| | | " where state in (0,100,102,103,104) and t.max_thickness >= " + glassInfo.getThickness() + " and t.enable_state = 1 " + |
| | | " group by t.device_id " + |
| | | " order by count(DISTINCT t1.tempering_layout_id), count(distinct t1.slot)") |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("按照存笼玻璃格子数占用最少方式获取信息格子为:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 因为子查询排序对主sql无影响,所以先执行子查询获取顺序,然后一次去查询 |
| | | List<Integer> deviceUsedList = bigStorageCageService.queryFreeDeviceByUsed(glassInfo.getThickness()); |
| | | for (Integer item : deviceUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("按照存笼玻璃格子数占用最少方式获取信息格子为:{},玻璃id:{}", bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | } |
| | | |
| | | //获取玻璃的厚度:重新选笼子需要按照笼子可放玻璃厚度进行选择 |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .inSql(BigStorageCage::getDeviceId, |
| | | "select t.device_id from big_storage_cage t left join big_storage_cage_details t1 on t.slot = t1.slot " + |
| | | " where state in (0,100,102,103,104) and t.max_thickness >= " + glassInfo.getThickness() + " and t.enable_state = 1 " + |
| | | " group by t.device_id " + |
| | | " order by count(DISTINCT t1.tempering_layout_id), count(distinct t.slot) - count(distinct t1.slot) desc") |
| | | .last("limit 1")); |
| | | List<Integer> deviceNotUsedList = bigStorageCageService.queryFreeDeviceByNotUsed(glassInfo.getThickness()); |
| | | for (Integer item : deviceNotUsedList) { |
| | | bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON) |
| | | .eq(BigStorageCage::getDeviceId, item) |
| | | .last("limit 1")); |
| | | if (null != bigStorageCage) { |
| | | log.info("按照存笼玻璃格子数剩余最多得方式获取信息版图id:{},格子:{},玻璃id:{}", glassInfo.getTemperingLayoutId(), bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | } |
| | | Assert.isTrue(null != bigStorageCage, "没有空余的笼子存放玻璃"); |
| | | log.info("按照存笼玻璃格子数剩余最多得方式获取信息版图id:{},格子:{},玻璃id:{}", glassInfo.getTemperingLayoutId(), bigStorageCage.getSlot(), glassInfo.getGlassId()); |
| | | bigStorageDTO = new BigStorageDTO(); |
| | | bigStorageDTO.setWidth(bigStorageCage.getRemainWidth()); |
| | | bigStorageDTO.setSlot(bigStorageCage.getSlot()); |
| | | bigStorageDTO.setDeviceId(bigStorageCage.getDeviceId()); |
| | | return bigStorageDTO; |
| | | } |
| | | |
| | |
| | | bigStorageCageWrapper.eq(BigStorageCage::getSlot, slot); |
| | | baseMapper.update(bigStorageCage, bigStorageCageWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> queryFreeDeviceByUsed(double thickness) { |
| | | return baseMapper.queryFreeDeviceByUsed(thickness); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> queryFreeDeviceByNotUsed(double thickness) { |
| | | return baseMapper.queryFreeDeviceByNotUsed(thickness); |
| | | } |
| | | } |
| | |
| | | log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | @Scheduled(fixedDelay = 10000) |
| | | public void plcToHomeEdgOutTask() { |
| | | Date startDate = new Date(); |
| | | log.info("大理片笼空车进片任务开始执行时间:{}", startDate); |
| | |
| | | .orderBy(Boolean.TRUE, sequenceOrder, TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfoList)) { |
| | | log.info("有正在出片的钢化任务"); |
| | | computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | computeOutMoreGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL).orderByDesc(BigStorageCageDetails::getWidth)); |
| | | if (CollectionUtils.isNotEmpty(artificialList)) { |
| | | computeOutGlassInfo(artificialList, Boolean.FALSE, mesToPLCAddress); |
| | | computeOutMoreGlassInfo(artificialList, Boolean.FALSE, mesToPLCAddress); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtils.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | | computeOutGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | computeOutMoreGlassInfo(temperingGlassInfoList, Boolean.TRUE, mesToPLCAddress); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | trainNumber = trainNumber + 1; |
| | | serialNumber = 1; |
| | | maxX = e.getXCoordinate(); |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION, |
| | | bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION, |
| | | e.getWidth() * 10, e.getHeight(), trainNumber, serialNumber++, 1)); |
| | | } |
| | | } else { |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mes.bigstorage.mapper.BigStorageCageMapper"> |
| | | |
| | | |
| | | <select id="queryFreeDeviceByUsed" resultType="java.lang.Integer"> |
| | | SELECT T.DEVICE_ID |
| | | FROM BIG_STORAGE_CAGE T |
| | | LEFT JOIN (SELECT * FROM BIG_STORAGE_CAGE_DETAILS WHERE STATE NOT IN (101, 200, 201)) T1 |
| | | ON T.SLOT = T1.SLOT |
| | | WHERE T.MAX_THICKNESS >= #{thickness} |
| | | AND T.ENABLE_STATE = 1 |
| | | GROUP BY T.DEVICE_ID |
| | | ORDER BY COUNT(DISTINCT T1.TEMPERING_LAYOUT_ID), |
| | | COUNT(DISTINCT T1.SLOT) |
| | | </select> |
| | | |
| | | <select id="queryFreeDeviceByNotUsed" resultType="java.lang.Integer"> |
| | | SELECT T.DEVICE_ID |
| | | FROM BIG_STORAGE_CAGE T |
| | | LEFT JOIN (SELECT * FROM BIG_STORAGE_CAGE_DETAILS WHERE STATE NOT IN (101, 200, 201)) T1 |
| | | ON T.SLOT = T1.SLOT |
| | | WHERE T.MAX_THICKNESS >= #{thickness} |
| | | AND T.ENABLE_STATE = 1 |
| | | GROUP BY T.DEVICE_ID |
| | | ORDER BY COUNT(DISTINCT T1.TEMPERING_LAYOUT_ID), |
| | | COUNT(DISTINCT T.SLOT) - COUNT(DISTINCT T1.SLOT) DESC |
| | | </select> |
| | | </mapper> |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 工位id |
| | | */ |
| | | private Integer workStationId; |
| | | |
| | | /** |
| | | * 工程id |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 流程卡号 |
| | | */ |
| | | private String flowCardId; |
| | |
| | | //生成任务信息 并向plc发送出片任务 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | | BeanUtils.copyProperties(details, glassInfo); |
| | | return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), 3001, 2); |
| | | return downLoadCacheGlassTask.initDownGlassTask(glassInfo, details.getSlot(), Const.G13_WORK_STATION, 2); |
| | | } |
| | | } |
| | |
| | | private Integer deviceId; |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 栅格号 |
| | | */ |
| | | private Integer slot; |
| | |
| | | endCell = workstation.getWorkstationId(); |
| | | } |
| | | //更新落架玻璃数量 |
| | | if (endCell == 7) { |
| | | if (endCell == Const.G13_WORK_STATION) { |
| | | downWorkstationService.update(new UpdateWrapper<DownWorkstation>().eq("flow_card_id", downStorageCageDetails.getFlowCardId()) |
| | | .eq("layer", downStorageCageDetails.getLayer()).setSql("other_number = other_number +1")); |
| | | } else { |
| | |
| | | BeanUtils.copyProperties(downStorageCageDetails, downGlassInfo); |
| | | //落架片序 |
| | | downGlassInfo.setSequence(downGlassInfoService.queryMaxSequence(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer())); |
| | | downGlassInfo.setWorkStationId(endCell); |
| | | downGlassInfoService.save(downGlassInfo); |
| | | //生成任务信息 |
| | | GlassInfo glassInfo = new GlassInfo(); |
| | |
| | | package com.mes.job;
|
| | |
|
| | | import cn.hutool.json.JSONObject;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.mes.downglassinfo.entity.DownGlassInfo;
|
| | | import com.mes.downglassinfo.service.DownGlassInfoService;
|
| | | import com.mes.downstorage.service.DownStorageCageService;
|
| | | import com.mes.downworkstation.entity.DownWorkstation;
|
| | | import com.mes.downworkstation.service.DownWorkstationService;
|
| | | import com.mes.tools.WebSocketServer;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | @Slf4j
|
| | | @Component
|
| | |
| | | private DownWorkstationService downWorkstationService;
|
| | | @Autowired
|
| | | private DownStorageCageService downStorageCageService;
|
| | | @Autowired
|
| | | private DownGlassInfoService downGlassInfoService;
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownWorkstations() {
|
| | | log.info("发送工位玻璃信息");
|
| | | JSONObject jsonObject = new JSONObject();
|
| | |
|
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6);
|
| | | jsonObject.append("params",data);
|
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1, 6);
|
| | | jsonObject.append("params", data);
|
| | | log.info(jsonObject.toString());
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
|
| | | if (sendwServer != null) {
|
| | |
| | | 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");
|
| | | 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());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Scheduled(fixedDelay = 2000)
|
| | | public void sendDownGlassInfo() {
|
| | | log.info("发送当前正在执行工程已落架的玻璃信息");
|
| | | List<DownGlassInfo> downGlassInfos = downGlassInfoService.list(new LambdaQueryWrapper<DownGlassInfo>()
|
| | | .inSql(DownGlassInfo::getEngineerId, "select engineer_id from engineering where state = 1"));
|
| | | Map<Integer, List<DownGlassInfo>> listMap = downGlassInfos.stream().collect(Collectors.groupingBy(DownGlassInfo::getWorkStationId));
|
| | | JSONObject jsonObject4 = new JSONObject();
|
| | | List<Map<String, Object>> list = downStorageCageService.selectDownStorageCages();
|
| | | jsonObject4.append("params", listMap);
|
| | | ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("sendDownGlass");
|
| | | if (sendwServer4 != null) {
|
| | | for (WebSocketServer webserver : sendwServer4) {
|
| | | if (webserver != null&&webserver.session.isOpen()) {
|
| | | if (webserver != null && webserver.session.isOpen()) {
|
| | | webserver.sendMessage(jsonObject4.toString());
|
| | | }
|
| | | }
|
| | |
| | | order by count desc limit 1 |
| | | </select> |
| | | <select id="queryMaxSequence" resultType="java.lang.Integer"> |
| | | SELECT COALESCE(max(sequence) + 1, 0) as sequence |
| | | SELECT COALESCE(max(sequence) + 1, 1) as sequence |
| | | FROM down_glass_info |
| | | WHERE flow_card_id = #{flowCardId} |
| | | AND layer = #{layer} |