From b365a0879edc787655b908b0dbb65b5e966bb23b Mon Sep 17 00:00:00 2001 From: 严智鑫 <test> Date: 星期二, 07 五月 2024 09:03:08 +0800 Subject: [PATCH] 公共yml文件 ip 改回10.153.19.150 --- hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java | 221 ++++++++----------------------------------------------- 1 files changed, 33 insertions(+), 188 deletions(-) diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java index fe782a6..d1a6673 100644 --- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java +++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java @@ -1,6 +1,6 @@ package com.mes.downstorage.service.impl; -import com.github.yulichang.query.MPJQueryWrapper; +import com.github.yulichang.toolkit.JoinWrappers; import com.mes.common.PLCAutoMes; import com.mes.common.S7control; import com.mes.device.PlcParameterObject; @@ -9,14 +9,13 @@ 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.DownStorageCageDetailsService; 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.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -38,167 +37,12 @@ private DownStorageCageMapper downStorageCageMapper; @Autowired - private DownStorageCageDetailsMapper downStorageCageDetailsMapper; - - @Autowired private GlassInfoService glassInfoService; @Autowired private DownGlassTaskService downGlassTaskService; @Autowired private DownStorageCageDetailsService downStorageCageDetailsService; - @Override - public List<Map> gettask(){ - downStorageCageMapper.selectList(null); -// downStorageCageMapper.selectJoin(); - return null; - }; - - - - @Override - public List<DownStorageCageDetails> getCacheLeisure() { - log.info(" 鏌ヨ绗煎瓙鍐呯┖闂�"); - List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( - DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() - .select("escd.*") - .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") - .isNull("escd.slot") - .orderByAsc("escd.slot") - ); - return list; - } - - - @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") - ); - } - - - - - - - - @Override - public List<DownStorageCageDetails> getCacheOut(int start, int end) { - log.info("鏍规嵁浼犲叆鐨勫伐浣嶆煡璇㈢鍚堟寜鐓ч『搴忓拰澶у皬鍑虹墖鐨勫皬鐗�"); - return downStorageCageMapper.selectJoinList( - DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() - .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") - .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id and gi.flowcard_id=escd.flow_card_id ") - .isNotNull("escd.slot") - .between("dw.workstation_id", start, end) - .orderByDesc("escd.width") - .orderByDesc("escd.height") - ); - } - - - - - - @Override - public List<Map> getCacheInfo() { - log.info(" 鏌ヨ绗煎瓙鍐呬俊鎭�"); - return downStorageCageMapper.selectJoinList( - Map.class, new MPJQueryWrapper<DownStorageCage>() - .select("escd.*") - .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") - .orderByAsc("t.slot") - ); - - } - - - - @Override - public List<DownStorageCageDetails> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) { - log.info(" 鏌ヨ鍙繘姝ょ墖鐜荤拑鐨勬爡鏍煎彿 鎵惧埌鐩稿悓鐗堝浘id骞朵笖澶т簬鍓嶉潰鐨勯『搴忕殑绌烘牸"); - List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList( - DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() - .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 list; - } - - - - - - - - @Override - public List<DownStorageCageDetails> IsExistIntoCacheByflowcardid(String flowcardid, double width) { - log.info(" 鏌ヨ鍙繘姝ょ墖鐜荤拑鐨勬爡鏍煎彿"); - return downStorageCageMapper.selectJoinList( - DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() - .select("escd.*") - .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") - .isNotNull("escd.slot") - .lt("escd.flow_card_id", flowcardid) - // 鏉′欢 t.remain_width - width > 0 - .apply("t.remain_width - " + width + " > 0") - .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") - ); - - } - - - @Override - public List<DownStorageCageDetails> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) { - log.info(" 鏌ヨ鍙繘姝ょ墖鐜荤拑鐨勬爡鏍煎彿"); - return downStorageCageMapper.selectJoinList( - DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() - .select("escd.*") - .leftJoin("down_storage_cage_details escd on t.slot = escd.slot") - .isNotNull("escd.slot") - .lt("escd.tempering_layout_id", tempering_layout_id) - // 鏉′欢 t.remain_width - width > 0 - .apply("t.remain_width - " + width + " > 0") - .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence") - ); - - } - - - - - - - - @Override - public List<DownStorageCageDetails> getIsExistIntoCacheByflowcardid(String flowcardid, double width) { - log.info(" 鍗曠墖鎯呭喌 鏌ヨ鍙繘姝ょ墖鐜荤拑鐨勬爡鏍煎彿 鎵惧埌鐩稿悓娴佺▼鍗″彿鐨勭┖鏍�"); - - return downStorageCageMapper.selectJoinList( - DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCage>() - .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") - ); - - } - - - @@ -225,32 +69,23 @@ public DownGlassTask createDownGlassTask(GlassInfo 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()); + BeanUtils.copyProperties(glassInfo,downGlassTask); + + downGlassTask.setStartCell(startCell); + downGlassTask.setTaskType(taskType); + downGlassTask.setEndCell(endCell); return downGlassTask; } public DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell,String taskType ) { DownGlassTask downGlassTask = new DownGlassTask(); - downGlassTask.setId(glassInfo.getId()); + + BeanUtils.copyProperties(glassInfo,downGlassTask); 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; } @@ -264,13 +99,13 @@ //瀛樺湪姝ょ幓鐠冪紪鍙� if (GlassInfo != null) { //鍚屾壘鍒板悓娴佺▼鍗¢檮杩戠┖鏍� - List<DownStorageCageDetails> list = getIsExistIntoCacheByflowcardid(GlassInfo.getFlowcardId(), GlassInfo.getWidth()); + List<DownStorageCageDetails> list = selectCacheEmpty(); - List<Map> selectCacheEmpty=selectCacheEmpty(); + // list<Map> list=selectCacheEmpty(); // list<Map> = downStorageCageService.selectCacheEmpty(); - if (selectCacheEmpty.size() > 0) { + if (list.size() > 0) { //瀛樺湪绌烘牸 //1.鐢熸垚浠诲姟锛� 璧峰浣嶇疆0 缁撴潫浣嶇疆this.slot 浠诲姟绫诲瀷 1 锛堣繘鐗囦换鍔★級 //2.鍥炲 1杩涚墖 @@ -282,7 +117,7 @@ downGlassTaskService.insertCacheTask(downGlassTask); - S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); + //S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); //瀹屾垚鍚庢彃鍏ュ皬鐗囨暟鎹埌缂撳瓨琛� @@ -326,25 +161,25 @@ 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; } } //濡傛灉鍚屾椂鍓嶅悗绔兘绌洪棽 浼樺厛鍚庣鍑虹墖骞朵笖浼樺厛婊℃灦 - else if (!list2.isEmpty()) { + else if (!list2.isEmpty()&&!list3.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 =createDownGlassTask(item3,"0",endcell,"2"); downGlassTaskService.insertCacheTask(downGlassTask); @@ -358,9 +193,10 @@ 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); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.28").getAddress(), "1"); S7control.getinstance().writeString(plcmes.getPlcParameter("DB14.20").getAddress(), "1"); return true; @@ -370,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); @@ -388,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) + ); + } } -- Gitblit v1.8.0