From c46f9c28f8d40d2a4efcc7ef6e528661d97a4be0 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期二, 14 二月 2023 13:48:18 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 160 ++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 108 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java index a13fe0c..61d8631 100644 --- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java @@ -1,6 +1,8 @@ package com.zy.asrs.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.core.common.BaseRes; @@ -170,8 +172,13 @@ } } if (!locDetlDtos.isEmpty()) { - // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱 - stockOut(staNo, locDetlDtos, null, userId); + LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); + if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D") ){ + // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱 + stockOut(staNo, locDetlDtos, null, userId); + }else { + throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$()); + } } else { throw new CoolException("搴撳瓨涓嶅瓨鍦�"); } @@ -215,9 +222,9 @@ ioType = dto.isAll() ? 101 : 103; } else if (ioWorkType.equals(IoWorkType.CHECK_OUT)) { ioType = 107; - if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { - throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�"); - } + // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { + // throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�"); + // } } assert ioType != null; // 鑾峰彇搴撲綅 @@ -233,7 +240,7 @@ wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶姸鎬� Double ioPri = wrkMastService.getIoPri(ioType, dto.getLocNo()); - wrkMast.setIoPri(ioPri); // 浼樺厛绾э細13 + wrkMast.setIoPri(15D); // 浼樺厛绾э細13 wrkMast.setOutMost(locMastService.isOutMost(dto.getLocNo(), false) ? 1 : 0); wrkMast.setCrnNo(locMast.getCrnNo()); wrkMast.setSourceStaNo(staDesc.getCrnStn()); // 婧愮珯 @@ -268,6 +275,7 @@ wrkDetl.setAppeUser(userId); wrkDetl.setModiTime(now); wrkDetl.setModiUser(userId); + wrkDetl.setSpecs(detlDto.getLocDetl().getSpecs()); if (!wrkDetlService.insert(wrkDetl)) { throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�"); } @@ -284,7 +292,7 @@ } else { throw new CoolException(dto.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��"); } - locMastService.breakUp(dto.getLocNo(), excludeLocNos); +// locMastService.breakUp(dto.getLocNo(), excludeLocNos); } } @@ -358,29 +366,41 @@ throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�"); } // 淇敼璁㈠崟鏄庣粏 - if (BaseController.isJSON(locDto.getOrderNo())) { + if (!BaseController.isJSON(locDto.getOrderNo())) { String[] orderNos = GetOrderNo(locDto.getOrderNo()); - Double anfme = locDto.getAnfme(); - for (String orderNo : orderNos) { - OrderDetl orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), locDto.getBatch()); - if (orderDetl == null) { - orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), null); + if (!Cools.isEmpty(orderNos)){ + Double anfme = locDto.getAnfme(); + for (String orderNo : orderNos) { + OrderDetl orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), locDto.getBatch()); + if (orderDetl == null) { + orderDetl = orderDetlService.selectItem(orderNo, locDto.getMatnr(), null); + } + if (orderDetl.getAnfme() <= anfme) { + if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())) { + throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触"); + } + anfme = anfme - orderDetl.getAnfme(); + } else { + if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), anfme)) { + throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触"); + } + } + orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); } - if (orderDetl.getAnfme() <= anfme) { - if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())) { - throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触"); - } - anfme = anfme - orderDetl.getAnfme(); - } else { - if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), anfme)) { - throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触"); - } + }else { + OrderDetl orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); + if (orderDetl == null) { + orderDetl = orderDetlService.selectItem(locDto.getOrderNo(), locDto.getMatnr(), null); + } + if (!orderDetlService.increase(orderDetl.getOrderId(), orderDetl.getMatnr(), orderDetl.getBatch(), locDto.getAnfme())) { + throw new CoolException("淇敼璁㈠崟鏄庣粏鏁伴噺澶辫触"); } orderService.updateSettle(orderDetl.getOrderId(), 2L, userId); } } else { // 璁㈠崟鍚堝苟鍑哄簱 List<OrderDto> orderDtoList = JSON.parseArray(locDto.getOrderNo(), OrderDto.class); + for (OrderDto orderDto : orderDtoList) { OrderDetl orderDetl = orderDetlService.selectItem(orderDto.getOrderNo(), locDto.getMatnr(), locDto.getBatch()); if (orderDetl == null) { @@ -410,14 +430,18 @@ private String[] GetOrderNo(String orderNo) { String[] s3 = orderNo.split("\""); String[] s = new String[(s3.length - 1) / 6]; - int i = 0; - int j = 0; - for (String ss : s3) { - if (ss.equals("orderNo")) { - s[i] = s3[j + 2]; - i++; + if (!Cools.isEmpty(s3)){ + int i = 0; + int j = 0; + for (String ss : s3) { + if (ss.equals("orderNo")) { + s[i] = s3[j + 2]; + i++; + } + j++; } - j++; + }else { + s=null; } return s; } @@ -519,6 +543,9 @@ if (Cools.isEmpty(locMast)) { throw new CoolException(locNo + "搴撲綅涓嶅瓨鍦�"); } + if (!locMast.getLocSts().equals("D")){ + throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篋鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$()); + } // 鑾峰彇婧愮珯 Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() .eq("type_no", 110) @@ -573,9 +600,9 @@ @Override @Transactional public void locCheckOut(StockOutParam param, Long userId) { - if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { - throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�"); - } + // if (wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("io_type", 107)) > 0) { + // throw new CoolException("鍙兘瀛樺湪涓�绗旂洏鐐逛换鍔�"); + // } // 鐩爣绔欑偣鐘舵�佹娴� BasDevp staNo = basDevpService.checkSiteStatus(param.getOutSite()); // 鑾峰彇搴撲綅鏄庣粏 @@ -587,8 +614,14 @@ } } if (!locDetlDtos.isEmpty()) { - // 鍚姩鍑哄簱寮�濮� 107.鐩樼偣鍑哄簱 - stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId); + LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo())); + if (locMast.getLocSts().equals("F")){ + // 鍚姩鍑哄簱寮�濮� 107.鐩樼偣鍑哄簱 + stockOut(staNo, locDetlDtos, IoWorkType.CHECK_OUT, userId); + }else { + throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎鐨勫簱浣嶏紝搴撲綅鍙凤細"+locMast.getLocNo()+" 銆佸綋鍓嶇姸鎬侊細"+locMast.getLocSts()+"-"+locMast.getLocSts$()); + } + } else { throw new CoolException("搴撲綅鐗╂枡涓嶅瓨鍦�"); } @@ -605,6 +638,9 @@ LocMast loc = locMastService.selectById(locNo); if (Cools.isEmpty(loc)) { throw new CoolException("鏈壘鍒板簱浣�"); + } + if (!loc.getLocSts().equals("O")||(!sourceLoc.getLocSts().equals("F") && !sourceLoc.getLocSts().equals("D"))){ + throw new CoolException("搴撲綅鐘舵�佸凡鏀瑰彉"); } if (!sourceLoc.getCrnNo().equals(loc.getCrnNo())) { // throw new CoolException("绉昏浆搴撲綅灞炰簬涓嶅悓鍫嗗灈鏈�"); todo:luxiaotao @@ -691,6 +727,7 @@ wrkMast.setWrkSts(9L); // 鍑哄簱 } else if (wrkMast.getWrkSts() > 10) { + wrkMast.setSteNo(0); wrkMast.setWrkSts(17L); } Date now = new Date(); @@ -867,6 +904,9 @@ locSts = "D"; // 搴撲綅杞Щ ===>> D.绌烘《/绌烘爤鏉� } else if (wrkMast.getIoType() == 11) { + if (wrkMast.getWrkSts() > 11){ + throw new CoolException("绉诲簱浠诲姟宸插湪鎵ц涓紝涓嶈兘鍙栨秷"); + } locSts = wrkMast.getFullPlt().equalsIgnoreCase("N") ? "D" : "F"; // 搴撲綅杞Щ锛氱洰鏍囧簱浣� LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); @@ -886,23 +926,39 @@ for (WrkDetl wrkDetl : wrkDetls) { if (!Cools.isEmpty(wrkDetl.getOrderNo())){ String[] orderNos = GetOrderNo(wrkDetl.getOrderNo()); - String[] anfmes = GetAnfme(wrkDetl.getOrderNo()); - int i = 0; - for (String orderNo : orderNos) { - if (!Cools.isEmpty(orderNo)) { - Double anfme = Integer.parseInt(anfmes[i]) + 0.0; - i++; - if (BaseController.isJSON(wrkDetl.getOrderNo())) { - if (!orderDetlService.decrease(orderNo, wrkDetl.getMatnr(), wrkDetl.getBatch(), anfme)) { - throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触"); - } - } else { - // 璁㈠崟鍚堝苟鍑哄簱 - List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class); - for (OrderDto orderDto : orderDtoList) { - if (!orderDetlService.decrease(orderDto.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), orderDto.getAnfme())) { + if (!Cools.isEmpty(orderNos)){ + String[] anfmes = GetAnfme(wrkDetl.getOrderNo()); + int i = 0; + for (String orderNo : orderNos) { + if (!Cools.isEmpty(orderNo)) { + Double anfme = Integer.parseInt(anfmes[i]) + 0.0; + i++; + if (!BaseController.isJSON(wrkDetl.getOrderNo())) { + if (!orderDetlService.decrease(orderNo, wrkDetl.getMatnr(), wrkDetl.getBatch(), anfme)) { throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触"); } + } else { + // 璁㈠崟鍚堝苟鍑哄簱 + List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class); + for (OrderDto orderDto : orderDtoList) { + if (!orderDetlService.decrease(orderDto.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), orderDto.getAnfme())) { + throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触"); + } + } + } + } + } + }else { + if (!BaseController.isJSON(wrkDetl.getOrderNo())) { + if (!orderDetlService.decrease(wrkDetl.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme())) { + throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触"); + } + } else { + // 璁㈠崟鍚堝苟鍑哄簱 + List<OrderDto> orderDtoList = JSON.parseArray(wrkDetl.getOrderNo(), OrderDto.class); + for (OrderDto orderDto : orderDtoList) { + if (!orderDetlService.decrease(orderDto.getOrderNo(), wrkDetl.getMatnr(), wrkDetl.getBatch(), orderDto.getAnfme())) { + throw new CoolException("璁㈠崟鏁版嵁鍥炴粴澶辫触"); } } } @@ -1027,9 +1083,9 @@ if (Cools.isEmpty(locNos)) { return; } - if (true && !Cools.isEmpty(locNos)) { - throw new CoolException("鏆備笉鏀寔绉诲簱浠诲姟"); // todo:luxiaotao 绉诲簱寮�鍏� - } +// if (true && !Cools.isEmpty(locNos)) { +// throw new CoolException("鏆備笉鏀寔绉诲簱浠诲姟"); // todo:luxiaotao 绉诲簱寮�鍏� +// } LocMast one = locMastService.selectById(locNos.get(0)); List<Integer> rows = Utils.getGroupLoc(Integer.parseInt(locNos.get(0).substring(0, 2))); List<LocMast> locMasts = locMastService.queryFreeLocMast(rows, rows.size(), one.getLocType1()); -- Gitblit v1.9.1