From 17485bf8af53591618ca052dfb76559b8e67ce51 Mon Sep 17 00:00:00 2001 From: lsh <1> Date: 星期六, 20 五月 2023 11:13:51 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/web/WcsController.java | 79 ++++++++++++++++++++++++++++----------- 1 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java index 66d1c52..665cec7 100644 --- a/src/main/java/com/zy/common/web/WcsController.java +++ b/src/main/java/com/zy/common/web/WcsController.java @@ -49,6 +49,8 @@ private LocDetlService locDetlService; @Autowired private TestMastService testMastService; + @Autowired + private MatService matService; @Value("mes.url") private String mesUrl; @@ -66,16 +68,47 @@ if (Cools.isEmpty(param.getSourceStaNo())) { return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖"); } + + if (Cools.isEmpty(param.getPackNo())) { + return R.error("packNo涓嶈兘涓虹┖"); + } + Date now = new Date(); + if (param.getSourceStaNo()==109){ + try{ + Mat mat = matService.selectByMatnr(param.getPackNo()); + if (Cools.isEmpty(mat)){ + return R.error("鍟嗗搧淇℃伅妗f鏈煡璇㈠埌pack淇℃伅"+param.getPackNo()); + } + WaitPakin waitPakin = new WaitPakin(); + waitPakin.setMatnr(mat.getMatnr());// Pack鐮� + waitPakin.setMaktx(mat.getMaktx()); + waitPakin.setZpallet(param.getBarcode()); //鎵樼洏鐮� + waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵�� + waitPakin.setAnfme(1.0); // 鏁伴噺 + waitPakin.setStatus("Y"); // 鐘舵�� + waitPakin.setManuDate(mat.getManuDate()); + waitPakin.setAppeUser(null); + waitPakin.setAppeTime(now); + waitPakin.setModiUser(null); + waitPakin.setModiTime(now); + waitPakin.setDeadWarn(mat.getDeadWarn()); + if (!waitPakinService.insert(waitPakin)) { + throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); + } + }catch (Exception e){ + + } + } 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())); - if (Cools.isEmpty(waitPakins)) { + if (Cools.isEmpty(waitPakins) || waitPakins.size()!=1) { WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); - if (wrkMast != null && wrkMast.getIoType() == 103) { - return R.parse(CodeRes.PICK_600); + if (wrkMast != null || waitPakins.size()!=1) { + return R.parse("600-閲嶅缁勬墭"); } return R.parse(CodeRes.NO_COMB_700); } @@ -152,6 +185,9 @@ if (!res) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); } + // 鐩爣搴撲綅 + LocMast locMast = locMastService.selectById(dto.getLocNo()); + // 鐢熸垚宸ヤ綔妗f槑缁� waitPakins.forEach(waitPakin -> { WrkDetl wrkDetl = new WrkDetl(); @@ -163,6 +199,24 @@ wrkDetl.setDeadWarn(waitPakin.getDeadWarn()); if (!wrkDetlService.insert(wrkDetl)) { throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触"); + } + 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(wrkDetl.getMatnr()); + testMast.setLocNo(locMast.getLocNo()); + testMast.setModiTime(now); + testMast.setAppeTime(now); + if (!testMastService.insert(testMast)){ + throw new CoolException(wrkDetl.getMatnr()+"鐢熸垚娴嬭瘯妗eけ璐�"); + } + }else { + throw new CoolException(wrkDetl.getMatnr()+"宸插瓨鍦ㄦ祴璇曟。"); } }); // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y @@ -182,7 +236,6 @@ throw new CoolException("鏇存柊婧愮珯澶辫触"); } // 鏇存柊鐩爣搴撲綅鐘舵�� - LocMast locMast = locMastService.selectById(dto.getLocNo()); if (locMast.getLocSts().equals("O")){ locMast.setLocSts("S"); // S.鍏ュ簱棰勭害 locMast.setModiTime(now); @@ -202,24 +255,6 @@ } } 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