From 58137d4f560dc16900ea99e0a7a07080b7751e5f Mon Sep 17 00:00:00 2001 From: zyx <zyx123456> Date: 星期一, 20 十一月 2023 20:17:47 +0800 Subject: [PATCH] Merge branch 'tzskasrs' of http://47.97.1.152:5880/r/zy-asrs into tzskasrs --- src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java | 60 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java b/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java index a616b3d..b22bdd1 100644 --- a/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java +++ b/src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java @@ -4,15 +4,14 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.core.common.Cools; import com.core.exception.CoolException; -import com.zy.asrs.entity.AgvLocDetl; -import com.zy.asrs.entity.AgvWaitPakin; -import com.zy.asrs.entity.AgvWrkDetl; -import com.zy.asrs.entity.AgvWrkMast; +import com.zy.asrs.entity.*; import com.zy.asrs.service.*; import com.zy.asrs.task.AbstractHandler; import com.zy.asrs.task.core.ReturnT; +import lombok.Synchronized; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,24 +23,29 @@ @Service public class AgvWrkMastHandler extends AbstractHandler<String> { + @Value("${agvBasDev.maxWorkNum}") + private int maxWrokNum; + @Autowired - AgvWrkMastService agvWrkMastService; + private AgvWrkMastService agvWrkMastService; @Autowired - AgvLocMastService agvLocMastService; + private AgvLocMastService agvLocMastService; @Autowired - AgvLocDetlService agvLocDetlService; + private AgvLocDetlService agvLocDetlService; @Autowired - AgvWrkMastLogService agvWrkMastLogService; + private AgvWrkMastLogService agvWrkMastLogService; @Autowired - AgvWrkDetlService agvWrkDetlService; + private AgvWrkDetlService agvWrkDetlService; @Autowired - AgvWrkDetlLogService agvWrkDetlLogService; + private AgvWrkDetlLogService agvWrkDetlLogService; @Autowired - AgvWaitPakinService agvWaitPakinService; + private AgvWaitPakinService agvWaitPakinService; @Autowired - AgvWaitPakinLogService agvWaitPakinLogService; + private AgvWaitPakinLogService agvWaitPakinLogService; @Autowired - OrderService orderService; + private OrderService orderService; + @Autowired + private AgvBasDevpService agvBasDevpService; @Transactional public ReturnT<String> completedPutWayWrk(AgvWrkMast agvWrkMast) { @@ -54,10 +58,10 @@ agvWrkMastService.updateById(agvWrkMast); if(agvWrkMast.getIoType() == 10){ // 绌烘澘鍏ュ簱 璁剧疆搴撲綅鐘舵�佷负D.绌烘《/绌烘爤鏉� - agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D"); + agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D",agvWrkMast.getBarcode()); }else{ //淇敼鐩爣搴撲綅鐘舵�佷负F.鍦ㄥ簱 - agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"F"); + agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"F",agvWrkMast.getBarcode()); } //鐢熸垚AGV宸ヤ綔鍘嗗彶妗� agvWrkMastLogService.save(agvWrkMast); @@ -79,7 +83,7 @@ //鏇存柊搴撳瓨鏄庣粏 agvLocDetlService.updateStock(agvWrkMast.getSourceLocNo(),agvWrkMast.getLocNo()); //淇敼婧愬簱浣嶇姸鎬佷负O - agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O"); + agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O",""); } //鍒犻櫎AGV宸ヤ綔妗� @@ -110,7 +114,7 @@ agvWrkMast.setWrkSts(207L); agvWrkMastService.updateById(agvWrkMast); //淇敼婧愬簱浣嶇姸鎬佷负O - agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O"); + agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O",""); if(agvWrkMast.getIoType() == 101){ //鏇存柊鐩爣搴撲綅鏄庣粏 101.鍑哄簱 鍒犻櫎婧愬簱浣嶅簱瀛樻槑缁� agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",agvWrkMast.getSourceLocNo())); @@ -159,7 +163,6 @@ continue; } } - //202.RCS鍙栬揣涓� agvWrkMast.setWrkSts(202L); agvWrkMastService.updateById(agvWrkMast); @@ -168,10 +171,8 @@ agvWaitPakinService.updateIoStatus(agvWrkMast.getWrkNo(),"Y"); } } - return SUCCESS; } - return FAIL; } @@ -192,6 +193,25 @@ return FAIL; } + @Synchronized + @Transactional + public ReturnT<String> dealWatiWrk(List<AgvWrkMast> agvWrkMastList) throws IOException { + + agvWrkMastList.forEach(agvWrkMast -> { + //鏌ヨ璇ョ珯鐐规墍鏈夋殏瀛樹綅鍦ㄥ伐浣滄。涓嚭鐜扮殑娆℃暟 + List<Map<String, Object>> devNoMaps = agvBasDevpService.selectDevNoAndNumBystationCode(agvWrkMast.getLocNo()); + //鍙栫涓�涓殏瀛樹綅锛屽苟鏌ヨ鍏舵鏁颁笌閰嶇疆鐨勬鏁板仛姣旇緝 + Map<String, Object> devNoMap = devNoMaps.get(0); + if((int)devNoMap.get("num") < maxWrokNum){ + agvWrkMast.setLocNo(devNoMap.get("dev_no").toString()); + agvWrkMastService.updateById(agvWrkMast); + log.info("after锛�" + devNoMap.toString() + ", wrkNo:" + agvWrkMast.getWrkNo() + ", locNo: " + agvWrkMast.getLocNo()); + } + }); + + return SUCCESS; + } + private String getOrderNoByWrkNo(int wrkNo){ AgvWrkDetl agvWrkDetl = agvWrkDetlService.selectOne(new EntityWrapper<AgvWrkDetl>().eq("wrk_no", wrkNo)); if(Cools.isEmpty(agvWrkDetl)){ -- Gitblit v1.9.1