UI-Project/config.js
@@ -1,6 +1,6 @@ export default { serverUrl: "10.153.19.150:88/api", //serverUrl: "localhost:88/api/", serverUrl2: "10.153.19.150:8085" serverUrl2: "10.153.19.150:88" //serverUrl:"res.abeim.cn" } UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -203,7 +203,6 @@ initWebSocket(); onMounted(fetchTableData); // setInterval(fetchTableData, 2000) fetchTableData const open = () => { ElMessageBox.confirm( hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml
@@ -18,11 +18,16 @@ <artifactId>mybatis-plus-join</artifactId> <version>1.1.6</version> </dependency> <dependency> <groupId>com.github.yulichang</groupId> <artifactId>mybatis-plus-join</artifactId> <version>1.1.6</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>4.0</version> </dependency> </dependencies> <properties> <maven.compiler.source>8</maven.compiler.source> hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageCage.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -17,6 +19,7 @@ * @author zhoush * @since 2024-03-27 */ @ApiModel(description = "<p> 大理片笼 </p>") @Data @EqualsAndHashCode(callSuper = false) public class BigStorageCage implements Serializable { @@ -26,29 +29,35 @@ /** * 大理片笼表id */ @ApiModelProperty(value = "大理片笼表id", position = 2) @TableId(value = "id", type = IdType.AUTO) private Integer id; /** * 设备id */ @ApiModelProperty(value = "设备id", position = 3) private Integer deviceId; /** * 栅格号 */ @ApiModelProperty(value = "栅格号", position = 4) private Integer slot; /** * 启用状态 */ @ApiModelProperty(value = "启用状态", position = 5) private String enableState; /** * 剩余宽度 */ @ApiModelProperty(value = "剩余宽度", position = 6) private Integer remainWidth; @ApiModelProperty(hidden = true) @TableField(exist = false) private List<BigStorageCageDetails> bigStorageCageDetails; hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageCageDetails.java
@@ -3,6 +3,9 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import java.io.Serializable; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,6 +17,7 @@ * @author zhoush * @since 2024-03-27 */ @ApiModel(description = "<p> 大理片笼详情 </p>") @Data @EqualsAndHashCode(callSuper = false) public class BigStorageCageDetails implements Serializable { @@ -23,72 +27,86 @@ /** * 大理片笼详情表id */ @ApiModelProperty(value = "大理片笼详情表id", position = 2) @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 设备id */ @ApiModelProperty(value = "设备id", position = 3) private Integer deviceId; /** * 栅格号 */ @ApiModelProperty(value = "栅格号", position = 4) private Integer slot; /** * 玻璃id */ @ApiModelProperty(value = "玻璃id", position = 5) private String glassId; /** * 小片在格内的顺序 */ @ApiModelProperty(value = "小片在格内的顺序", position = 6) private Integer sequence; /** * 流程卡号 */ @ApiModelProperty(value = "流程卡号", position = 7) private String flowCardId; /** * 玻璃类型 */ @ApiModelProperty(value = "玻璃类型", position = 8) private Integer glassType; /** * 宽 */ @ApiModelProperty(value = "宽", position = 9) private Double width; /** * 高 */ @ApiModelProperty(value = "高", position = 10) private Double height; /** * 厚度 */ @ApiModelProperty(value = "厚度", position = 11) private Double thickness; /** * 钢化版图id */ @ApiModelProperty(value = "钢化版图id", position = 12) private Integer temperingLayoutId; /** * 钢化版图片序 */ @ApiModelProperty(value = "钢化版图片序", position = 13) private Integer temperingFeedSequence; /** * 状态 */ @ApiModelProperty(value = "状态", position = 14) private Integer state; /** * 玻璃间隙 */ @ApiModelProperty(value = "玻璃间隙", position = 15) private Integer gap; hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageServiceImpl.java
@@ -162,6 +162,9 @@ bigStorageCageMapper.update(bigStorageCage, bigStorageCageWrapper); } @Override public List<BigStorageCage> querybigStorageCageDetail() { //1、获取大理片笼信息 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/service/impl/BigStorageCageFeedTaskServiceImpl.java
@@ -38,7 +38,7 @@ @Override public List<BigStorageCageFeedTask> querybigStorageCageFeedTask(int taskState){ LambdaQueryWrapper<BigStorageCageFeedTask> getFeedTaskWrapper=new LambdaQueryWrapper<>(); getFeedTaskWrapper.eq(BigStorageCageFeedTask::getTaskState,1); getFeedTaskWrapper.eq(BigStorageCageFeedTask::getTaskState,taskState); return baseMapper.selectList(getFeedTaskWrapper); } } hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/test/java/com/mes/CacheVerticalGlassModuleApplicationTest.java
New file @@ -0,0 +1,28 @@ package com.mes; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.Arrays; import java.util.List; import java.util.Map; /** * @Author : zhoush * @Date: 2024/3/27 16:37 * @Description: */ @Slf4j @RunWith(SpringRunner.class) @SpringBootTest(classes = CacheVerticalClassModuleApplication.class) public class CacheVerticalGlassModuleApplicationTest { @Test public void testFindPath() { log.info("完整路径:{}", Arrays.asList("123")); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/Plcdownglass.java
New file @@ -0,0 +1,74 @@ package com.mes.common; import cn.hutool.json.JSONObject; import com.mes.device.PlcParameterObject; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.service.DownGlassTaskService; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.service.DownStorageCageService; import com.mes.downworkstation.service.DownWorkstationService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; import com.mes.tools.WebSocketServer; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; @Slf4j public class Plcdownglass extends Thread { public static final String RESULT_IN = "1"; public static final String RESULT_OUT = "2"; public static final String RESULT_IN_OUT = "3"; @Autowired private DownStorageCageService downStorageCageService; @Autowired private DownWorkstationService downWorkstationService; @Override public void run() { while (this != null) { JSONObject jsonObject = new JSONObject(); try { Thread.sleep(100); String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + ""; String number = S7control.getinstance().ReadWord("DB14.2", 1).get(0) + ""; // 进片请求 if (RESULT_IN.equals(result)) { downStorageCageService.processInto(number); } // 出片请求 else if (RESULT_OUT.equals(result)) { downStorageCageService.processOut(); } // 进出片请求 else if (RESULT_IN_OUT.equals(result)) { // 先出后进 if (!downStorageCageService.processOut()) { downStorageCageService.processInto(number); } } downWorkstationService.insertdownglassinfo(); } catch (Exception e) { e.printStackTrace(); } } } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/Plchome.java
@@ -1,7 +1,7 @@ package com.mes.common; import cn.hutool.json.JSONObject; import com.mes.downworkstation.service.DownGlassLogic; import com.mes.tools.WebSocketServer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,11 +15,11 @@ private int i = 1; private static final Logger log = LogManager.getLogger(Plchome.class); private final Supplier<DownGlassLogic> plcServiceSupplier; // private final Supplier<DownGlassLogic> plcServiceSupplier; public Plchome() { this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(DownGlassLogic.class); } // public Plchome() { // this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(DownGlassLogic.class); // } @Override @@ -28,15 +28,7 @@ try { i++; Thread.sleep(100); DownGlassLogic plcService = plcServiceSupplier.get(); //当下片任务表状态为1时候将数据插入到下片玻璃信息表 plcService.insertdownglassinfo(); //当机械手任务表中状态为1 更新已经落架数量,并且把下片任务表的那条记录删掉 工位表流程卡绑定了架子 plcService.downWorkstation(); } catch (InterruptedException e) { hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassTaskService.java
@@ -23,5 +23,5 @@ DownGlassTask selectLastOutCacheInfo(String endCell); Integer insertCacheTask(Long id, String start, String end, String type, double width, double height, String filmsId, double thickness, String flowCardId); Integer insertCacheTask(DownGlassTask downGlassTask); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -3,9 +3,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.mapper.DownWorkstationMapper; import com.mes.downworkstation.service.DownWorkstationService; import com.mes.downworkstation.service.DownWorkstationTaskService; import com.mes.tools.WebSocketServer; import org.springframework.stereotype.Service; import java.util.List; @Service public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { @@ -30,4 +39,8 @@ } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java
@@ -58,17 +58,17 @@ } @Override public Integer insertCacheTask(Long id, String start, String end, String type, double width, double height, String filmsId, double thickness, String flowCardId) { public Integer insertCacheTask(DownGlassTask downGlassTask) { DownGlassTask glassInfo = new DownGlassTask(); glassInfo.setId(id); glassInfo.setStartCell(start); glassInfo.setEndCell(end); glassInfo.setTaskType(type); glassInfo.setWidth(width); glassInfo.setHeight(height); glassInfo.setFilmsid(filmsId); glassInfo.setThickness(thickness); glassInfo.setFlowCardId(flowCardId); glassInfo.setId(downGlassTask.getId()); glassInfo.setStartCell(downGlassTask.getStartCell()); glassInfo.setEndCell(downGlassTask.getEndCell()); glassInfo.setTaskType(downGlassTask.getTaskType()); glassInfo.setWidth(downGlassTask.getWidth()); glassInfo.setHeight(downGlassTask.getHeight()); glassInfo.setFilmsid(downGlassTask.getFilmsid()); glassInfo.setThickness(downGlassTask.getThickness()); glassInfo.setFlowCardId(downGlassTask.getFlowCardId()); glassInfo.setTaskStauts(0); // 默认任务状态为0 int rows = baseMapper.insert(glassInfo); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownGlassCacheLogic.java
File was deleted hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -1,6 +1,7 @@ package com.mes.downstorage.service; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.glassinfo.entity.GlassInfo; import java.util.List; import java.util.Map; @@ -11,4 +12,6 @@ //修改理片笼内信息 boolean updatedownStorageCageDetails(DownStorageCageDetails details); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageService.java
@@ -26,4 +26,8 @@ List<DownStorageCageDetails> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width); List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width); List<DownStorageCageDetails> IsExistIntoCacheByflowcardid(String flowcardid, double width); boolean processInto(String Number); boolean processOut(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -11,6 +11,7 @@ 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -29,17 +30,12 @@ } @Override //修改理片笼内信息 功能:对笼内栅格玻璃 【添加/删除/更换】 public boolean updatedownStorageCageDetails(DownStorageCageDetails details){ baseMapper.updateById(details); return true; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,11 +1,20 @@ package com.mes.downstorage.service.impl; import com.github.yulichang.query.MPJQueryWrapper; import com.mes.common.PLCAutoMes; import com.mes.common.S7control; import com.mes.device.PlcParameterObject; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.service.DownGlassTaskService; 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 com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; import com.mes.tools.WebSocketServer; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -26,6 +35,13 @@ public class DownStorageCageServiceImpl extends ServiceImpl<DownStorageCageMapper, DownStorageCage> implements DownStorageCageService { @Autowired private DownStorageCageMapper downStorageCageMapper; @Autowired private GlassInfoService glassInfoService; @Autowired private DownStorageCageService downStorageCageService; @Autowired private DownGlassTaskService downGlassTaskService; @Override public List<Map> gettask(){ downStorageCageMapper.selectList(null); @@ -121,21 +137,6 @@ @Override public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { log.info(" 查询可进此片玻璃的栅格号 找到相同流程卡号的空格"); return downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .eq("escd.flow_card_id", flowcardid) .gt("t.remain_width", width) .orderByAsc("escd.tempering_feed_sequence") ); } @@ -178,4 +179,222 @@ @Override public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { log.info(" 单片情况 查询可进此片玻璃的栅格号 找到相同流程卡号的空格"); return downStorageCageMapper.selectJoinList( DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>() .select("escd.*") .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") .isNotNull("escd.slot") .eq("escd.flow_card_id", flowcardid) .gt("t.remain_width", width) .orderByAsc("escd.sequence") ); } // @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") // ); // } @Override public boolean processInto(String Number) { glassInfoService = WebSocketServer.applicationContext.getBean(GlassInfoService.class); downStorageCageService = WebSocketServer.applicationContext.getBean(DownStorageCageService.class); //按id查询玻璃信息表里的玻璃 GlassInfo GlassInfo = glassInfoService.selectGlassId(Number); PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; //存在此玻璃编号 if (GlassInfo != null) { //同找到同流程卡附近空格 List<DownStorageCageDetails> list = downStorageCageService.getIsExistIntoCacheByflowcardid(GlassInfo.getFlowcardId(), GlassInfo.getWidth()); if (list.size() > 0) { //存在空格 //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) //2.回复 1进片 DownStorageCageDetails item = list.get(0); //selectInfo.insertCacheTask(GlassInfo.getId() + "", "0", item.getSlot() + "", "1", GlassInfo.getWidth(), GlassInfo.getHeight(), GlassInfo.getFilmsid(), GlassInfo.getThickness(), GlassInfo.getFlowcardId()); DownGlassTask downGlassTask = new DownGlassTask(); downGlassTask.setId(GlassInfo.getId()); // 设置玻璃ID downGlassTask.setStartCell("0"); downGlassTask.setTaskType("1"); downGlassTask.setEndCell(item.getSlot()+""); downGlassTask.setWidth(GlassInfo.getWidth()); // 设置玻璃宽度 downGlassTask.setHeight(GlassInfo.getHeight()); // 设置玻璃高度 downGlassTask.setFilmsid(GlassInfo.getFilmsid()+""); // 设置膜ID downGlassTask.setThickness(GlassInfo.getThickness()); // 设置玻璃厚度 downGlassTask.setFlowCardId(GlassInfo.getFlowcardId()); // 设置流程卡号 downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); //完成后插入小片数据到缓存表 return true; } } else { // ID编号不存在 不处理/回复PLC 进行报警提示 } //返回结果 return false; } /** * 理片 出 * @return */ // @Override public boolean processOut() { // 查询任务 PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; List<DownStorageCageDetails> list = downStorageCageService.getCacheOut(1, 5); List<DownStorageCageDetails> list2 = downStorageCageService.getCacheOut(6, 10); List<DownStorageCageDetails> list3 = downStorageCageService.getCacheOut(1, 10); //自动绑定架子 // 优先 超出尺寸优先人工出片 人工处理 if (!list3.isEmpty()) { DownStorageCageDetails item3 = list3.get(0); if (item3.getHeight() >= 1 && item3.getWidth() >= 1) { String endcell = "13"; 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()); // 设置流程卡号 downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; } } //同时请求 优先后端出片 else if (!list3.isEmpty()) { DownStorageCageDetails item3 = list3.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()); // 设置流程卡号 downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; } // 按照大小符合前端出片 else if (!list.isEmpty()) { DownStorageCageDetails item = list.get(0); // 出到 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); 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()); // 设置流程卡号 downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "2"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; } // 返回结果 return false; } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -133,5 +133,9 @@ } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownGlassLogic.java
File was deleted hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
@@ -27,6 +27,6 @@ int updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId); void insertdownglassinfo(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -3,12 +3,16 @@ 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.mes.downglassinfo.entity.DownGlassInfo; import com.mes.downglassinfo.entity.DownGlassTask; 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.mapper.DownWorkstationMapper; import com.mes.downworkstation.mapper.DownWorkstationTaskMapper; import com.mes.downworkstation.service.DownWorkstationService; import com.mes.downworkstation.service.DownWorkstationTaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -21,9 +25,17 @@ @Autowired private DownWorkstationMapper downWorkstationMapper; @Autowired private DownWorkstationTaskMapper downWorkstationTaskMapper; @Autowired private DownGlassInfoService downGlassInfoService; @Autowired private DownGlassTaskService downGlassTaskService; @Autowired private DownWorkstationService downWorkstationService; @Autowired private DownWorkstationTaskService downWorkstationTaskService; // @Override // public List<DownWorkstation> gettwoDownWorkstations() { @@ -126,4 +138,80 @@ @Override public void insertdownglassinfo() { List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState(); // if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) { // for (DownGlassTask downGlassInfo : taskdownGlassInf) { // 创建新的 DownGlassInfo 对象并设置相关属性 DownGlassInfo newdownGlassInfo = new DownGlassInfo(); newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId()); Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId()); // 初始化顺序字段值 int sequence = maxSequence != null ? maxSequence + 1 : 1; newdownGlassInfo.setWidth(downGlassInfo.getWidth()); newdownGlassInfo.setHeight(downGlassInfo.getHeight()); newdownGlassInfo.setThickness(downGlassInfo.getThickness()); newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid()); // 设置顺序字段值 newdownGlassInfo.setSequence(sequence); // 插入数据到下片玻璃信息表 downGlassInfoService.insertDownGlassInfo(newdownGlassInfo); //插入数据到机械手任务表 downWorkstationTaskService.insertdownWorkstationtask(newdownGlassInfo); //更新下片任务表状态为0 downGlassTaskService.updateTaskStateToZero(downGlassInfo.getId()); sequence++; // 递增顺序字段值 } } try { //查询下片工位表中架子是否绑定了流程卡号 工位表和任务表中状态为1的流程卡号和已落架数量 List<DownWorkstation> taskdownWorkstation = downWorkstationMapper.selectdownWorkstationstate(); if (taskdownWorkstation != null && !taskdownWorkstation.isEmpty()) { //,如果已经绑定则更新已落架数量,并且删除下片任务表中的记录 for (DownWorkstation downWorkstation : taskdownWorkstation) { //更新下片工位表中已落架数量 downWorkstationService.updateracksnumber(downWorkstation.getFlowCardId(), downWorkstation.getRacksnumber() + 1); //更新机械任务表中状态为0 downWorkstationTaskService.updateTaskStateToZero(downWorkstation.getId()); //删除下片任务表中的记录 downGlassTaskService.deleteTask(downWorkstation.getId()); } } } catch (Exception e) { // 打印异常信息 e.printStackTrace(); // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息 } } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/service/impl/GlassInfoServiceImpl.java
@@ -39,7 +39,7 @@ @Override public List<Map<String, Object>> getFlowCardId() { return baseMapper.selectMaps(new QueryWrapper<GlassInfo>().select("DISTINCT flowcard_id")); return baseMapper.selectMaps(new QueryWrapper<GlassInfo>().select("DISTINCT flow_card_id")); }