From 288e45a990a5abf4ab50f820ed4e870e8314468e Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期六, 21 六月 2025 15:14:10 +0800 Subject: [PATCH] 完善 --- src/main/java/com/zy/common/web/WcsController.java | 115 +++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 70 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java index 3a6f58f..d1c0b90 100644 --- a/src/main/java/com/zy/common/web/WcsController.java +++ b/src/main/java/com/zy/common/web/WcsController.java @@ -49,11 +49,13 @@ private LocDetlService locDetlService; @Autowired private TestMastService testMastService; + @Autowired + private MatService matService; - @Value("mes.url") + @Value("${mes.url}") private String mesUrl; - @Value("mes.inPath") + @Value("${mes.inPath}") private String inpath; @PostMapping("/pakin/loc/v1") @@ -66,28 +68,41 @@ if (Cools.isEmpty(param.getSourceStaNo())) { return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖"); } + + Date now = new Date(); List<WaitPakin> waitPakins = null; if (param.getIoType() == 1) { if (Cools.isEmpty(param.getBarcode())) { return R.error("鏉$爜涓嶈兘涓虹┖"); } waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); + List<WaitPakin> beBatch = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("be_batch", 1)); + if(beBatch.size() > 1){ + return R.error("缁勬墭妗d腑鏈夊鏉℃惉杩愪换鍔�"); + }else if(Cools.isEmpty(beBatch)){ + return R.error("缁勬墭妗d腑娌℃湁鎼繍浠诲姟"); + } if (Cools.isEmpty(waitPakins)) { WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); - if (wrkMast != null && wrkMast.getIoType() == 103) { - return R.parse(CodeRes.PICK_600); + if (wrkMast != null) { + return R.parse("600-閲嶅缁勬墭"); } - return R.parse(CodeRes.NO_COMB_700); - } - int countWait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode()) - .eq("io_status", "Y")); - int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); - int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); - if (countLoc > 0 || countWrk > 0 || countWait > 0) { - if (!Cools.isEmpty(waitPakins.get(0).getDeadWarn()) && waitPakins.get(0).getDeadWarn()!=0){ - return R.error(CodeRes.EXIST_500); + for (WaitPakin waitPakin : beBatch) { + waitPakin.setZpallet(param.getBarcode()); + waitPakinService.update(waitPakin,new EntityWrapper<WaitPakin>().eq("be_batch",1)); + } + }else { + int countWait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode()) + .eq("io_status", "Y")); + int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); + int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); + if (countLoc > 0 || countWrk > 0 || countWait > 0) { + if (!Cools.isEmpty(waitPakins.get(0).getDeadWarn()) && waitPakins.get(0).getDeadWarn()!=0){ + return R.error(CodeRes.EXIST_500); + } } } + } if (Cools.isEmpty(param.getLocType1())){ param.setLocType1((short)1); @@ -95,8 +110,7 @@ // 婧愮珯鐐圭姸鎬佹娴� BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), false); -// sourceStaNo.setLocType1(param.getLocType1()); - sourceStaNo.setLocType1((short)1); + sourceStaNo.setLocType1(param.getLocType1()); LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo); StartupDto dto = null; @@ -116,7 +130,7 @@ } /** - * 鍏ㄦ澘鍏ュ簱 + * 鍏ㄦ澘鍏ュ簱 */ @Transactional public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) { @@ -152,8 +166,11 @@ if (!res) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); } + // 鐩爣搴撲綅 + LocMast locMast = locMastService.selectById(dto.getLocNo()); + // 鐢熸垚宸ヤ綔妗f槑缁� - waitPakins.forEach(waitPakin -> { + for (WaitPakin waitPakin: waitPakins) { WrkDetl wrkDetl = new WrkDetl(); wrkDetl.sync(waitPakin); wrkDetl.setWrkNo(wrkMast.getWrkNo()); @@ -164,7 +181,42 @@ if (!wrkDetlService.insert(wrkDetl)) { throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触"); } - }); + + TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() + .eq("barcode", wrkDetl.getMatnr()) + .eq("user_id",wrkDetl.getZpallet()));//pack鐮� + if (Cools.isEmpty(testMast)){ + //鐢熸垚娴嬭瘯妗� + testMast=new TestMast(); + //鍏ュ緟娴嬪簱浣嶉�氶亾璁句负0 + if(locMast.getChannel()==null) { + testMast.setChannel(0);//閫氶亾璁句负0 + }else{ + testMast.setChannel(locMast.getChannel()); + } + testMast.setUserId(wrkMast.getBarcode());//鎵樼洏鐮� + testMast.setStatus(1); + testMast.setBarcode(wrkDetl.getMatnr()); + testMast.setLocNo(locMast.getLocNo()); + testMast.setModiTime(now); + testMast.setAppeTime(now); + if (!testMastService.insert(testMast)){ + throw new CoolException(wrkDetl.getMatnr()+"鐢熸垚娴嬭瘯妗eけ璐�"); + } + }else { + testMast.setBarcode(wrkDetl.getMatnr()); + testMast.setChannel(locMast.getChannel()); + testMast.setLocNo(locMast.getLocNo()); + testMast.setStatus(1); + testMast.setUserId(wrkMast.getBarcode());//鎵樼洏鐮� + testMast.setAppeTime(now); + if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){ + throw new CoolException(wrkDetl.getMatnr()+"鏇存柊娴嬭瘯妗eけ璐�"); + } + } + + + } // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>() .eq("zpallet", barcode); @@ -182,41 +234,14 @@ throw new CoolException("鏇存柊婧愮珯澶辫触"); } // 鏇存柊鐩爣搴撲綅鐘舵�� - LocMast locMast = locMastService.selectById(dto.getLocNo()); if (locMast.getLocSts().equals("O")){ locMast.setLocSts("S"); // S.鍏ュ簱棰勭害 locMast.setModiTime(now); if (!locMastService.updateById(locMast)){ throw new CoolException("鏀瑰彉搴撲綅鐘舵�佸け璐�"); - }else{ - //1.鎵爜涓婃姤 - CombParam combParam = new CombParam(); - combParam.setPackNo(locMast.getBarcode()); - combParam.setLocNo(locMast.getLocNo()); - combParam.setPackSts(1); - combParam.setRequestTime(DateUtils.convert(new Date())); - new PostMesDataUtils().postMesData("MES绯荤粺",mesUrl,inpath,combParam); } } else { throw new CoolException(dto.getLocNo()+"鐩爣搴撲綅宸茶鍗犵敤"); - } - TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>().eq("barcode", wrkMast.getBarcode())); - - if (Cools.isEmpty(testMast)){ - //鐢熸垚娴嬭瘯妗� - testMast=new TestMast(); - testMast.setChannel(locMast.getChannel()); - testMast.setUserId(locMast.getLocNo()); - testMast.setStatus(1); - testMast.setBarcode(wrkMast.getBarcode()); - testMast.setLocNo(locMast.getLocNo()); - testMast.setModiTime(now); - testMast.setAppeTime(now); - if (!testMastService.insert(testMast)){ - throw new CoolException(wrkMast.getBarcode()+"鐢熸垚娴嬭瘯妗eけ璐�"); - } - }else { - throw new CoolException(wrkMast.getBarcode()+"宸插瓨鍦ㄦ祴璇曟。"); } return dto; -- Gitblit v1.9.1