From 3c38ed3606ecbaac693baff568f8f66e635abc8d Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期四, 01 六月 2023 13:12:29 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/web/WcsController.java | 119 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 90 insertions(+), 29 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..41456b6 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,64 @@ if (Cools.isEmpty(param.getSourceStaNo())) { return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖"); } + if (Cools.isEmpty(param.getBarcode())) { + return R.error("鎵樼洏鐮佷笉鑳戒负绌�"); + } + boolean logs=true; + TestMast testMast11=new TestMast(); + //濡傛灉pack鐮佷负绌猴紝鏌ユ祴璇曡〃 + if (Cools.isEmpty(param.getPackNo())) { + testMast11= testMastService.selectOne(new EntityWrapper<TestMast>() + .eq("user_id",param.getBarcode())//鏌ユ墭鐩樼爜 + .eq("status",4)); //瀹屾垚娴嬭瘯 + logs=false; + } + Date now = new Date(); + if (true){ + try{ + Mat mat=new Mat(); + if(logs){ + mat = matService.selectByMatnr(param.getPackNo()); + }else { + mat = matService.selectByMatnr(testMast11.getBarcode()); + } + + if (Cools.isEmpty(mat)){ + return R.error("鍟嗗搧淇℃伅妗f鏈煡璇㈠埌pack淇℃伅"+param.getPackNo()); + } + WaitPakin waitPakin = new WaitPakin(); + int i = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); + if(i==0){ + 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 +202,9 @@ if (!res) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); } + // 鐩爣搴撲綅 + LocMast locMast = locMastService.selectById(dto.getLocNo()); + // 鐢熸垚宸ヤ綔妗f槑缁� waitPakins.forEach(waitPakin -> { WrkDetl wrkDetl = new WrkDetl(); @@ -163,6 +216,30 @@ wrkDetl.setDeadWarn(waitPakin.getDeadWarn()); if (!wrkDetlService.insert(wrkDetl)) { throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触"); + } + TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>() + .eq("barcode", wrkDetl.getMatnr()));//pack鐮� + if (Cools.isEmpty(testMast)){ + //鐢熸垚娴嬭瘯妗� + testMast=new TestMast(); + 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.setAppeTime(now); + if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){ + throw new CoolException(wrkDetl.getMatnr()+"鏇存柊娴嬭瘯妗eけ璐�"); + } } }); // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y @@ -182,41 +259,25 @@ 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); + if (locMast.getRow1()<3){ + //1.鎵爜涓婃姤 + CombParam combParam = new CombParam(); + combParam.setPackNo(wrkMast.getBarcode()); + combParam.setLocNo(wrkMast.getLocNo()); + combParam.setPackSts(0); + combParam.setStepSts(1); + combParam.setRequestTime(DateUtils.convert(now)); + 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