| | |
| | | <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"; |
| | | |
| | | 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; |
| | | } |
| | | }; |
| | | |
| | | // 获取数据并更新 racks 数组 |
| | | const fetchFlowCardId = async () => { |
| | | try { |
| | | const response = await request.get('unLoadGlass/downWorkStation/getwo'); |
| | | if (response.code === 200) { |
| | | 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 |
| | | }; |
| | | // 更新 racks 数组 |
| | | Vue.set(racks, index, { ...rack, item: newItem }); |
| | | } |
| | | }); |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | } |
| | | }; |
| | | |
| | | // 获取数据并更新 racks 数组 |
| | | fetchFlowCardId(); |
| | | |
| | | // 显示自定义警报 |
| | | const showCustomAlert = (content) => { |
| | | var str="架号 : 111\n" + |
| | | "长 : 111\n" + |
| | |
| | | }); |
| | | }; |
| | | |
| | | // 显示元素信息 |
| | | const showRectInfo = (rectInfo) => { |
| | | const content = rectInfo.item.content; |
| | | showCustomAlert(content); |
| | | }; |
| | | |
| | | </script> |
| | | |
| | | <style scoped> |
| | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.mes.tools.S7control; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/4/9 15:13 |
| | | * @Description: |
| | | */ |
| | | //public class S7object { |
| | | // public S7control plccontrol; // PLC通讯类实例 |
| | | // private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | // private String ip = "192.168.10.1"; // plc ip地址 |
| | | // private int port = 102; // plc 端口号 |
| | | // |
| | | // private static volatile S7object instance = null; |
| | | // |
| | | // private S7object() { |
| | | // if (plccontrol == null) { |
| | | // plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | // } |
| | | // } |
| | | // |
| | | // // 单例模式 获取类的唯一实例 |
| | | // public static S7object getinstance() { |
| | | // if (instance == null) { |
| | | // synchronized (S7object.class) { |
| | | // if (instance == null) { |
| | | // instance = new S7object(); |
| | | // } |
| | | // } |
| | | // } |
| | | // return instance; |
| | | // } |
| | | //} |
| | | |
| | | |
| | | |
| | | public class S7object { |
| | | public S7control plccontrol; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.1"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7object instance = null; |
| | | |
| | | private S7object() { |
| | | if (plccontrol == null) { |
| | | plccontrol = new S7control(plcType, ip, port, 0, 0); |
| | | } |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7object getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7object.class) { |
| | | if (instance == null) { |
| | | instance = new S7object(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public List<DownGlassTask> getUnloadingTaskState() { |
| | | QueryWrapper<DownGlassTask> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("task_stauts", 1); |
| | | queryWrapper.eq("task_stauts", 0); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | |
| | | List<DownStorageCageDetails> CacheOut(int start, int end); |
| | | |
| | | /** |
| | | * @return 查询空格子 |
| | | * @return 出片 |
| | | */ |
| | | // List<DownStorageCageDetails> selectCacheEmpty2(); |
| | | |
| | | List<DownStorageCageDetails> CacheOut1(int start, int end); |
| | | } |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.yulichang.query.MPJQueryWrapper; |
| | | |
| | | |
| | |
| | | |
| | | import com.mes.downstorage.mapper.DownStorageCageMapper; |
| | | import com.mes.downstorage.service.DownStorageCageDetailsService; |
| | | import com.mes.downworkstation.entity.DownWorkstation; |
| | | import com.mes.downworkstation.mapper.DownWorkstationMapper; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.glassinfo.mapper.GlassInfoMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { |
| | |
| | | private DownStorageCageDetailsMapper downStorageCageDetailsMapper; |
| | | @Autowired |
| | | private GlassInfoMapper glassInfoMapper; |
| | | @Autowired |
| | | private DownWorkstationMapper downWorkstationMapper; |
| | | @Override |
| | | public void addDownStorageCageDetails(DownStorageCageDetails details) { |
| | | this.save(details); |
| | |
| | | |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @Override |
| | | 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 版图片序出"); |
| | | 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()); |
| | | } |
| | | LambdaQueryWrapper<DownStorageCageDetails> anotherQueryWrapper = Wrappers.lambdaQuery(); |
| | | |
| | | anotherQueryWrapper.orderByAsc(DownStorageCageDetails::getTemperingLayoutId); |
| | | anotherQueryWrapper.orderByDesc(DownStorageCageDetails::getTemperingFeedSequence); |
| | | anotherQueryWrapper.in(DownStorageCageDetails::getFlowCardId,flowCardIds); |
| | | anotherQueryWrapper.last("LIMIT 1"); |
| | | return downStorageCageDetailsMapper.selectList(anotherQueryWrapper); |
| | | }else |
| | | { |
| | | |
| | | // 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()); |
| | | } |
| | | |
| | | 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"); |
| | | |
| | | // 查询 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); |
| | | |
| | | log.info("按照流程卡的版图id 版图片序出"); |
| | | // Step 4: 查询 down_storage_cage_details 表并返回结果 |
| | | return downStorageCageDetailsMapper.selectList(cageDetailsQueryWrapper); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | package com.mes.downstorage.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.yulichang.toolkit.JoinWrappers; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> selectDownStorageCages() { |
| | | return baseMapper.selectJoinMaps(JoinWrappers.lambda(DownStorageCage.class) |
| | |
| | | @GetMapping("/getone") |
| | | public ResponseEntity<?> getOneDownWorkstations() { |
| | | try { |
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,5); |
| | | List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6); |
| | | // 构建符合预期格式的响应数据 |
| | | Map<String, Object> responseData = new HashMap<>(); |
| | | responseData.put("code", 200); |
| | |
| | | // String G06RobotTaskRequestWord = plcParameterObject.getPlcParameter("G06RobotTaskRequestWord").getAddress(); |
| | | |
| | | |
| | | String taskRequestTypeValue ="1"; |
| | | String taskRequestTypeValue ="3"; |
| | | String glassIdeValue ="NG24041101C002-2-6-1-6"; |
| | | String confirmationWrodValue ="1"; |
| | | String outGlassstate="1"; |
| | |
| | | } else if ("3".equals(taskRequestTypeValue)) { |
| | | log.info("3、进片和出片都空闲,执行出片任务"); |
| | | if (outTo( confirmationWrodAddress)) { |
| | | |
| | | |
| | | inTo(glassIdeValue, confirmationWrodAddress); |
| | | |
| | | |
| | |
| | | DownStorageCageDetails details = new DownStorageCageDetails(); |
| | | BeanUtils.copyProperties(glassInfo, details); |
| | | details.setState(1); |
| | | details.setGlassId(item.getGlassId()); |
| | | details.setGlassId(glassInfo.getGlassId()); |
| | | details.setSlot(item.getSlot()); |
| | | details.setDeviceId(item.getDeviceId()); |
| | | downStorageCageDetailsService.save(details); |
| | |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, "0", item.getSlot() + "", "1"); |
| | | //添加进片任务 |
| | | |
| | | log.info("6、生成进片任务信息存入任务表{}", downGlassTask); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | } |
| | |
| | | * |
| | | */ |
| | | private Boolean outTo( String confirmationWrodAddress) { |
| | | log.info("单片情况根据传入的设备id 查询符合按照大小出片,并且优先出满架的小片"); |
| | | List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut(1,3); |
| | | log.info("单片情况根据传入的料架号 查询符合按照版图id和片序出片,并且优先出满架的小片"); |
| | | List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut1(1,3); |
| | | |
| | | List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut(4,6); |
| | | List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut1(4,6); |
| | | |
| | | List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut(1, 6); |
| | | List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut1(1,6); |
| | | // 优先 超出尺寸优先人工出片 人工处理 |
| | | if (!list3.isEmpty()) { |
| | | log.info("人工处理"); |
| | | |
| | | DownStorageCageDetails item3 = list3.get(0); |
| | | if (item3.getHeight() >= 2500 && item3.getWidth() >= 2660) { |
| | | log.info("人工处理"); |
| | | String endcell = "7"; |
| | | |
| | | |
| | |
| | | |
| | | return true; |
| | | } |
| | | } |
| | | //如果同时前后端都空闲 优先后端出片并且优先满架 |
| | | else if (!list2.isEmpty() && !list3.isEmpty()) { |
| | | log.info("前后端都空闲 优先后端出片并且优先满架"); |
| | | DownStorageCageDetails item3 = list2.get(0); |
| | | DownStorageCageDetails item4 = list2.get(0); |
| | | |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item3.getFlowCardId())); |
| | | DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, item4.getFlowCardId())); |
| | | String endcell = String.valueOf(downWorkstation.getWorkstationId()); |
| | | |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item3, "9", endcell, "2"); |
| | | DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(item4, "9", endcell, "2"); |
| | | downGlassTaskService.insertCacheTask(downGlassTask); |
| | | |
| | | //S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2); |
| | |
| | | return true; |
| | | |
| | | } |
| | | // 按照大小符合前端出片 |
| | | // 按照版图id和片序符合前端出片 |
| | | else if (!list.isEmpty()) { |
| | | log.info("前端出片"); |
| | | DownStorageCageDetails item = list.get(0); |
| | |
| | | |
| | | |
| | | return true; |
| | | // 按照大小符合后端出片 |
| | | // 按照版图id和片序符合后端出片 |
| | | } else if (!list2.isEmpty()) { |
| | | log.info("后端出片"); |
| | | DownStorageCageDetails item2 = list2.get(0); |
| | |
| | | // S7object.getinstance().plccontrol.WriteWord(confirmationWrodAddress, (short) 2); |
| | | return true; |
| | | } |
| | | } |
| | | //如果同时前后端都空闲 优先后端出片并且优先满架 |
| | | |
| | | // 返回结果 |
| | | return false; |
| | | } |
| | |
| | | // |
| | | public void insertdownglassinfo() { |
| | | try { |
| | | String G06RobotTaskReply ="1"; |
| | | String G06Rack ="1"; |
| | | String G11RobotTaskReply ="1"; |
| | | String G11Rack ="1"; |
| | | |
| | | List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState(); |
| | | if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) { |
| | | |
| | | for (DownGlassTask downGlassInfo : taskdownGlassInf) { |
| | | // 创建新的 DownGlassInfo 对象并设置相关属性 |
| | | DownGlassInfo newdownGlassInfo = new DownGlassInfo(); |
| | | // newdownGlassInfo.setId(downGlassInfo.getId()); |
| | | newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId()); |
| | | |
| | | Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId()); |
| | | // 初始化顺序字段值 |
| | | int sequence = maxSequence != null ? maxSequence + 1 : 1; |
| | | // newdownGlassInfo.setId(downGlassInfo.getId()); |
| | | newdownGlassInfo.setWidth(downGlassInfo.getWidth()); |
| | | newdownGlassInfo.setGlassId(downGlassInfo.getGlassId()); |
| | | newdownGlassInfo.setHeight(downGlassInfo.getHeight()); |
| | | newdownGlassInfo.setThickness(downGlassInfo.getThickness()); |
| | | newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid()); |
| | | BeanUtils.copyProperties(downGlassInfo, newdownGlassInfo); |
| | | // 设置顺序字段值 |
| | | newdownGlassInfo.setSequence(sequence); |
| | | // 插入数据到下片玻璃信息表 |
| | | |
| | | downGlassInfoService.insertDownGlassInfo(newdownGlassInfo); |
| | | log.info("插入数据到下片玻璃信息表"); |
| | | DownWorkstation downWorkstation1 = downWorkstationService.selectByFlowCardId(downGlassInfo.getFlowCardId()); |
| | | downWorkstationService.updateracksnumber(downGlassInfo.getFlowCardId(), downWorkstation1.getRacksnumber() + 1); |
| | | log.info("更新落架数量"); |
| | | |
| | | sequence++; // 递增顺序字段值 |
| | | |
| | | |
| | |
| | | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. |
| | | datasource: |
| | | hangzhoumes: |
| | | url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/hangzhoumes?serverTimezone=GMT%2b8 |
| | | username: root |
| | | password: beibo.123/ |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | |
| | | downStorageCageDetailsService.CacheOut(1,2); |
| | | |
| | | } |
| | | @Test |
| | | public void CacheEmpty1() { |
| | | log.info("测试出片"); |
| | | downStorageCageDetailsServiceImpl.CacheOut1(1,6); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Test |