UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -16,7 +16,7 @@ const dialogFormVisiblea2 = ref(false) const tableData = reactive([]); let socket; @@ -174,7 +174,7 @@ const tableData = reactive([]); // 发送获取表格数据的请求 const fetchTableData = async () => { hangzhoumesParent/common/pom.xml
@@ -171,6 +171,12 @@ <version>1.2.33</version> </dependency> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.2.4</version> </dependency> </dependencies> hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/impl/EdgStorageCageDetailsServiceImpl.java
@@ -10,7 +10,6 @@ import com.mes.taskcache.mapper.HangzhouMesMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
@@ -23,16 +23,16 @@ <version>2.8.9</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.2.4</version> <version>1.1.6</version> </dependency> </dependencies> <properties> hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/AppRunnerConfig.java
@@ -20,9 +20,9 @@ new PLCAutoMes().start(); new Plchome().start(); // new PLCAutoMes().start(); // // new Plchome().start(); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/controller/DownStorageCageDetailsController.java
@@ -2,6 +2,7 @@ import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downstorage.service.DownStorageCageService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -14,6 +15,8 @@ @Autowired private DownStorageCageDetailsService downStorageCageDetailsService; @Autowired private DownStorageCageService downStorageCageService; @PostMapping("/add") public String addDownStorageCageDetails(@RequestBody DownStorageCageDetails details) { @@ -22,9 +25,20 @@ } @GetMapping("/leisure") public List<Map<String, Object>> getLeisureData() { return downStorageCageDetailsService.selectCacheLeisure(); public List<Map> getLeisureData() { return downStorageCageService.getCacheInfo(); } private static final int START_VALUE = 0; private static final int END_VALUE = 5; @GetMapping("/leisure2") public List<Map> getLeisureData2() { // 调用Service层获取数据 return downStorageCageService.getCacheOut(START_VALUE, END_VALUE); } // Other CRUD operations can be defined here } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/mapper/DownStorageCageDetailsMapper.java
@@ -28,12 +28,12 @@ // 查询符合工位的出片玻璃 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot left join down_workstation as dw on escd.flow_card_id=dw.flow_card_id WHERE escd.slot IS NOT NULL and dw.workstation_id BETWEEN #{start} and #{end} order by escd.tempering_layout_id,escd.tempering_feed_sequence") List<DownStorageCageDetails> SelectCacheOut(int start,int end); //SELECT* from (SELECT DISTINCT escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot left join down_workstation as dw on escd.flow_card_id=dw.flow_card_id WHERE escd.slot IS NOT NULL and dw.workstation_id BETWEEN 1 and 5 order by escd.tempering_layout_id,escd.tempering_feed_sequence) as cc ORDER BY cc.width desc // 查询笼子内信息 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot order by esc.slot") List<DownStorageCageDetails> SelectCachInfo(); // 查询可进此片玻璃的栅格号 // 查询可进此片玻璃的栅格号 找到相同版图id并且大于前面的顺序的空格 @Select("select escd.* from down_storage_cage as esc LEFT JOIN down_storage_cage_details as escd on esc.slot=escd.slot where escd.slot is not null and escd.tempering_layout_id=#{tempering_layout_id} and escd.tempering_feed_sequence<#{tempering_feed_sequence} and esc.remain_width-#{width}>0 order by escd.tempering_feed_sequence") List<DownStorageCageDetails> SelectIsExistIntoCache(Integer tempering_layout_id, Integer tempering_feed_sequence, double width); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/mapper/DownStorageCageMapper.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.downstorage.entity.DownStorageCage; /** @@ -11,6 +12,6 @@ * @author zhoush * @since 2024-03-27 */ public interface DownStorageCageMapper extends BaseMapper<DownStorageCage> { public interface DownStorageCageMapper extends MPJBaseMapper<DownStorageCage> { } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
@@ -18,6 +18,8 @@ import java.util.List; import static jdk.nashorn.internal.runtime.regexp.joni.Config.log; @Data @Service public class DownGlassCacheLogic { @@ -35,20 +37,20 @@ * @param Number //识别逻辑 不交互 */ public void identify(String Number) { //查询任务 PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); String s = S7control.getinstance().ReadWord("DB14.26", 1).get(0) + ""; boolean isexist = isExist(Number); if (isexist) { //存在逻辑 1.添加信息 2.回复PLC存在 //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); } else { //不存在逻辑 1.回复PLC不存在 //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2); } } // public void identify(String Number) { // //查询任务 // PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; // S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); // String s = S7control.getinstance().ReadWord("DB14.26", 1).get(0) + ""; // boolean isexist = isExist(Number); // if (isexist) { // //存在逻辑 1.添加信息 2.回复PLC存在 // //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1); // } else { // //不存在逻辑 1.回复PLC不存在 // //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2); // } // } public void process() { String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + ""; @@ -84,10 +86,11 @@ PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; //存在此玻璃编号 if (GlassInfo != null) { //同钢化版图内的栅格号 //同钢化版图内的栅格号 找到相同版图id并且大于前面的顺序的空格 List<DownStorageCageDetails> list = selectInfo.SelectIsExistIntoCache(GlassInfo.getTemperingLayoutId(), GlassInfo.getTemperingFeedSequence(), GlassInfo.getWidth()); //空栅格号 if (list.size() == 0) { //查询笼子内空闲 list = selectInfo.SelectCacheLeisure(); } //小于此玻璃钢化版图序号的栅格号 @@ -102,6 +105,7 @@ selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId()); S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); //完成后插入小片数据到缓存表 return true; } @@ -119,6 +123,7 @@ String G11 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + ""; String G13 = S7control.getinstance().ReadWord("DB14.58", 1).get(0) + ""; PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; log.println("666"); ; List<DownStorageCageDetails> list = selectInfo.SelectCacheOut(1, 5); List<DownStorageCageDetails> list2 = selectInfo.SelectCacheOut(6, 10); List<DownStorageCageDetails> list3 = selectInfo.SelectCacheOut(1, 10); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -9,7 +9,5 @@ void addDownStorageCageDetails(DownStorageCageDetails details); List<Map<String, Object>> selectCacheLeisure(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageService.java
@@ -16,4 +16,12 @@ */ public interface DownStorageCageService extends IService<DownStorageCage> { public List<Map> gettask(); // List<Map<String, Object>> selectCacheLeisure(); List<Map> getCacheLeisure(); List<Map> getCacheOut(int start, int end); List<Map> getCacheInfo(); List<Map> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width); List<Map> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -1,8 +1,11 @@ package com.mes.downstorage.service.impl; 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; @@ -26,17 +29,15 @@ } // @Resource // private DownStorageCageDetailsMapper downStorageCageDetailsMapper; @Override public List<Map<String, Object>> selectCacheLeisure() { QueryWrapper<DownStorageCageDetails> queryWrapper = new QueryWrapper<>(); queryWrapper .apply("LEFT JOIN down_storage_cage esc ON esc.slot = down_storage_cage_details.slot") .isNull("down_storage_cage_details.slot"); return listMaps(queryWrapper); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,15 +1,22 @@ package com.mes.downstorage.service.impl; import com.github.yulichang.query.MPJQueryWrapper; import com.mes.downstorage.entity.DownStorageCage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.mapper.DownStorageCageMapper; import com.mes.downstorage.service.DownStorageCageService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Collections; import java.util.Comparator; /** * <p> * 服务实现类 @@ -18,6 +25,7 @@ * @author zhoush * @since 2024-03-27 */ @Slf4j @Service public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { @Autowired @@ -28,4 +36,111 @@ // downStorageCageMapper.selectJoin(); return null; }; @Override public List<Map> getCacheLeisure() { 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") .isNull("escd.slot") .orderByAsc("escd.slot") ); return map; } // @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> 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") ); // 对获取的数据列表按照宽度进行排序 Collections.sort(map, new Comparator<Map>() { @Override public int compare(Map o1, Map o2) { // 获取宽度并比较 double width1 = (double) o1.get("width"); double width2 = (double) o2.get("width"); return Double.compare(width2, width1); } }); return map; } @Override public List<Map> getCacheInfo() { 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") .orderByAsc("t.slot") ); return map; } @Override public List<Map> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) { List<Map> map = downStorageCageMapper.selectJoinList( Map.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .eq("escd.tempering_layout_id", tempering_layout_id) .lt("escd.tempering_feed_sequence", tempering_feed_sequence) .gt("t.remain_width", width) .orderByAsc("escd.tempering_feed_sequence") ); return map; } @Override public List<Map> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) { List<Map> map = downStorageCageMapper.selectJoinList( Map.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .lt("escd.tempering_layout_id", tempering_layout_id) .gt("t.remain_width", width) .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") ); return map; } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
@@ -24,12 +24,6 @@ port: 6379 password: 123456 mybatis-plus: mapper-locations: classpath*:mapper/**/*.xml # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 设置 MyBatis 日志级别为 ERROR logging: level: com: baomidou: mybatisplus=ERROR: mapper-locations: classpath*:mapper/*.xml configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl