From e1c7f150792a5085dd64e86e6af82820ab34dc05 Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 03 九月 2024 08:06:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/tzskasrs-2' into tzskasrs-2 --- src/main/java/com/zy/common/web/WcsController.java | 126 +++++++++++++++++++++++++++++------------- 1 files changed, 87 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java index 45f3aff..c748620 100644 --- a/src/main/java/com/zy/common/web/WcsController.java +++ b/src/main/java/com/zy/common/web/WcsController.java @@ -15,13 +15,13 @@ import com.zy.common.service.CommonService; import com.zy.common.web.param.ReplenishmentParam; import com.zy.common.web.param.SearchLocParam; +import lombok.Synchronized; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; -import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -177,10 +177,23 @@ return R.parse(CodeRes.NO_COMB_700); } + boolean checkTimeout = false; for (WaitPakin waitPakin : waitPakins) { Mat mat = matService.selectByMatnr(waitPakin.getMatnr()); mat.setWeight(waitPakin.getAnfme()); mats.add(mat); + + Date appeTime = waitPakin.getAppeTime(); + Date now = new Date(); + long diffTime = now.getTime() - appeTime.getTime(); + if (diffTime >= 1000 * 60 * 60 * 4) { + checkTimeout = true; + break; + } + } + + if (checkTimeout) { + return R.error("鎵樼洏缁勬墭瓒呮椂锛屽垹闄ゅ悗閲嶆柊缁勬墭"); } int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); @@ -495,21 +508,21 @@ throw new CoolException(dto.getLocNo() + "鐩爣搴撲綅宸茶鍗犵敤"); } - Date now = new Date(); - for (LocDetl locDetl : locDetls) { - locDetl.setLocNo(dto.getLocNo());//淇敼鐩爣搴撲綅 - locDetl.setAppeTime(now); - locDetl.setModiTime(now); - if (!locDetlService.insert(locDetl)) { - throw new CoolException("搴撳瓨鏄庣粏鏇存柊澶辫触"); - } - } +// Date now = new Date(); +// for (LocDetl locDetl : locDetls) { +// locDetl.setLocNo(dto.getLocNo());//淇敼鐩爣搴撲綅 +// locDetl.setAppeTime(now); +// locDetl.setModiTime(now); +// if (!locDetlService.insert(locDetl)) { +// throw new CoolException("搴撳瓨鏄庣粏鏇存柊澶辫触"); +// } +// } - //妫�鏌ョ洰鏍囧簱浣嶏紝搴撳瓨鏄庣粏鏄惁娣诲姞鎴愬姛 - List<LocDetl> checkLocDetls = locDetlService.selectByLocNo(dto.getLocNo()); - if (checkLocDetls.isEmpty()) { - throw new CoolException("搴撳瓨鏄庣粏杩佺Щ澶辫触"); - } +// //妫�鏌ョ洰鏍囧簱浣嶏紝搴撳瓨鏄庣粏鏄惁娣诲姞鎴愬姛 +// List<LocDetl> checkLocDetls = locDetlService.selectByLocNo(dto.getLocNo()); +// if (checkLocDetls.isEmpty()) { +// throw new CoolException("搴撳瓨鏄庣粏杩佺Щ澶辫触"); +// } // //娓呯┖婧愬簱浣嶆暟鎹� LocMast locMast1 = locMastService.selectByLoc(wrkMast.getSourceLocNo()); @@ -529,7 +542,7 @@ } //鑾峰彇鍥炲簱鎻愬崌鏈虹洰鏍囩珯 - Integer staNo = liftNo * 100 + locMast1.getLev1(); + Integer staNo = liftNo * 100 + locMast.getLev1(); // 鏇存柊宸ヤ綔妗f暟鎹姸鎬� wrkMast.setIoType(wrkMast.getIoType() - 50); // 鍏ュ嚭搴撶被鍨�: 103->53,104->54 @@ -575,8 +588,9 @@ */ @PostMapping("/start") @ResponseBody - public R start(@RequestBody ReplenishmentParam param){ - + @Transactional + public synchronized R start(@RequestBody ReplenishmentParam param){ + log.info("agv start param: " + param.toString()); String containerCode = param.getContainerCode(); if(Cools.isEmpty(containerCode)){ throw new CoolException("鏂欑鐮佷负绌�"); @@ -611,7 +625,7 @@ } //鍏ュ簱浠诲姟 - if (!Cools.isEmpty(agvWaitPakinService.selectByContainerCode(containerCode))){ + if (!Cools.isEmpty(agvWaitPakinService.selectByContainerCode(containerCode)) && Cools.isEmpty(agvWrkMast)){ //缁戝畾绔欑偣 agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"F",containerCode); //鐢熸垚宸ヤ綔妗� @@ -629,11 +643,14 @@ @ResponseBody public R move(@RequestBody ReplenishmentParam param){ + log.info("current containerCode: " + param.toString()); + if(Cools.isEmpty(currentContainerMap)){ currentContainerMap = new HashMap<>(); } - String containerCode = param.getContainerCode(); + String containerCode = param.getContainerCode().split(";")[0]; + if(Cools.isEmpty(containerCode)){ throw new CoolException("鏂欑鐮佷负绌�"); } @@ -651,19 +668,22 @@ //鏌ヨ鏃у鍣ㄧ殑宸ヤ綔妗� AgvWrkMast agvWrkMast = agvWrkMastService.selectByContainerCode(currentContainerCode); if(!Cools.isEmpty(agvWrkMast) && agvWrkMast.getIoType() == 101){ - //鍙戦�佸鍣ㄧ珛鍦鸿姹傦紝瀹屾垚宸ヤ綔妗� - List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); - agvWrkMastList.add(agvWrkMast); - try { - int code = agvWrkMastService.containerMoveOut(agvWrkMastList); - if(code == 0){ - //灏嗗伐浣滃厷鐘舵�佹敼涓哄鍣ㄧ鍦� - agvWrkMast.setWrkSts(206L); - agvWrkMastService.updateById(agvWrkMast); - } - } catch (IOException e) { - log.error(e.getMessage()); - } + //灏嗗伐浣滃厷鐘舵�佹敼涓哄鍣ㄧ鍦� + agvWrkMast.setWrkSts(206L); + agvWrkMastService.updateById(agvWrkMast); +// //鍙戦�佸鍣ㄧ珛鍦鸿姹傦紝瀹屾垚宸ヤ綔妗� +// List<AgvWrkMast> agvWrkMastList = new ArrayList<>(); +// agvWrkMastList.add(agvWrkMast); +// try { +// int code = agvWrkMastService.containerMoveOut(agvWrkMastList); +// if(code == 0){ +// //灏嗗伐浣滃厷鐘舵�佹敼涓哄鍣ㄧ鍦� +// agvWrkMast.setWrkSts(206L); +// agvWrkMastService.updateById(agvWrkMast); +// } +// } catch (IOException e) { +// log.error(e.getMessage()); +// } } } @@ -679,8 +699,20 @@ @ResponseBody public R containerMove(@RequestBody ReplenishmentParam param){ - String devNo = param.getDevNo(); - String containerCode = currentContainerMap.get(devNo); + String devNo = Cools.eq("CS-310",param.getDevNo()) ? "310-1" : Cools.eq("CS-311",param.getDevNo()) ? "312-2" : Cools.eq("CS-312",param.getDevNo()) ? "314-1" : Cools.eq("CS-313",param.getDevNo()) ? "316-1" : null; + + if(Cools.isEmpty(devNo)){ + return R.error("绔欑偣鏈夎"); + } + + AgvBasDevp agvBasDevp = agvBasDevpService.selectById(devNo); + String containerCode = agvBasDevp.getBarcode(); + +// String devNo = param.getDevNo(); +// if(Cools.isEmpty(currentContainerMap)){ +// currentContainerMap = new HashMap<>(); +// } +// String containerCode = currentContainerMap.get(devNo); AgvBasDevpDto agvBasDevpDto = new AgvBasDevpDto(); @@ -689,7 +721,7 @@ if(!Cools.isEmpty(agvWrkMast)){ List<AgvWrkDetl> agvWrkDetlList = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("wrk_no", agvWrkMast.getWrkNo())); - for (AgvWrkDetl agvWrkDetl : AgvWrkDetlList){ + for (AgvWrkDetl agvWrkDetl : agvWrkDetlList){ agvWrkDetl.setVolume(agvWrkDetl.getAnfme()); if(agvWrkMast.getIoType() == 103){ //瀵绘壘鏄惁鏈夌浉鍚岀墿鏂欑殑宸ヤ綔妗f槑缁嗭紝骞惰繑鍥炴暟閲忎箣鍜� @@ -707,17 +739,33 @@ } } }; + if (agvWrkMast.getIoType() == 103){ + List<AgvLocDetl> suppCodes = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("supp_code", agvWrkMast.getBarcode())); + if (!Cools.isEmpty(suppCodes)){ + for (AgvLocDetl agvLocDetl : suppCodes){ + AgvWrkDetl agvWrkDetl = new AgvWrkDetl(agvLocDetl.getSuppCode(), agvLocDetl.getMatnr(), agvLocDetl.getMaktx(), agvLocDetl.getSpecs(), agvLocDetl.getAnfme()); + agvWrkDetlList.add(agvWrkDetl); + } + + } + } - return R.ok(agvWrkDetlList).add(agvWrkMast); + agvBasDevpDto.setAgvWrkDetls(agvWrkDetlList); + agvBasDevpDto.setAgvWrkMast(agvWrkMast); } //鏌ユ壘璇ュ鍣ㄧ殑鍏ュ簱閫氱煡妗� List<AgvWaitPakin> agvWaitPakinList = agvWaitPakinService.selectList(new EntityWrapper<AgvWaitPakin>().eq("supp_code", containerCode)); if(!Cools.isEmpty(agvWaitPakinList)){ - return R.ok(agvWaitPakinList); + agvBasDevpDto.setAgvWaitPakins(agvWaitPakinList); } - return R.error("娌℃湁璇ュ鍣ㄧ殑鍑哄簱銆佹嫞鏂欍�佸叆搴撲俊鎭瓑"); + //System.out.println("currentContainerMap: " + currentContainerMap); + + + //System.out.println("agvBasDevpDto: " + agvBasDevpDto); + + return R.ok(agvBasDevpDto); } private double getAllAnfmeInAgvWrkDetlList(List<AgvWrkDetl> agvWrkDetlList, AgvWrkDetl wd0) { -- Gitblit v1.9.1