hangzhoumesParent/common/servicebase/src/main/java/com/mes/uppattenusage/controller/UpPattenUsageController.java
@@ -1,56 +1,56 @@ package com.mes.uppattenusage.controller; import com.mes.glassinfo.service.GlassInfoService; import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; import com.mes.uppattenusage.entity.UpPattenUsage; import com.mes.glassinfo.entity.GlassInfo; import com.mes.uppattenusage.service.UpPattenUsageService; import com.mes.utils.Result; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * <p> * 前端控制器 * </p> * * @author zhoush * @since 2024-04-18 */ @RestController @RequestMapping("/up-patten-usage") @Slf4j public class UpPattenUsageController { @Autowired private UpPattenUsageService upPattenUsageService; @Autowired private GlassInfoService glassInfoService; @ApiOperation("显示正在出片的工程信息") @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 public Result<List<UpPattenUsage>> prioritylist() { List<UpPattenUsage> glass = upPattenUsageService.prioritylist(1); log.info("显示工位上的玻璃信息:{}", glass); return Result.build(200, "", glass); } @ApiOperation("点击选择工程保存后进行调用,传入工程号") @GetMapping("/saveUpPattenUsage") //查询现在上片机的玻璃信息 public Result<Integer> saveUpPattenUsage(String engineeringId) { List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineeringId); log.info("将查询出的UpPattenUsage数据保存到数据库表里"); upPattenUsageService.saveUpPattenUsage(upPattenUsages); log.info("从PP表查询glassinfo的数据并保存到表里"); List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineeringId); return Result.build(200, "", 200); } } // //import com.mes.uppattenusage.service.GlassInfoService; //import com.mes.uppattenusage.entity.OptimizeUpPattenUsage; //import com.mes.uppattenusage.entity.UpPattenUsage; //import com.mes.glassinfo.entity.GlassInfo; //import com.mes.uppattenusage.service.UpPattenUsageService; //import com.mes.utils.Result; //import io.swagger.annotations.ApiOperation; //import lombok.extern.slf4j.Slf4j; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.web.bind.annotation.GetMapping; //import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RestController; // //import java.util.List; // ///** // * <p> // * 前端控制器 // * </p> // * // * @author zhoush // * @since 2024-04-18 // */ //@RestController //@RequestMapping("/up-patten-usage") //@Slf4j //public class UpPattenUsageController { // // @Autowired // private UpPattenUsageService upPattenUsageService; // @Autowired // private GlassInfoService glassInfoService; // @ApiOperation("显示正在出片的工程信息") // @GetMapping("/prioritylist") //查询现在上片机的玻璃信息 // public Result<List<UpPattenUsage>> prioritylist() { // List<UpPattenUsage> glass = upPattenUsageService.prioritylist(1); // log.info("显示工位上的玻璃信息:{}", glass); // return Result.build(200, "", glass); // } // // @ApiOperation("点击选择工程保存后进行调用,传入工程号") // @GetMapping("/saveUpPattenUsage") //查询现在上片机的玻璃信息 // public Result<Integer> saveUpPattenUsage(String engineeringId) { // List<UpPattenUsage> upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineeringId); // log.info("将查询出的UpPattenUsage数据保存到数据库表里"); // upPattenUsageService.saveUpPattenUsage(upPattenUsages); // log.info("从PP表查询glassinfo的数据并保存到表里"); // List<GlassInfo> glassinfo=glassInfoService.selectGlassInfo(engineeringId); // return Result.build(200, "", 200); // } //} hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/Plcdownglass.java
@@ -28,22 +28,17 @@ private DownWorkstationService downWorkstationService; // @Scheduled(fixedDelay = 300) @Scheduled(fixedDelay = 300) public void PlcdownglassTask() throws InterruptedException { JSONObject jsonObject = new JSONObject(); try { Thread.sleep(300); // String result = S7control.getinstance().ReadWord("DB14.0", 1).get(0) + ""; // String number = S7control.getinstance().ReadWord("DB14.2", 1).get(0) + ""; String result ="1"; String number ="1"; String result = "2"; String number = "1"; // 进片请求 if (RESULT_IN.equals(result)) { downStorageCageService.processInto(number); @@ -60,7 +55,7 @@ } } //下片更新 //下片更新 downWorkstationService.insertdownglassinfo(); } catch (Exception e) { e.printStackTrace(); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassTask.java
@@ -71,5 +71,8 @@ */ private Integer taskStauts; /** * 玻璃id */ private String glassId; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassInfoService.java
@@ -8,13 +8,12 @@ /** * @param flowCardId * @return // 根据流程卡号查询最大序号 * @return // 根据流程卡号查询最大序号 */ Integer getMaxSequenceByFlowCardId(String flowCardId); /** * @param downGlassInfo * 插入下片信息 * @param downGlassInfo 插入下片信息 */ void insertDownGlassInfo(DownGlassInfo downGlassInfo); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassTaskService.java
@@ -16,38 +16,49 @@ public interface DownGlassTaskService extends IService<DownGlassTask> { /** * 查询任务状态为1的信息 * * @return */ List<DownGlassTask> getUnloadingTaskState(); /** * 更新任务状态 * * @return */ void updateTaskStateToZero(long id); /** * 删除任务 * * @return */ void deleteTask(String id); /** * 查询出片任务 * * @return */ DownGlassTask selectLastOutCacheInfo(String endCell); /** * 插入任务 * * @return */ Integer insertCacheTask(DownGlassTask downGlassTask); /** * 查询进片任务 * * @return */ List<DownGlassTask> selectInputTaskCache(); /** * 查询出片任务 备用 * * @return */ List<DownGlassTask> selectOutTaskCache(); hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -41,8 +41,4 @@ } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassTaskServiceImpl.java
@@ -60,40 +60,39 @@ @Override public Integer insertCacheTask(DownGlassTask downGlassTask) { DownGlassTask glassInfo = new DownGlassTask(); // 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()); BeanUtils.copyProperties(downGlassTask,glassInfo); glassInfo.setTaskStauts(0); // 默认任务状态为0 // 查询数据库,检查主键值是否已经存在 DownGlassTask existingTask = baseMapper.selectById(downGlassTask.getId()); if (existingTask != null) { // 如果已存在相同主键值的任务,则不进行插入操作,返回 null 或者抛出异常 // 这里简单起见,直接返回 null return null; } int rows = baseMapper.insert(glassInfo); // 如果主键值不存在,则进行插入操作 DownGlassTask newDownGlassTask = new DownGlassTask(); BeanUtils.copyProperties(downGlassTask, newDownGlassTask); newDownGlassTask.setTaskStauts(0); // 默认任务状态为0 int rows = baseMapper.insert(newDownGlassTask); return rows > 0 ? rows : null; } @Override public List<DownGlassTask> selectInputTaskCache(){ return baseMapper.selectList(new QueryWrapper<DownGlassTask>().eq("task_status",0).eq("task_type",1)); 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)); 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/controller/DownStorageCageDetailsController.java
@@ -34,7 +34,7 @@ @GetMapping("/selectStorageCage") @ResponseBody public Result selectEdgStorageCage () { List<Map> list=downStorageCageService.getCacheInfo(); List<Map> list=downStorageCageDetailsService.getCacheInfo(); return Result.build(200,"成功",list); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/entity/DownStorageCage.java
@@ -1,6 +1,7 @@ package com.mes.downstorage.entity; 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; @@ -48,6 +49,7 @@ * 启用状态 */ @ApiModelProperty(value = "启用状态", position = 5) @TableField("enable_state") private String enableState; /** hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/entity/DownStorageCageDetails.java
@@ -86,7 +86,7 @@ /** * 膜系id */ private int filmsid; private String filmsid; /** * 状态 */ hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageDetailsService.java
@@ -8,17 +8,16 @@ public interface DownStorageCageDetailsService { /** * @return //添加理片笼内信息 * @return //添加理片笼内信息 */ void addDownStorageCageDetails(DownStorageCageDetails details); /** * @return //修改理片笼内信息 * @return //修改理片笼内信息 */ boolean updatedownStorageCageDetails(DownStorageCageDetails details); List<DownStorageCageDetails> getCacheLeisure(); /** @@ -29,7 +28,7 @@ List<DownStorageCageDetails> getCacheOut(int start, int end); /** * @return 查询笼子内信息 * @return 查询笼子内信息 */ List<Map> getCacheInfo(); @@ -44,11 +43,13 @@ /** * @param start * @param end * @return log.info("单片情况根据传入的工位查询符合按照大小出片,并且优先出满架的小片"); * @return log.info(" 单片情况根据传入的工位查询符合按照大小出片, 并且优先出满架的小片 "); */ List<DownStorageCageDetails> CacheOut(int start, int end); /** * @return 查询空格子 */ List<DownStorageCageDetails> selectCacheEmpty2(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageService.java
@@ -22,19 +22,21 @@ // List<Map<String, Object>> selectCacheLeisure(); /** * @param Number * @return 进片 * @return 进片 */ boolean processInto(String Number); /** * * @return 出片 * @return 空格 */ /** * @return 出片 */ boolean processOut(); List<DownStorageCageDetails> selectCacheEmpty() ; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageDetailsServiceImpl.java
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.toolkit.JoinWrappers; import com.mes.downstorage.entity.DownStorageCage; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; @@ -143,6 +144,9 @@ .orderByAsc("escd.sequence") ); } @@ -157,4 +161,6 @@ } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,5 +1,6 @@ package com.mes.downstorage.service.impl; import com.github.yulichang.toolkit.JoinWrappers; import com.mes.common.PLCAutoMes; import com.mes.common.S7control; import com.mes.device.PlcParameterObject; @@ -19,6 +20,7 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; /** * <p> @@ -65,11 +67,11 @@ public DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell,String taskType ) { DownGlassTask downGlassTask = new DownGlassTask(); BeanUtils.copyProperties(downGlassTask,glassInfo); BeanUtils.copyProperties(glassInfo,downGlassTask); downGlassTask.setStartCell(startCell); downGlassTask.setTaskType(taskType); downGlassTask.setEndCell(endCell); @@ -80,7 +82,7 @@ public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell,String taskType ) { DownGlassTask downGlassTask = new DownGlassTask(); BeanUtils.copyProperties(downGlassTask,glassInfo); BeanUtils.copyProperties(glassInfo,downGlassTask); downGlassTask.setStartCell(startCell); downGlassTask.setTaskType(taskType); downGlassTask.setEndCell(endCell); @@ -97,13 +99,13 @@ //存在此玻璃编号 if (GlassInfo != null) { //同找到同流程卡附近空格 List<DownStorageCageDetails> list = downStorageCageDetailsService.getIsExistIntoCacheByflowcardid(GlassInfo.getFlowcardId(), GlassInfo.getWidth()); List<DownStorageCageDetails> list = selectCacheEmpty(); List<DownStorageCageDetails> selectCacheEmpty=downStorageCageDetailsService.selectCacheEmpty2(); // list<Map> list=selectCacheEmpty(); // list<Map> = downStorageCageService.selectCacheEmpty(); if (selectCacheEmpty.size() > 0) { if (list.size() > 0) { //存在空格 //1.生成任务: 起始位置0 结束位置this.slot 任务类型 1 (进片任务) //2.回复 1进片 @@ -115,7 +117,7 @@ downGlassTaskService.insertCacheTask(downGlassTask); S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); //完成后插入小片数据到缓存表 @@ -159,13 +161,13 @@ 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 =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"); // S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), SendEndcell); // S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; } } @@ -177,7 +179,7 @@ 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 =createDownGlassTask(item3,"0",endcell,"2"); downGlassTaskService.insertCacheTask(downGlassTask); @@ -191,7 +193,7 @@ 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 =createDownGlassTask(item,"0","06","2"); downGlassTaskService.insertCacheTask(downGlassTask); @@ -204,7 +206,7 @@ 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 =createDownGlassTask(item2,"0","11","2"); downGlassTaskService.insertCacheTask(downGlassTask); @@ -222,8 +224,17 @@ } @Override public List<DownStorageCageDetails> selectCacheEmpty() { return baseMapper.selectJoinList(DownStorageCageDetails.class, JoinWrappers.lambda(DownStorageCage.class) .selectAll(DownStorageCage.class) .select(DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getGlassId) .leftJoin(DownStorageCageDetails.class, on -> on .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot)) .isNull(DownStorageCageDetails::getSlot) ); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstationTask.java
@@ -55,6 +55,8 @@ * 任务状态 */ private Integer state; /** * 玻璃 */ private String glassId; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
@@ -19,22 +19,19 @@ /** * @param startId * @param endId * @return * 获取工位信息 * @return 获取工位信息 */ List<DownWorkstation> getoneDownWorkstations(int startId, int endId); /** * @param workstationId * @return * 获取总数量 * @return 获取总数量 */ int getTotalQuantity(int workstationId); /** * @param workstationId * @return * 获取落架数量 * @return 获取落架数量 */ int getRacksNumber(int workstationId); @@ -45,8 +42,7 @@ /** * @param flowCardId * @param racksnumber * 更新落架数量 * @param racksnumber 更新落架数量 */ void updateracksnumber(String flowCardId, int racksnumber); @@ -58,11 +54,12 @@ * @return 更新架子和数量 */ int updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId); void insertdownglassinfo(); /** * @return // * @return // * 工位显示 */ List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(); List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationTaskService.java
@@ -16,20 +16,17 @@ */ public interface DownWorkstationTaskService extends IService<DownWorkstationTask> { /** * @param downGlassInfo * 插入任务 * @param downGlassInfo 插入任务 */ void insertdownWorkstationtask(DownGlassInfo downGlassInfo); /** * @param Id * 更新任务状态 * @param Id 更新任务状态 */ void updateTaskStateToZero(long Id); /** * @return * 获取任务状态为1的信息 * @return 获取任务状态为1的信息 */ List<DownWorkstationTask> getTaskState(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/glassinfo/entity/GlassInfo.java
@@ -32,7 +32,7 @@ * 流程卡 */ @TableField("flow_card_Id") private String flowcardId; private String flowCardId; /** * 流程卡玻璃类型 @@ -57,7 +57,7 @@ /** * 膜系 */ private Integer filmsid; private String filmsid; /** * 磨前宽 hangzhoumesParent/moduleService/UnLoadGlassModule/src/test/java/mes/UnloadGlassModuleApplicationTest.java
@@ -135,7 +135,7 @@ public void selectCacheEmpty2() { downStorageCageDetailsService.selectCacheEmpty2(); downStorageCageServiceImpl.selectCacheEmpty(); }