From ec8f35851c6b92cf283579db68651abebc1a40e8 Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期四, 26 九月 2024 08:21:37 +0800 Subject: [PATCH] * --- src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java | 160 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 142 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java index 8d9c2ba..1dd5e23 100644 --- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java @@ -151,6 +151,7 @@ } else { Double anfme = agvWrkDetl.getAnfme() + pick.getCount(); agvWrkDetl.setAnfme(anfme); + agvWrkDetl.setModiTime(new Date()); agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>().eq("matnr",agvWrkDetl.getMatnr()).eq("three_code",agvWrkDetl.getThreeCode()).eq("supp_code",pick.getSuppCode())); } @@ -176,8 +177,9 @@ } } } - if (agvLocDetls.size() == sameNumber) { + if (agvLocDetls.size() == sameNumber || agvLocDetls.size() == 1) { agvWrkMast.setIoType(101); + agvWrkMast.setModiTime(new Date()); agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no", pickParams.getWrkNo())); } @@ -237,7 +239,7 @@ checkOrderQty(order,combMat); } - DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode(),param.getLocType()); + DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode(),param.getLocType(),combMat.getProcessSts()); //鍚屼竴璐ф灦涓嬬浉鍚岀墿鏂欎俊鎭拰鎵瑰彿杞负涓�涓叆搴撻�氱煡妗� if (DetlDto.has(detlDtos, detlDto)) { DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(), detlDto.getCsocode(), detlDto.getIsoseq(),detlDto.getContainerCode()); @@ -293,6 +295,8 @@ waitPakin.setDeadTime(detlDto.getIsoseq()); waitPakin.setLocType(detlDto.getLocType()); + + waitPakin.setProcessSts(detlDto.getProcessSts()); waitPakin.setAppeUser(userId); @@ -386,6 +390,20 @@ public String handControlLocMove(LocMoveParam param, Long userId) { String fl = String.valueOf(param.getFloor()); short floor =(short)Integer.parseInt(fl.substring(0, 1)); + switch (param.getFloor()) { + case "1F01": + floor = 1; + break; + case "1F02": + floor = 4; + break; + case "2F": + floor = 2; + break; + case "3F": + floor = 3; + break; + } Integer ioType = 0; AgvLocMast agvLocMast = agvLocMastService.selectOne(new EntityWrapper<AgvLocMast>().eq("loc_no", param.getLocNo())); if (Cools.isEmpty(agvLocMast)) { @@ -403,17 +421,21 @@ } } else { if (agvLocMast.getFloor() != floor) { -// if (floor==1 && agvLocMast.getFloor()!=1){ -// ioType = 121; -// }else { - if (agvLocMast.getFloor() == 1) { - throw new CoolException("褰撳墠搴撲綅璇烽�夋嫨璋冩嫧鍗曡皟鎷紒"); + if (agvLocMast.getFloor() == 1 && (floor == 2 || floor == 3)) { + throw new CoolException("褰撳墠搴撲綅璇烽�夋嫨璋冩嫧鍗曡皟鎷紒"); + } else { + ioType = 12; + } + } else { + if (agvLocMast.getFloor() == 1) { + if (agvLocMast.getLev1() == 1 && floor == 1) { + ioType = 11; } else { ioType = 12; } -// } - } else { - ioType = 11; + } else { + ioType = 11; + } } } Date now = new Date(); @@ -423,7 +445,21 @@ throw new CoolException("褰撳墠"+agvLocMast.getBarcode()+"璐ф灦鐮佸凡鍦ㄥ伐浣滄。涓�"); } //妫�绱㈠簱浣嶏紝閫夋嫨鍚堥�傜殑搴撲綅 - AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,true); + AgvLocMast locMast = null; + if (floor == 1) { + locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,true,false); + } else { + locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,false); + } + + // 鐩爣妤煎眰鍘� 鍚稿2妤� + if (floor == 4) { + if (locMast.getLev1() == 1) { + throw new CoolException("鍚稿涓�妤兼病鏈夌┖搴撲綅鍙互绉诲簱锛�"); + } + + } + if (Cools.isEmpty(locMast)) { throw new CoolException("褰撳墠妤煎眰娌℃湁绌哄簱浣�"); } @@ -453,6 +489,7 @@ mast.setAppeTime(now); mast.setModiUser(userId); mast.setModiTime(now); + mast.setLogErrMemo("handControlLocMove"); if (!agvWrkMastService.insertByIncrease(mast)) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); } @@ -477,10 +514,13 @@ } // 濡傛灉褰撳墠浠诲姟鏄澹充簩涓夋ゼ鍥為��涓�妤肩殑 鍥炴粴璋冩嫧鍗� - if (ioType == 12 && locMast.getFloor() == 1) { + if (ioType == 12 && locMast.getFloor() == 1 && floor != 4 && agvLocMast.getFloor() != 1) { List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo())); for (AgvLocDetl agvLocDetl : agvLocDetls) { - OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("three_code", agvLocDetl.getThreeCode()).eq("matnr", agvLocDetl.getMatnr()).eq("order_no", "DB" + agvLocDetl.getOrderNo())); + OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("three_code", agvLocDetl.getThreeCode()).eq("matnr", agvLocDetl.getMatnr()).eq("source", 33)); + if (Cools.isEmpty(orderDetl)) { + throw new CoolException("褰撳墠鐗╂枡鐨勮皟鎷ㄥ崟涓嶅瓨鍦紒"); + } orderDetl.setQty(orderDetl.getQty() - agvLocDetl.getAnfme()); if (!orderDetlService.updateById(orderDetl)) { throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触"); @@ -512,8 +552,28 @@ if (!agvWrkMast.getBarcode().equals(param.getBarcode())) { throw new CoolException("褰撳墠璐ф灦鐮佷笌浠诲姟涓嶅尮閰�"); } - if (!agvWrkMast.getWrkSts().equals(207L)) { - throw new CoolException("宸ヤ綔鐘舵�佷笉绗﹀悎绂诲満鏉′欢"); + if (!agvWrkMast.getWrkSts().equals(207L) && !agvWrkMast.getWrkSts().equals(205L)) { + throw new CoolException("褰撳墠宸ヤ綔鐘舵��:" + agvWrkMast.getWrkSts$() +"涓嶇鍚堢鍦烘潯浠�"); + } + if (agvWrkMast.getWrkSts().equals(205L)) { + // 搴撲綅 -- 鎺ラ┏浣� / 搴撲綅 + if (agvWrkMast.getLocNo().substring(0,2).equals("DB")) { + agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getLocNo(),"F",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); + // 鎺ラ┏浣� -- 搴撲綅 + } else { + agvLocMastService.updateLocStsByLocNo(agvWrkMast.getLocNo(),"D",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); + } + + // 鎺ラ┏浣� -- 搴撲綅 + if (agvWrkMast.getSourceLocNo().substring(0,2).equals("DB")) { + agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getSourceLocNo(),"O","",(short)0); + // 搴撲綅 -- 鎺ラ┏浣� / 搴撲綅 + } else { + //淇敼婧愬簱浣嶇姸鎬佷负O + agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",agvWrkMast.getWhsType().shortValue(),"",(short)0); + //鏇存柊鐩爣搴撲綅鏄庣粏 101.鍑哄簱 鍒犻櫎婧愬簱浣嶅簱瀛樻槑缁� + agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",agvWrkMast.getSourceLocNo())); + } } //鐢熸垚AGV宸ヤ綔鍘嗗彶妗� + 鐢熸垚AGV宸ヤ綔鏄庣粏鍘嗗彶妗� @@ -536,7 +596,7 @@ } } // 鏇存柊绔欑偣鐘舵�� - agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",null); +// agvLocMastService.updateLocStsByLocNo(agvWrkMast.getSourceLocNo(),"O","",null); // 鏇存柊婧愬簱浣嶇姸鎬� agvBasDevpService.updateLocStsAndBarcodeByDevNo(agvWrkMast.getLocNo(),"O","",agvWrkMast.getWhsType().shortValue()); @@ -605,6 +665,7 @@ if (!agvWrkMast.getBarcode().equals(param.getBarcode())) { throw new CoolException("褰撳墠璐ф灦鐮佷笌浠诲姟涓嶅尮閰�"); } + agvWrkMast.setModiTime(new Date()); agvWrkMast.setWrkSts(213L); agvWrkMast.setSourceLocNo(""); if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) { @@ -633,6 +694,7 @@ throw new CoolException("褰撳墠宸ヤ綔绫诲瀷涓嶈兘绌烘灦杩涘満"); } agvWrkMast.setWrkSts(214L); + agvWrkMast.setModiTime(new Date()); agvWrkMast.setSourceLocNo(param.getDevNo()); if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) { throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�"); @@ -642,7 +704,7 @@ return "ok"; } /* - * 绔欑偣鍥為�� + * 杞墜鍔ㄥ洖娴� */ @Override @Transactional @@ -657,6 +719,68 @@ } return "ok"; } + + /* + * 纭鍔犲伐瀹屾垚 + */ + @Override + @Transactional + public String processed(AgvMobileStartPakin param, Long userId) { + Date now = new Date(); + AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()).eq("loc_no", param.getDevNo())); + if (Cools.isEmpty(agvWrkMast)) { + throw new CoolException("鏆傛棤褰撳墠璐ф灦鐨勫伐浣滄。"); + } + if (agvWrkMast.getWrkSts() != 205) { + throw new CoolException("褰撳墠浠诲姟鏈畬鎴愶紝璇风‘璁�"); + } + //鐢熸垚AGV宸ヤ綔鍘嗗彶妗� + 鐢熸垚AGV宸ヤ綔鏄庣粏鍘嗗彶妗� + agvWrkMastLogService.save(agvWrkMast); + agvWrkDetlLogService.save(agvWrkMast.getWrkNo()); + String sourceLocNo = agvWrkMast.getSourceLocNo(); + AgvLocMast newLocMast = agvCommonService.getLocNo(3, 1,false,false); + agvWrkMast.setSourceLocNo(agvWrkMast.getLocNo()); + agvWrkMast.setLocNo(newLocMast.getLocNo()); + agvWrkMast.setIoType(57); + agvWrkMast.setWrkSts(201L); + agvWrkMast.setModiUser(userId); + agvWrkMast.setModiTime(now); + + + + if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) { + throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�"); + } + + // 鏇存柊婧愮珯鐐� + 鐩爣搴撲綅鐘舵�� + 鍘嗗彶婧愬簱浣� + agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"R",param.getBarcode(),agvWrkMast.getWhsType().shortValue()); + agvLocMastService.updateLocStsByLocNo(newLocMast.getLocNo(),"S",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue()); + agvLocMastService.updateLocStsByLocNo(sourceLocNo,"O","",(short)30); + agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",sourceLocNo)); + + List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code",param.getBarcode())); + agvWrkDetls.forEach(agvWrkDetl -> { + for (AgvWrkDetl wrkDetl : param.getWrkDetls()) { + if (wrkDetl.getMatnr().equals(agvWrkDetl.getMatnr()) && wrkDetl.getThreeCode().equals(agvWrkDetl.getThreeCode())) { + agvWrkDetl.setAnfme(wrkDetl.getAnfme()); + break; + } + } + agvWrkDetl.setProcessSts(2); + agvWrkDetl.setOrderNo(agvWrkDetl.getOrderNo().substring(2)); + agvWrkDetl.setModiUser(userId); + agvWrkDetl.setModiTime(now); + if (!agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>() + .eq("matnr",agvWrkDetl.getMatnr()) + .eq("three_code",agvWrkDetl.getThreeCode()) + .eq("supp_code",param.getBarcode()))) { + throw new CoolException("鏇存柊宸ヤ綔鏄庣粏澶辫触"); + } + }); + return "ok"; + } + + /* * 绔欑偣鍥為�� @@ -751,7 +875,7 @@ wrkMast.setAppeTime(now); wrkMast.setModiUser(userId); wrkMast.setModiTime(now); - + wrkMast.setLogErrMemo("doBack"); if (!agvWrkMastService.insertByIncrease(wrkMast)) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); } -- Gitblit v1.9.1