Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
# Conflicts:
# hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/common/S7object.java
| | |
| | | <template> |
| | | <div class="glass-rack"> |
| | | <div> |
| | | <div > |
| | | <svg width="500" height="500" xmlns="http://www.w3.org/2000/svg"> |
| | | <g stroke="null" id="Layer_1"> |
| | | <!-- 使用 v-for 循环渲染数据 --> |
| | | <g v-for="(rack, index) in racks" :key="index"> |
| | | <rect |
| | | :x="rack.x" |
| | |
| | | <script setup> |
| | | import Swal from 'sweetalert2' |
| | | import request from "@/utils/request"; |
| | | |
| | | // 初始化数据 |
| | | let racks = [ |
| | | const racks = [ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } }, |
| | | |
| | | { x: 280, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 30, width: 20, fillColor: 'yellow', content: 'NG12345678' } }, |
| | | |
| | | { x: 140, y: 420, height: 60, width: 110, fillColor: '#6a6da9', item: { height: 30, width: 100, fillColor: 'yellow', content: 'NG1234561454' } } |
| | | |
| | | ]; |
| | | |
| | | // 计算元素位置的函数 |
| | | |
| | | const calculateItemXPosition = (rack, item, index) => { |
| | | if (index === 0) { |
| | | if (index === 0 ) { |
| | | return rack.x; |
| | | } else if (index === 1) { |
| | | } else if (index === 1 ) { |
| | | return rack.x + rack.width - item.width; |
| | | } else { |
| | | return rack.x + (rack.width - item.width) / 2; |
| | |
| | | }; |
| | | |
| | | const calculateItemYPosition = (rack, item, index) => { |
| | | if (index === 0) { |
| | | if (index === 0 ) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else if (index === 1) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | |
| | | } |
| | | }; |
| | | |
| | | // 获取数据并更新 racks 数组 |
| | | |
| | | const fetchFlowCardId = async () => { |
| | | try { |
| | | const response = await request.get('unLoadGlass/downWorkStation/getwo'); |
| | | console.log(response) |
| | | if (response.code === 200) { |
| | | console.log(response.data); |
| | | // 遍历响应数据并替换racks数组中的item属性 |
| | | response.data.forEach((itemData, index) => { |
| | | if (index < racks.length) { |
| | | const rack = racks[index]; |
| | | const newItem = { |
| | | content: itemData.item.content, |
| | | fillColor: itemData.item.fillColor, |
| | | width: itemData.item.width / 10000, |
| | | height: itemData.item.height / 10000 |
| | | width: itemData.item.width/10000, |
| | | height: itemData.item.height/10000 |
| | | }; |
| | | // 更新 racks 数组 |
| | | Vue.set(racks, index, { ...rack, item: newItem }); |
| | | rack.item == newItem; |
| | | |
| | | } |
| | | }); |
| | | |
| | | console.log(racks); // 查看更新后的racks数组 |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | |
| | | } |
| | | }; |
| | | |
| | | // 获取数据并更新 racks 数组 |
| | | fetchFlowCardId(); |
| | | fetchFlowCardId() |
| | | // setTimeout(fetchFlowCardId(),1000); |
| | | |
| | | |
| | | // 显示自定义警报 |
| | | |
| | | const showCustomAlert = (content) => { |
| | | var str = "架号 : 111\n" + |
| | | var str="架号 : 111\n" + |
| | | "长 : 111\n" + |
| | | "宽 : 111\n" + |
| | | "厚 : 111\n" + |
| | | "玻璃ID : 111\n" + |
| | | "厚 : 111\n"+ |
| | | "玻璃ID : 111\n"+ |
| | | "膜系 : 111\n"; |
| | | |
| | | Swal.fire({ |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 显示元素信息 |
| | | const showRectInfo = (rectInfo) => { |
| | | const content = rectInfo.item.content; |
| | | showCustomAlert(content); |
| | | }; |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | padding: 10px; |
| | | font-size: 14px; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | :height="rack.item.height" |
| | | :fill="rack.item.fillColor" |
| | | /> |
| | | <text :x="rack.x + rack.width / 2" :y="rack.y - 10" text-anchor="middle">{{ index + 6 }}号工位</text> |
| | | <text :x="rack.x + rack.width / 2" :y="rack.y - 10" text-anchor="middle">{{ index + 4 }}号工位</text> |
| | | <text :x="rack.x + rack.width / 2" :y="rack.y + rack.height + 20" text-anchor="middle">{{ rack.item.content }}</text> |
| | | </g> |
| | | </g> |
| | |
| | | <script setup> |
| | | import Swal from 'sweetalert2' |
| | | |
| | | const racks = [ |
| | | let racks = [ |
| | | { x: 50, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 90, width: 10, fillColor: 'yellow', content: 'NG123456' } }, |
| | | { x: 50, y: 270, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 20, width: 10, fillColor: 'yellow', content: 'NG1234567' } }, |
| | | { x: 280, y: 100, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 30, width: 20, fillColor: 'yellow', content: 'NG12345678' } }, |
| | | { x: 280, y: 270, height: 100, width: 60, fillColor: '#6a6da9', item: { height: 35, width: 23, fillColor: 'yellow', content: 'NG123456910' } }, |
| | | { x: 140, y: 420, height: 60, width: 110, fillColor: '#6a6da9', item: { height: 30, width: 100, fillColor: 'yellow', content: 'NG1234561454' } } |
| | | ]; |
| | | |
| | | // 计算元素位置的函数 |
| | | const calculateItemXPosition = (rack, item, index) => { |
| | | if (index === 0 || index === 1) { |
| | | if (index === 0) { |
| | | return rack.x; |
| | | } else if (index === 2 || index === 3) { |
| | | } else if (index === 1) { |
| | | return rack.x + rack.width - item.width; |
| | | } else { |
| | | return rack.x + (rack.width - item.width) / 2; |
| | |
| | | }; |
| | | |
| | | const calculateItemYPosition = (rack, item, index) => { |
| | | if (index === 0 || index === 1) { |
| | | if (index === 0) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else if (index === 2 || index === 3) { |
| | | } else if (index === 1) { |
| | | return rack.y + (rack.height - item.height) / 2; |
| | | } else { |
| | | return rack.y + rack.height - item.height; |
| | |
| | | import Landingindication from "./Landingindication.vue"; |
| | | import Landingindicationtwo from "./Landingindicationtwo.vue"; |
| | | import request from "@/utils/request"; |
| | | |
| | | const dialogFormVisiblea = ref(false) |
| | | |
| | | |
| | |
| | | if (response.code == 200) { |
| | | // 绑定成功,处理逻辑 |
| | | console.log('绑定成功'); |
| | | |
| | | ElMessage.success(response.message); |
| | | updatePageData(); |
| | | dialogFormVisiblea.value = false; |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | |
| | | }; |
| | | |
| | | |
| | | const updatePageData = () => { |
| | | // 假设你的页面上有一个名为 tableData 的 Vue 组件 |
| | | // 你可以直接更新 tableData 的数据 |
| | | tableData.flowCardId = flowCardId.value; |
| | | |
| | | // 使用 $forceUpdate() 强制更新组件 |
| | | forceUpdate(); |
| | | }; |
| | | |
| | | |
| | | |
| | | const handleBindRack2 = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | |
| | | //开始/暂停任务 |
| | | @Override |
| | | public boolean changeTask(String projectId, Integer state) { |
| | | //使用projectId作为条件修改state字段 |
| | | //暂停正在进行工程 |
| | | LambdaUpdateChainWrapper<Engineering> pauseWrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | pauseWrapper.set(Engineering::getState,0); |
| | | pauseWrapper.eq(Engineering::getState,1); |
| | | pauseWrapper.update(); |
| | | //使用projectId作为条件开始工程 |
| | | LambdaUpdateChainWrapper<Engineering> wrapper = new LambdaUpdateChainWrapper<>(this.getBaseMapper()); |
| | | wrapper.set(Engineering::getState,state); |
| | | wrapper.eq(Engineering::getEngineerId,projectId); |
| | |
| | | .antMatchers("/webjars/**").permitAll() |
| | | .antMatchers("/v2/**").permitAll() |
| | | .antMatchers("/swagger-resources/**").permitAll() |
| | | .antMatchers("/**").permitAll() |
| | | .anyRequest().authenticated() |
| | | |
| | | // 异常处理器 |
| | |
| | | package com.mes.common.filter; |
| | | |
| | | import com.mes.common.utils.JwtUtil; |
| | | import com.mes.common.utils.RedisUtil; |
| | | import com.mes.common.utils.UserInfoUtils; |
| | | import com.mes.userinfo.entity.LoginUser; |
| | | import com.mes.userinfo.service.SysUserService; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.filter.OncePerRequestFilter; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | |
| | | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { |
| | | //获取token |
| | | String token = request.getHeader("token"); |
| | | // |
| | | // if (!StringUtils.hasText(token)) { |
| | | // //放行 |
| | | // filterChain.doFilter(request, response); |
| | | // return; // 此处加上return好处是后面结果返回的时候就不会再走一遍此过滤器的方法了 |
| | | // } |
| | | // //解析token |
| | | // String userid; |
| | | // try { |
| | | // Claims claims = JwtUtil.getClaimByToken(token); |
| | | // userid = claims.getSubject(); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException("token非法"); |
| | | // } |
| | | // //从redis中获取用户信息 |
| | | // String redisKey = "login:" + userid; |
| | | // LoginUser loginUser = redisUtil.getCacheObject(redisKey); |
| | | // if (Objects.isNull(loginUser)) { |
| | | // response.setHeader("token", ""); |
| | | // throw new RuntimeException("用户未登录"); |
| | | // } |
| | | // //将用户信息放入当前线程 |
| | | // UserInfoUtils.set(loginUser.getUser()); |
| | | // //存入SecurityContextHolder,以供后面的过滤器使用 |
| | | // List<String> permissionKeyList = sysUserService.getUserAuthorityInfo(Long.parseLong(userid)); |
| | | // List<GrantedAuthority> authorities = permissionKeyList.stream(). |
| | | // map(SimpleGrantedAuthority::new) |
| | | // .collect(Collectors.toList()); |
| | | // UsernamePasswordAuthenticationToken authenticationToken = |
| | | // new UsernamePasswordAuthenticationToken(loginUser, null, authorities); |
| | | // SecurityContextHolder.getContext().setAuthentication(authenticationToken); |
| | | if (!StringUtils.hasText(token)) { |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | return; // 此处加上return好处是后面结果返回的时候就不会再走一遍此过滤器的方法了 |
| | | } |
| | | //解析token |
| | | String userid; |
| | | try { |
| | | Claims claims = JwtUtil.getClaimByToken(token); |
| | | userid = claims.getSubject(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("token非法"); |
| | | } |
| | | //从redis中获取用户信息 |
| | | String redisKey = "login:" + userid; |
| | | LoginUser loginUser = redisUtil.getCacheObject(redisKey); |
| | | if (Objects.isNull(loginUser)) { |
| | | response.setHeader("token", ""); |
| | | throw new RuntimeException("用户未登录"); |
| | | } |
| | | //将用户信息放入当前线程 |
| | | UserInfoUtils.set(loginUser.getUser()); |
| | | //存入SecurityContextHolder,以供后面的过滤器使用 |
| | | List<String> permissionKeyList = sysUserService.getUserAuthorityInfo(Long.parseLong(userid)); |
| | | List<GrantedAuthority> authorities = permissionKeyList.stream(). |
| | | map(SimpleGrantedAuthority::new) |
| | | .collect(Collectors.toList()); |
| | | UsernamePasswordAuthenticationToken authenticationToken = |
| | | new UsernamePasswordAuthenticationToken(loginUser, null, authorities); |
| | | SecurityContextHolder.getContext().setAuthentication(authenticationToken); |
| | | //放行 |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | } |
| | | } |
| | |
| | | log.info("2、进片和出片都空闲,执行出片任务"); |
| | | //加笼子里面是否有玻璃,有先出,无玻璃先进 |
| | | int count = edgStorageCageDetailsService.count(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getState, Const.GLASS_STATE_IN)); |
| | | if ("0".equals(out08Glassstate) && "0".equals(out10Glassstate) && count < 9) { |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } else { |
| | | if (("1".equals(out08Glassstate) || "1".equals(out10Glassstate)) && count > 0) { |
| | | boolean outFlase = outTo(Integer.parseInt(out08Glassstate), |
| | | Integer.parseInt(out10Glassstate), confirmationWrodAddress); |
| | | log.info("出片任务是否完成:{},失败且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue); |
| | | if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) { |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } |
| | | } else { |
| | | inTo(glassIdeValue, confirmationWrodAddress, currentSlot); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.mes.common; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.tools.InitUtil; |
| | | import com.mes.tools.S7control; |
| | | |
| | | |
| | | |
| | | |
| | | public class S7object { |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | public class S7object extends Thread { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private EPlcType plcType = EPlcType.S1200; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | |
| | | public PlcParameterObject PlcMesObject; |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | |
| | | String PlcLoadGlass=S7object.class.getResource("/JsonFile/PlcLoadGlass.json").getPath(); |
| | | //log.info(PLCAutoMes.class.getResource("").getPath()); |
| | | PlcMesObject = InitUtil.initword(PlcLoadGlass); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(100); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | byte[] getplcvlues= plccontrol.ReadByte(PlcMesObject.getPlcAddressBegin(),PlcMesObject.getPlcAddressLength()); |
| | | PlcMesObject.setPlcParameterList(getplcvlues); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, workId); |
| | | |
| | | } |
| | | } |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | | if (loadStatus != null) { |
| | | log.info(loadStatus); |
| | | if ("1".equals(loadStatus)) { |
| | | log.info("收到汇报任务完成"); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | } else if ("2".equals(loadStatus)) { |
| | | log.info("收到汇报未完成任务"); |
| | | //减少工位数量,恢复任务状态 |
| | | overTask(loadStatus,0); |
| | | } else if ("3".equals(loadStatus)) { |
| | | log.info("收到汇报玻璃破损"); |
| | | overTask(loadStatus,0); |
| | | } else if("0".equals(loadStatus)){ |
| | | log.info("收到汇报清0状态"); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus,1); |
| | | } |
| | | }else { |
| | | //请求字为零时,任务字清零 |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlc").getAddress(), 0); |
| | | } |
| | | //执行后休眠300毫秒 |
| | | //Thread.sleep(300); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | public void overTask(String loadStatus,int state) throws InterruptedException { |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask(); |
| | | if (upPattenUsage != null) { |
| | | log.info("收到汇报清{}状态",loadStatus); |
| | | //减少工位数量 |
| | | upWorkstationService.reduceWorkstationNumber(upPattenUsage.getState()); |
| | | //完成上片表状态 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, 100); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0); |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport(){ |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | | if (loadStatus != null) { |
| | | log.info(loadStatus); |
| | | if ("1".equals(loadStatus)) { |
| | | log.info("收到汇报任务完成"); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 1); |
| | | } else if ("2".equals(loadStatus)) { |
| | | log.info("收到汇报未完成任务"); |
| | | //减少工位数量,恢复任务状态 |
| | | overTask(loadStatus,0); |
| | | } else if ("3".equals(loadStatus)) { |
| | | log.info("收到汇报玻璃破损"); |
| | | overTask(loadStatus,0); |
| | | } else if("0".equals(loadStatus)){ |
| | | log.info("收到汇报清0状态"); |
| | | //减少工位数量,完成任务状态 |
| | | overTask(loadStatus,100); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void overTask(String loadStatus, int state) { |
| | | UpPattenUsage upPattenUsage = upPattenUsageService.selectOverTask(); |
| | | if (upPattenUsage != null) { |
| | | log.info("收到汇报清{}状态", loadStatus); |
| | | //减少工位数量 |
| | | upWorkstationService.reduceWorkstationNumber(upPattenUsage.getState()); |
| | | //完成上片表状态 |
| | | upPattenUsageService.updateUpPattenUsageState(upPattenUsage, state); |
| | | S7object.getinstance().plccontrol.writetime(plcParameterObject.getPlcParameter("MesToPlcStatus").getAddress(), 0); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mes.workstation.entity.UpWorkSequence; |
| | | import com.mes.workstation.entity.UpWorkstation; |
| | | import io.lettuce.core.dynamic.annotation.Param; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
New file |
| | |
| | | package com.mes; |
| | | |
| | | import com.mes.common.S7object; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.ApplicationArguments; |
| | | import org.springframework.boot.ApplicationRunner; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author SNG-012 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | @Order(1) |
| | | |
| | | public class AppRunnerConfig implements ApplicationRunner { |
| | | |
| | | |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | log.info("启动完成"); |
| | | S7object.getinstance().start(); |
| | | |
| | | } |
| | | } |
| | |
| | | @Service |
| | | public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { |
| | | |
| | | @Autowired(required=false) |
| | | @Autowired(required = false) |
| | | private DownStorageCageMapper downStorageCageMapper; |
| | | @Autowired |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | |
| | | private GlassInfoMapper glassInfoMapper; |
| | | @Autowired |
| | | private DownWorkstationMapper downWorkstationMapper; |
| | | |
| | | @Override |
| | | public void addDownStorageCageDetails(DownStorageCageDetails details) { |
| | | this.save(details); |
| | |
| | | |
| | | @Override |
| | | //修改理片笼内信息 功能:对笼内栅格玻璃 【添加/删除/更换】 |
| | | public boolean updatedownStorageCageDetails(DownStorageCageDetails details){ |
| | | public boolean updatedownStorageCageDetails(DownStorageCageDetails details) { |
| | | baseMapper.updateById(details); |
| | | return true; |
| | | } |
| | |
| | | |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // @Override |
| | |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<DownStorageCageDetails> CacheOut1(int start,int end) { |
| | | |
| | | public List<DownStorageCageDetails> CacheOut1(int start, int end) { |
| | | |
| | | |
| | | List<DownStorageCageDetails> cageDetails = downStorageCageDetailsMapper.selectList(null); |
| | | // Step 5: 判断 down_storage_cage_details 结果数量是否为9,如果是,则执行另外一个查询 |
| | | if (cageDetails.size() == 9) { |
| | | log.info("满了的时候,按照笼内版图id 版图片序出"); |
| | | log.info("1、笼子满了的时候,按照笼内版图id 版图片序出"); |
| | | List<DownWorkstation> workstationList = downWorkstationMapper.selectList(new QueryWrapper<DownWorkstation>().between("workstation_id", start, end)); |
| | | |
| | | |
| | |
| | | for (DownWorkstation workstation : workstationList) { |
| | | flowCardIds.add(workstation.getFlowCardId()); |
| | | } |
| | | |
| | | if (flowCardIds.isEmpty()) { |
| | | log.error("未找到对应的 flow_card_id"); |
| | | return Collections.emptyList(); // 返回空列表或者抛出异常,视情况而定 |
| | | } |
| | | LambdaQueryWrapper<DownStorageCageDetails> anotherQueryWrapper = Wrappers.lambdaQuery(); |
| | | |
| | | anotherQueryWrapper.orderByAsc(DownStorageCageDetails::getTemperingLayoutId); |
| | | anotherQueryWrapper.orderByDesc(DownStorageCageDetails::getTemperingFeedSequence); |
| | | anotherQueryWrapper.in(DownStorageCageDetails::getFlowCardId,flowCardIds); |
| | | anotherQueryWrapper.in(DownStorageCageDetails::getFlowCardId, flowCardIds); |
| | | anotherQueryWrapper.last("LIMIT 1"); |
| | | return downStorageCageDetailsMapper.selectList(anotherQueryWrapper); |
| | | }else |
| | | { |
| | | } else { |
| | | |
| | | // Step 1: 查询 DownWorkstation 表获取对应 workstation_id 的 flow_card_id |
| | | List<DownWorkstation> workstationList = downWorkstationMapper.selectList(new QueryWrapper<DownWorkstation>().between("workstation_id", start, end)); |
| | | // Step 1: 查询 DownWorkstation 表获取对应 workstation_id 的 flow_card_id |
| | | List<DownWorkstation> workstationList = downWorkstationMapper.selectList(new QueryWrapper<DownWorkstation>().between("workstation_id", start, end)); |
| | | |
| | | |
| | | List<String> flowCardIds = new ArrayList<>(); |
| | | for (DownWorkstation workstation : workstationList) { |
| | | flowCardIds.add(workstation.getFlowCardId()); |
| | | } |
| | | List<String> flowCardIds = new ArrayList<>(); |
| | | for (DownWorkstation workstation : workstationList) { |
| | | flowCardIds.add(workstation.getFlowCardId()); |
| | | } |
| | | |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper = Wrappers.lambdaQuery(); |
| | | queryWrapper.select(GlassInfo::getFlowCardId, |
| | | GlassInfo::getGlassId, |
| | | GlassInfo::getTemperingLayoutId, |
| | | GlassInfo::getTemperingFeedSequence) |
| | | .notInSql(GlassInfo::getGlassId, "SELECT glass_id FROM down_glass_info") |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence) |
| | | .last("LIMIT 1"); |
| | | if (flowCardIds.isEmpty()) { |
| | | log.error("2、未找到对应的 flow_card_id"); |
| | | return Collections.emptyList(); // 返回空列表或者抛出异常,视情况而定 |
| | | } |
| | | log.info("流程卡:{}", flowCardIds); |
| | | LambdaQueryWrapper<GlassInfo> queryWrapper2 = Wrappers.lambdaQuery(); |
| | | queryWrapper2.select(GlassInfo::getFlowCardId, |
| | | GlassInfo::getGlassId, |
| | | GlassInfo::getTemperingLayoutId, |
| | | GlassInfo::getTemperingFeedSequence) |
| | | .notInSql(GlassInfo::getGlassId, "SELECT glass_id FROM down_glass_info") |
| | | .orderByAsc(GlassInfo::getTemperingLayoutId) |
| | | .orderByDesc(GlassInfo::getTemperingFeedSequence) |
| | | .last("LIMIT 1"); |
| | | |
| | | // 查询 GlassInfo 表 |
| | | List<GlassInfo> glassInfos = glassInfoMapper.selectList(queryWrapper); |
| | | |
| | | // Step 3: 构造查询 down_storage_cage_details 表的条件 |
| | | List<String> glassIds = glassInfos.stream().map(GlassInfo::getGlassId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<DownStorageCageDetails> cageDetailsQueryWrapper = Wrappers.lambdaQuery(); |
| | | cageDetailsQueryWrapper.in(DownStorageCageDetails::getGlassId, glassIds); |
| | | cageDetailsQueryWrapper.in(DownStorageCageDetails::getFlowCardId, flowCardIds); |
| | | // 查询 GlassInfo 表 |
| | | List<GlassInfo> glassInfos = glassInfoMapper.selectList(queryWrapper2); |
| | | if (glassInfos.isEmpty()) { |
| | | log.error("未找到对应的玻璃信息"); |
| | | return Collections.emptyList(); // 返回空列表或者抛出异常,视情况而定 |
| | | } |
| | | // Step 3: 构造查询 down_storage_cage_details 表的条件 |
| | | List<String> glassIds = glassInfos.stream().map(GlassInfo::getGlassId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<DownStorageCageDetails> cageDetailsQueryWrapper = Wrappers.lambdaQuery(); |
| | | cageDetailsQueryWrapper.in(DownStorageCageDetails::getGlassId, glassIds); |
| | | cageDetailsQueryWrapper.in(DownStorageCageDetails::getFlowCardId, flowCardIds); |
| | | |
| | | log.info("按照流程卡的版图id 版图片序出"); |
| | | // Step 4: 查询 down_storage_cage_details 表并返回结果 |
| | | return downStorageCageDetailsMapper.selectList(cageDetailsQueryWrapper); |
| | | // Step 4: 查询 down_storage_cage_details 表并返回结果 |
| | | return downStorageCageDetailsMapper.selectList(cageDetailsQueryWrapper); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | // @Value("${mes.threshold}") |
| | | private int threshold; |
| | | |
| | | // @Scheduled(fixedDelay = 1000) |
| | | //@Scheduled(fixedDelay = 1000) |
| | | public void plcdownGlassTask() { |
| | | // PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | // String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue(); |