UI-Project/src/views/UnLoadGlass/Landingindicationtwo.vue
@@ -31,22 +31,18 @@ </div> </template> <script> <script setup> import Swal from 'sweetalert2' export default { data() { return { racks: [ const 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' } } ] }; }, methods: { calculateItemXPosition(rack, item, index) { ]; const calculateItemXPosition = (rack, item, index) => { if (index === 0 || index === 1) { return rack.x; } else if (index === 2 || index === 3) { @@ -54,8 +50,9 @@ } else { return rack.x + (rack.width - item.width) / 2; } }, calculateItemYPosition(rack, item, index) { }; const calculateItemYPosition = (rack, item, index) => { if (index === 0 || index === 1) { return rack.y + (rack.height - item.height) / 2; } else if (index === 2 || index === 3) { @@ -63,8 +60,9 @@ } else { return rack.y + rack.height - item.height; } }, showCustomAlert(content) { }; const showCustomAlert = (content) => { var str="架号 : 111\n" + "长 : 111\n" + "宽 : 111\n" + @@ -79,22 +77,20 @@ popup: 'format-pre' } }); }, showRectInfo( rectInfo) { const content = rectInfo.item.content; this.$nextTick(() => { this.showCustomAlert(content); }); }, } }; const showRectInfo = (rectInfo) => { const content = rectInfo.item.content; showCustomAlert(content); }; </script> <style scoped> .glass-rack { margin-left: 20px; width: 500px; margin-top: 10px; } .rack-rect:hover { cursor: pointer; @@ -110,5 +106,4 @@ padding: 10px; font-size: 14px; } </style> UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -29,7 +29,7 @@ if (typeof WebSocket === "undefined") { console.log("您的浏览器不支持WebSocket"); } else { let socketUrl = "ws://" + "localhost"+":88" + "/api/unLoadGlass/api/talk/" + viewname; let socketUrl = "ws://" + "localhost"+":88" + "/api/talk/" + viewname; if (socket != null) { socket.close(); socket = null; @@ -49,8 +49,6 @@ if (!msg.data) { return; // 如果收到空数据,则直接返回,不执行后续逻辑 } let obj = JSON.parse(msg.data); UI-Project/vite.config.js
@@ -22,7 +22,7 @@ https: false, proxy: { '/api': { target: 'http://10.153.19.150:88/', target: '10.153.19.150:88/', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, '/'), }, hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/Plchome.java
@@ -2,18 +2,24 @@ import cn.hutool.json.JSONObject; import com.mes.downworkstation.service.DownWorkstationService; import com.mes.tools.WebSocketServer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.function.Supplier; @Component public class Plchome extends Thread { private int i = 1; private static final Logger log = LogManager.getLogger(Plchome.class); @Autowired private DownWorkstationService downWorkstationService; // private final Supplier<DownGlassLogic> plcServiceSupplier; @@ -27,18 +33,12 @@ while (!Thread.currentThread().isInterrupted()) { try { i++; Thread.sleep(100); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(); } Thread.sleep(1000); JSONObject jsonObject = new JSONObject(); // System.out.println(arraylist6); jsonObject.append("data", 1); System.out.println(77); downWorkstationService = WebSocketServer.applicationContext.getBean(DownWorkstationService.class); List<Map<String, Object>> yy= downWorkstationService.getTotalGlassDimensionsByWorkstation(); jsonObject.append("data", yy); ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass"); if (sendwServer != null) { for (WebSocketServer webserver : sendwServer) { @@ -47,6 +47,14 @@ } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(); } } } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/AppRunnerConfig.java
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassTaskService.java
@@ -24,4 +24,12 @@ DownGlassTask selectLastOutCacheInfo(String endCell); Integer insertCacheTask(DownGlassTask downGlassTask); List<DownGlassTask> selectInputTaskCache(); /** * 查询出片任务 * @return */ List<DownGlassTask> selectOutTaskCache(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java
@@ -78,6 +78,20 @@ @Override public List<DownGlassTask> selectInputTaskCache(){ return baseMapper.selectList(new QueryWrapper<DownGlassTask>().eq("task_status",0).eq("task_type",1)); } /** * 查询待出片任务 * @return */ @Override public List<DownGlassTask> selectOutTaskCache(){ return baseMapper.selectList(new QueryWrapper<DownGlassTask>().eq("task_status",0).eq("task_type",2)); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/entity/DownStorageCageDetails.java
@@ -40,7 +40,7 @@ /** * 玻璃id */ private Integer glassId; private String glassId; /** * 小片在格内的顺序 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/mapper/DownStorageCageDetailsMapper.java
@@ -1,6 +1,7 @@ package com.mes.downstorage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.yulichang.base.MPJBaseMapper; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.glassinfo.entity.GlassInfo; @@ -17,6 +18,6 @@ * @since 2024-03-27 */ @Mapper public interface DownStorageCageDetailsMapper extends BaseMapper<DownStorageCageDetails> { public interface DownStorageCageDetailsMapper extends MPJBaseMapper<DownStorageCageDetails> { } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -13,5 +13,5 @@ //修改理片笼内信息 boolean updatedownStorageCageDetails(DownStorageCageDetails details); List<DownStorageCageDetails> CacheOut(int start, int end); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageService.java
@@ -26,8 +26,9 @@ List<DownStorageCageDetails> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width); List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width); List<DownStorageCageDetails> IsExistIntoCacheByflowcardid(String flowcardid, double width); List<Map> selectCacheEmpty(); boolean processInto(String Number); boolean processOut(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -2,28 +2,29 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.yulichang.query.MPJQueryWrapper; import com.github.yulichang.wrapper.MPJAbstractLambdaWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.query.MPJQueryWrapper; import com.mes.downstorage.entity.DownStorageCage; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.mapper.DownStorageCageMapper; import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.glassinfo.entity.GlassInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; import java.util.Map; @Slf4j @Service public class DownStorageCageDetailsServiceImpl extends ServiceImpl<DownStorageCageDetailsMapper, DownStorageCageDetails> implements DownStorageCageDetailsService { @Autowired private DownStorageCageDetailsMapper downStorageCageDetailsMapper; @Override public void addDownStorageCageDetails(DownStorageCageDetails details) { this.save(details); @@ -38,7 +39,21 @@ } @Override public List<DownStorageCageDetails> CacheOut(int start, int end) { log.info("单片情况根据传入的工位查询符合按照大小出片的小片"); return downStorageCageDetailsMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("t.*") .leftJoin("(SELECT t1.* FROM down_storage_cage_details t1 " + "JOIN (SELECT flow_card_id, MAX(width) AS max_width FROM glass_info GROUP BY flow_card_id) t " + "ON t1.flow_card_id = t.flow_card_id WHERE t1.width = t.max_width) t3" + " ON t.glass_id = t3.glass_id") .leftJoin("down_workstation t4 ON t3.flow_card_id = t4.flow_card_id") .isNull(Boolean.parseBoolean("t.glass_id"), "SELECT glass_id FROM down_glass_info") .between("t4.workstation_id", start, end) ); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -11,6 +11,7 @@ import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.mapper.DownStorageCageMapper; import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downstorage.service.DownStorageCageService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; @@ -38,10 +39,11 @@ @Autowired private GlassInfoService glassInfoService; @Autowired private DownStorageCageService downStorageCageService; @Autowired private DownGlassTaskService downGlassTaskService; @Autowired private DownStorageCageDetailsService downStorageCageDetailsService; @Override public List<Map> gettask(){ downStorageCageMapper.selectList(null); @@ -65,20 +67,17 @@ } // @Override // public List<Map> getCacheOut(int start, int end) { // log.info(" 根据传入的工位查询符合按照顺序和大小出片的小片"); // List<Map> map = downStorageCageMapper.selectJoinList( // Map.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") // .isNotNull("escd.slot") // .between("dw.workstation_id", start, end) // .orderByAsc("escd.tempering_layout_id, escd.tempering_feed_sequence") // ); // return map; // } @Override public List<Map> selectCacheEmpty(){ return baseMapper.selectJoinList( Map.class,new MPJQueryWrapper<DownStorageCage>().selectAll(DownStorageCage.class) .select("escd.glass_id","escd.flow_card_id","escd.width","escd.height") .leftJoin("down_storage_cage_details escd on t.device_id=escd.device_id and t.slot=escd.slot") .isNull("escd.slot") ); } @@ -196,22 +195,24 @@ } // @Override // public List<DownStorageCageDetails> Out() { // log.info("单片情况 根据传入的工位查询符合按照大小出片的小片"); // // // return downStorageCageMapper.selectJoinList( // DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() // .select("escd.*") // .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") // .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id") // .isNotNull("escd.slot") // // .orderByDesc("escd.width") // .orderByDesc("escd.height") // ); // } @@ -235,6 +236,21 @@ } public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell,String taskType ) { DownGlassTask downGlassTask = new DownGlassTask(); downGlassTask.setId(glassInfo.getId()); downGlassTask.setStartCell(startCell); downGlassTask.setTaskType(taskType); downGlassTask.setEndCell(endCell); downGlassTask.setWidth(glassInfo.getWidth()); downGlassTask.setHeight(glassInfo.getHeight()); downGlassTask.setFilmsid(String.valueOf(glassInfo.getFilmsid())); downGlassTask.setThickness(glassInfo.getThickness()); downGlassTask.setFlowCardId(glassInfo.getFlowCardId()); return downGlassTask; } @Override public boolean processInto(String Number) { @@ -246,7 +262,12 @@ if (GlassInfo != null) { //同找到同流程卡附近空格 List<DownStorageCageDetails> list = getIsExistIntoCacheByflowcardid(GlassInfo.getFlowcardId(), GlassInfo.getWidth()); if (list.size() > 0) { List<Map> selectCacheEmpty=selectCacheEmpty(); // list<Map> list=selectCacheEmpty(); // list<Map> = downStorageCageService.selectCacheEmpty(); if (selectCacheEmpty.size() > 0) { //存在空格 //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) //2.回复 1进片 @@ -285,10 +306,11 @@ PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; List<DownStorageCageDetails> list = getCacheOut(1, 5); List<DownStorageCageDetails> list2 = getCacheOut(6, 10); List<DownStorageCageDetails> list3 = getCacheOut(1, 10); List<DownStorageCageDetails> list = downStorageCageDetailsService.CacheOut(1, 5); List<DownStorageCageDetails> list2 = downStorageCageDetailsService.CacheOut(6, 10); List<DownStorageCageDetails> list3 = downStorageCageDetailsService.CacheOut(1, 10); //自动绑定架子 @@ -303,16 +325,8 @@ // selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId()); DownGlassTask downGlassTask = new DownGlassTask(); downGlassTask.setId(item3.getId()); // 设置玻璃ID downGlassTask.setStartCell("0"); downGlassTask.setEndCell(endcell); downGlassTask.setTaskType("2"); downGlassTask.setWidth(item3.getWidth()); // 设置玻璃宽度 downGlassTask.setHeight(item3.getHeight()); // 设置玻璃高度 downGlassTask.setFilmsid(item3.getFilmsid()+""); // 设置膜ID downGlassTask.setThickness(item3.getThickness()); // 设置玻璃厚度 downGlassTask.setFlowCardId(item3.getFlowCardId()); // 设置流程卡号 DownGlassTask downGlassTask =createDownGlassTask(item3,"0",endcell,"2"); downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); @@ -321,22 +335,14 @@ } //同时请求 优先后端出片 else if (!list3.isEmpty()) { DownStorageCageDetails item3 = list3.get(0); //如果同时前后端都空闲 优先后端出片并且优先满架 else if (!list2.isEmpty()) { DownStorageCageDetails item3 = list2.get(0); String endcell = "11"; String SendEndcell = "1"; // selectInfo.insertCacheTask(item3.getGlassId() + "", "0", endcell, "2", item3.getWidth(), item3.getHeight(), item3.getFilmsid(), item3.getThickness(), item3.getFlowCardId()); DownGlassTask downGlassTask = new DownGlassTask(); downGlassTask.setId(item3.getId()); // 设置玻璃ID downGlassTask.setStartCell("0"); downGlassTask.setEndCell(endcell); downGlassTask.setTaskType("2"); downGlassTask.setWidth(item3.getWidth()); // 设置玻璃宽度 downGlassTask.setHeight(item3.getHeight()); // 设置玻璃高度 downGlassTask.setFilmsid(item3.getFilmsid()+""); // 设置膜ID downGlassTask.setThickness(item3.getThickness()); // 设置玻璃厚度 downGlassTask.setFlowCardId(item3.getFlowCardId()); // 设置流程卡号 DownGlassTask downGlassTask =createDownGlassTask(item3,"0",endcell,"2"); downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); @@ -350,37 +356,19 @@ // 出到 G06 //selectInfo.insertCacheTask(item.getGlassId() + "", "0", "06", "2", item.getWidth(), item.getHeight(), item.getFilmsid(), item.getThickness(), item.getFlowCardId()); DownGlassTask downGlassTask = new DownGlassTask(); downGlassTask.setId(item.getId()); // 设置玻璃ID downGlassTask.setStartCell("0"); downGlassTask.setEndCell("06"); downGlassTask.setTaskType("2"); downGlassTask.setWidth(item.getWidth()); // 设置玻璃宽度 downGlassTask.setHeight(item.getHeight()); // 设置玻璃高度 downGlassTask.setFilmsid(item.getFilmsid()+""); // 设置膜ID downGlassTask.setThickness(item.getThickness()); // 设置玻璃厚度 downGlassTask.setFlowCardId(item.getFlowCardId()); // 设置流程卡号 downGlassTaskService.insertCacheTask(downGlassTask); DownGlassTask downGlassTask =createDownGlassTask(item,"0","06","2"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; // 按照顺序符合后端出片 // 按照大小符合后端出片 } else if (!list2.isEmpty()) { DownStorageCageDetails item2 = list2.get(0); // 出到 G11 // selectInfo.insertCacheTask(item2.getGlassId() + "", "0", "11", "2", item2.getWidth(), item2.getHeight(), item2.getFilmsid(), item2.getThickness(), item2.getFlowCardId()); DownGlassTask downGlassTask = new DownGlassTask(); downGlassTask.setId(item2.getId()); // 设置玻璃ID downGlassTask.setStartCell("0"); downGlassTask.setEndCell("11"); downGlassTask.setTaskType("2"); downGlassTask.setWidth(item2.getWidth()); // 设置玻璃宽度 downGlassTask.setHeight(item2.getHeight()); // 设置玻璃高度 downGlassTask.setFilmsid(item2.getFilmsid()+""); // 设置膜ID downGlassTask.setThickness(item2.getThickness()); // 设置玻璃厚度 downGlassTask.setFlowCardId(item2.getFlowCardId()); // 设置流程卡号 DownGlassTask downGlassTask =createDownGlassTask(item2,"0","11","2"); downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -131,6 +131,24 @@ @ApiOperation("获取工位显示图") @GetMapping("/getwo") public ResponseEntity<Map<String, Object>> getwo() { Map<String, Object> responseData = new HashMap<>(); try { List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(); responseData.put("code", 200); responseData.put("msg", "成功"); responseData.put("data", data); return ResponseEntity.ok(responseData); } catch (Exception e) { responseData.put("code", 500); responseData.put("msg", "失败"); responseData.put("data", null); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstionAndDownGlassinfo.java
New file @@ -0,0 +1,89 @@ package com.mes.downworkstation.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; /** * <p> * * </p> * * @author zhoush * @since 2024-03-27 */ @Data @EqualsAndHashCode(callSuper = false) public class DownWorkstionAndDownGlassinfo { /** * 下片工位表id */ @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 工位id */ private Integer workstationId; /** * 流程卡号 */ private String flowCardId; /** * 设备id */ private Integer deviceId; /** * 启用状态 */ private Integer enableState; /** * 工作状态 */ private Integer workState; @TableField("total_quantity") private Integer totalquantity; @TableField("racks_number") private Integer Racksnumber; /** * 顺序 */ private Integer sequence; /** * 宽 */ private Double width; /** * 高 */ private Double height; private Double totalwidth; private Double totalheight; /** * 厚度 */ private Double thickness; private String Filmsid; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/mapper/DownWorkstationMapper.java
@@ -3,6 +3,7 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.yulichang.base.MPJBaseMapper; import com.mes.downworkstation.entity.DownWorkstation; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; @@ -24,7 +25,7 @@ @InterceptorIgnore(tenantLine = "true") @DS("hangzhoumes") // 指定使用 hangzhoumes 数据源 public interface DownWorkstationMapper extends BaseMapper<DownWorkstation> { public interface DownWorkstationMapper extends MPJBaseMapper<DownWorkstation> { } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
@@ -4,6 +4,7 @@ import com.mes.downworkstation.entity.DownWorkstation; import java.util.List; import java.util.Map; /** * <p> @@ -28,5 +29,5 @@ int updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId); void insertdownglassinfo(); List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -3,23 +3,29 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.query.MPJQueryWrapper; import com.mes.downglassinfo.entity.DownGlassInfo; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.mapper.DownGlassInfoMapper; import com.mes.downglassinfo.service.DownGlassInfoService; import com.mes.downglassinfo.service.DownGlassTaskService; import com.mes.downworkstation.entity.DownWorkstation; import com.mes.downworkstation.entity.DownWorkstationTask; import com.mes.downworkstation.entity.DownWorkstionAndDownGlassinfo; import com.mes.downworkstation.mapper.DownWorkstationMapper; import com.mes.downworkstation.mapper.DownWorkstationTaskMapper; import com.mes.downworkstation.service.DownWorkstationService; import com.mes.downworkstation.service.DownWorkstationTaskService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Slf4j @Service public class DownWorkstationServiceImpl extends ServiceImpl<DownWorkstationMapper, DownWorkstation> implements DownWorkstationService { @@ -29,6 +35,8 @@ private DownWorkstationTaskMapper downWorkstationTaskMapper; @Autowired private DownGlassInfoService downGlassInfoService; @Autowired private DownGlassInfoMapper downGlassInfoMapper; @Autowired private DownGlassTaskService downGlassTaskService; @@ -50,6 +58,37 @@ DownWorkstation result = baseMapper.selectOne(queryWrapper); return result != null ? result.getTotalquantity() : 0; } //工位显示 @Override public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation() { MPJQueryWrapper<DownWorkstionAndDownGlassinfo> queryWrapper = new MPJQueryWrapper<>(); queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight") .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id") .groupBy("t.workstation_id", "t.flow_card_id"); List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper); List<Map<String, Object>> result = new ArrayList<>(); for (DownWorkstionAndDownGlassinfo downWorkstionAndDownGlassinfo : workstationList) { Map<String, Object> rack = new HashMap<>(); // 创建子项(item)对象 Map<String, Object> item = new HashMap<>(); item.put("height", downWorkstionAndDownGlassinfo.getTotalheight()); // 设置子项高度,根据实际情况设置 item.put("width", downWorkstionAndDownGlassinfo.getTotalwidth()); // 设置子项宽度,根据实际情况设置 item.put("fillColor", "yellow"); // 设置子项颜色 item.put("content", downWorkstionAndDownGlassinfo.getFlowCardId()); // 使用流程卡号作为子项内容 rack.put("item", item); // 将子项对象放入货架对象中 result.add(rack); // 将货架对象添加到结果列表中 //log.info("货架对象: {}", rack); } return result; // 返回最终结果 } // @Override // public int getTotalQuantity(int workstationId) { hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
@@ -128,6 +128,8 @@ * 生产规则id */ private Integer ruleId; /** * 玻璃id */ private String glassId; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -32,7 +32,7 @@ @Override public int getGlassInfoCountByFlowCardId(String flowCardId) { QueryWrapper<GlassInfo> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("flowcard_id", flowCardId); queryWrapper.eq("flow_card_id", flowCardId); return baseMapper.selectCount(queryWrapper); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/test/java/com/mes/downworkstation/service/DownWorkstationServiceTest.java
File was deleted hangzhoumesParent/moduleService/UnLoadGlassModule/src/test/java/mes/UnloadGlassModuleApplicationTest.java
@@ -2,6 +2,7 @@ import com.mes.UnLoadGlassApplication; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downstorage.service.impl.DownStorageCageServiceImpl; import com.mes.downworkstation.service.DownWorkstationService; @@ -29,6 +30,8 @@ @Autowired DownStorageCageServiceImpl downStorageCageServiceImpl; @Autowired DownStorageCageDetailsService downStorageCageDetailsService; @Autowired DownWorkstationServiceImpl downWorkstationServiceImpl; @@ -71,4 +74,36 @@ } @Test public void testin() { log.info("测试进片"); downStorageCageServiceImpl.getIsExistIntoCacheByflowcardid("NG2023005",500); } @Test public void selectCacheEmpty() { log.info("测试进片"); downStorageCageServiceImpl.selectCacheEmpty(); } @Test public void CacheEmpty() { log.info("测试出片"); downStorageCageDetailsService.CacheOut(1,5); } @Test public void getTotalGlassDimensionsByWorkstation() { log.info("工位显示"); downWorkstationServiceImpl.getTotalGlassDimensionsByWorkstation(); } }