From 2e82ef6fd6dfbcb1eb88a8d4b705eae7fb99065b Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期五, 06 六月 2025 17:04:11 +0800 Subject: [PATCH] 123 --- src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 246 ++++++++++++++++++++++++++++--------------------- 1 files changed, 140 insertions(+), 106 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java index 4137a57..ee6392b 100644 --- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java @@ -1,25 +1,22 @@ package com.zy.asrs.service.impl; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; -import com.core.common.*; +import com.core.common.BaseRes; +import com.core.common.Cools; +import com.core.common.R; +import com.core.common.SnowflakeIdWorker; import com.core.exception.CoolException; import com.zy.asrs.entity.*; import com.zy.asrs.entity.param.*; import com.zy.asrs.mapper.LocMastMapper; import com.zy.asrs.mapper.ManLocDetlMapper; import com.zy.asrs.service.*; -import com.zy.asrs.utils.MatUtils; import com.zy.asrs.utils.OrderInAndOutUtil; -import com.zy.common.entity.Parameter; import com.zy.common.model.DetlDto; -import com.zy.common.model.MesCombParam; import com.zy.common.model.enums.WorkNoType; import com.zy.common.service.CommonService; -import com.zy.common.utils.HttpHandler; -import com.zy.nc.entity.NccJcQilibcBarcodeflowWms; import com.zy.nc.service.NccJcQilibcBarcodeflowWmsService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -50,6 +47,8 @@ @Autowired private WrkMastService wrkMastService; @Autowired + private WorkService workService; + @Autowired private WrkDetlService wrkDetlService; @Autowired private PackService packService; @@ -75,6 +74,12 @@ private ManLocDetlService manLocDetlService; @Autowired private ManLocDetlMapper manLocDetlMapper; + + @Autowired + private InventoryCheckOrderService inventoryCheckOrderService; + + @Autowired + private InventoryCheckOrderDetlService inventoryCheckOrderDetlService; @Autowired private AdjDetlService adjDetlService; @@ -105,11 +110,11 @@ public R WarehouseOutPickMergeV1(WarehouseOutPickMergeParam param, Long hostId, Long userId) { //鍒ゆ柇搴撲綅鐘舵�� LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())); - if (Cools.isEmpty(locMast)){ + if (Cools.isEmpty(locMast)) { return R.error("璇ュ簱浣嶄笉瀛樺湪"); } - if (!locMast.getLocSts().equals("P")){ - return R.error("璇ュ簱浣嶇姸鎬佷负锛�"+locMast.getLocSts()+",涓嶆弧瓒虫嫞鏂欓�斾腑骞舵澘鏉′欢锛侊紒锛�"); + if (!locMast.getLocSts().equals("P")) { + return R.error("璇ュ簱浣嶇姸鎬佷负锛�" + locMast.getLocSts() + ",涓嶆弧瓒虫嫞鏂欓�斾腑骞舵澘鏉′欢锛侊紒锛�"); } Date now = new Date(); @@ -139,7 +144,7 @@ wrkMastService.insert(wrkMast); for (OrderDetl orderDetl : param.getCombMats()) { - Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr",orderDetl.getMatnr())); + Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", orderDetl.getMatnr())); if (mat == null) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鐗╂枡淇℃伅涓嶅瓨鍦細" + orderDetl.getMatnr()); } @@ -155,7 +160,7 @@ wrkDetl.setModiUser(userId); wrkDetl.setZpallet(wrkMast.getBarcode()); wrkDetl.setBatch(orderDetl.getBatch()); - if(Cools.isEmpty(orderDetl.getBatch())){ + if (Cools.isEmpty(orderDetl.getBatch())) { wrkDetl.setBatch(""); } wrkDetl.setBoxType1(orderDetl.getBoxType1()); @@ -169,11 +174,11 @@ if (!Cools.isEmpty(orderDetl.getOrderNo())) { OrderPakin order = orderPakinService.selectByNo(orderDetl.getOrderNo()); - if (Cools.isEmpty(order)){ + if (Cools.isEmpty(order)) { continue; } - OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getStandby1(),orderDetl.getStandby2(),orderDetl.getStandby3(),orderDetl.getBoxType1(),orderDetl.getBoxType2(),orderDetl.getBoxType3()); - if (Cools.isEmpty(orderDetlPakin)){ + OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(), orderDetl.getBoxType3()); + if (Cools.isEmpty(orderDetlPakin)) { continue; } if (orderDetlPakin.getAnfme() < (orderDetlPakin.getWorkQty() + orderDetl.getAnfme())) { @@ -181,11 +186,11 @@ } // 淇敼璁㈠崟鏄庣粏浣滀笟鏁伴噺 if (!orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), orderDetlPakin.getMatnr(), orderDetlPakin.getBatch(), orderDetlPakin.getBrand(), - orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(),orderDetl.getAnfme())) { + orderDetlPakin.getStandby1(), orderDetlPakin.getStandby2(), orderDetlPakin.getStandby3(), orderDetlPakin.getBoxType1(), orderDetlPakin.getBoxType2(), orderDetlPakin.getBoxType3(), orderDetl.getAnfme())) { throw new CoolException("淇敼鍗曟嵁鏄庣粏宸ヤ綔鏁伴噺澶辫触"); } - if (order.getSettle() == 1){ + if (order.getSettle() == 1) { orderPakinService.updateSettle(order.getId(), 2L, userId); } } @@ -196,7 +201,7 @@ @Override @Transactional - public R pickConfirm(PickConfirmParam param,Long userId) { + public R pickConfirm(PickConfirmParam param, Long userId) { LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() .eq("loc_no", param.getLocNo())); @@ -220,9 +225,9 @@ //妫�楠屼紶鍙傛槸鍚﹀拰璁㈠崟鏄庣粏鍖归厤 for (PickMatParam matParam : param.getList()) { orderDetlPakin = orderDetlPakinService.selectItem - (matParam.getOrderNo(), matParam.getMatnr(),matParam.getBatch(),matParam.getBrand(), - matParam.getStandby1(),matParam.getStandby2(),matParam.getStandby3(), - matParam.getBoxType1(),matParam.getBoxType2(),matParam.getBoxType3()); + (matParam.getOrderNo(), matParam.getMatnr(), matParam.getBatch(), matParam.getBrand(), + matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(), + matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3()); if (orderDetlPakin == null) { return R.error("鐗╂枡鏁版嵁涓嶅瓨鍦�"); } @@ -286,7 +291,7 @@ wrkDetl.setModiTime(now); wrkDetl.setModiUser(userId); wrkDetl.setZpallet(wrkMast.getBarcode()); - if(Cools.isEmpty(matParam.getBatch())){ + if (Cools.isEmpty(matParam.getBatch())) { wrkDetl.setBatch(""); } if (!wrkDetlService.insert(wrkDetl)) { @@ -295,10 +300,10 @@ //鏇存柊璁㈠崟宸ヤ綔鏁伴噺 orderDetlPakinService.increaseWorkQty(orderDetlPakin.getOrderId(), matParam.getMatnr(), - matParam.getBatch(),matParam.getBrand(),matParam.getStandby1(),matParam.getStandby2(),matParam.getStandby3(), - matParam.getBoxType1(),matParam.getBoxType2(),matParam.getBoxType3(),matParam.getUseCount()); + matParam.getBatch(), matParam.getBrand(), matParam.getStandby1(), matParam.getStandby2(), matParam.getStandby3(), + matParam.getBoxType1(), matParam.getBoxType2(), matParam.getBoxType3(), matParam.getUseCount()); // 鏇存柊宸ヤ綔妗g姸鎬� - orderPakinService.updateSettle(orderDetlPakin.getOrderId(),2L,userId); + orderPakinService.updateSettle(orderDetlPakin.getOrderId(), 2L, userId); } // 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓� locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())); @@ -321,47 +326,47 @@ public R WarehouseOutV1(CombParam combParam, Long hostId, Long userId) { //鍒ゆ柇搴撲綅鐘舵�� LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", combParam.getLocNo())); - if (Cools.isEmpty(locMast)){ + if (Cools.isEmpty(locMast)) { return R.error("璇ュ簱浣嶄笉瀛樺湪"); } - if (!locMast.getLocSts().equals("P")){ - return R.error("璇ュ簱浣嶇姸鎬佷负锛�"+locMast.getLocSts()+",涓嶆弧瓒冲苟鏉块�斾腑鎷i�夋潯浠讹紒锛侊紒"); + if (!locMast.getLocSts().equals("P")) { + return R.error("璇ュ簱浣嶇姸鎬佷负锛�" + locMast.getLocSts() + ",涓嶆弧瓒冲苟鏉块�斾腑鎷i�夋潯浠讹紒锛侊紒"); } //鏌ヨ搴撳瓨鏁版嵁 - for (CombParam.CombMat combMat :combParam.getCombMats()){ + for (CombParam.CombMat combMat : combParam.getCombMats()) { List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>() - .eq("loc_no", combParam.getLocNo()) - .eq("matnr", combMat.getMatnr()) + .eq("loc_no", combParam.getLocNo()) + .eq("matnr", combMat.getMatnr()) ); - if (locDetlList.isEmpty()){ + if (locDetlList.isEmpty()) { return R.error("鏈煡璇㈠埌搴撳瓨鏁版嵁"); } - if (locDetlList.size()>1){ + if (locDetlList.size() > 1) { return R.error("搴撳瓨鏁版嵁澶т簬1鏉★紝涓轰繚璇佹暟鎹噯纭�э紝璇风敤姝e父娴佺▼鍑哄簱锛侊紒锛�"); } LocDetl locDetl = locDetlList.get(0); - if (combMat.getAnfme() > locDetl.getAnfme()){ + if (combMat.getAnfme() > locDetl.getAnfme()) { return R.error("鎷i�夋暟閲忛敊璇紝瓒呭嚭搴撳瓨鏁伴噺"); } - if (!Cools.isEmpty(combMat.getOrderNo())){ + if (!Cools.isEmpty(combMat.getOrderNo())) { OrderPakout orderPakout = orderPakoutService.selectByNo(combMat.getOrderNo()); - if (Cools.isEmpty(orderPakout)){ + if (Cools.isEmpty(orderPakout)) { continue; } - if (orderPakout.getSettle() == 1){ - OrderInAndOutUtil.updateOrder(false,orderPakout.getId(), 2L, 9527L); + if (orderPakout.getSettle() == 1) { + OrderInAndOutUtil.updateOrder(false, orderPakout.getId(), 2L, 9527L); } OrderDetlPakout orderDetlPakout = orderDetlPakoutService.selectItem(orderPakout.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(), combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3()); - if (Cools.isEmpty(orderDetlPakout)){ + if (Cools.isEmpty(orderDetlPakout)) { continue; } - if (orderDetlPakout.getAnfme() < (orderDetlPakout.getWorkQty()+combMat.getAnfme())){ + if (orderDetlPakout.getAnfme() < (orderDetlPakout.getWorkQty() + combMat.getAnfme())) { throw new CoolException("鎷i�夋暟閲忓嚭閿�,璁㈠崟鍓╀綑鍑哄簱鏁伴噺灏忎簬宸插嚭搴撴暟閲忎笌灏嗘嫞閫夋暟閲忎箣鍜岋紒锛侊紒"); } // 淇敼璁㈠崟鏄庣粏浣滀笟鏁伴噺 if (!orderDetlPakoutService.increaseWorkQty(orderDetlPakout.getOrderId(), combMat.getMatnr(), combMat.getBatch(), combMat.getBrand(), - combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(),combMat.getAnfme())) { + combMat.getStandby1(), combMat.getStandby2(), combMat.getStandby3(), combMat.getBoxType1(), combMat.getBoxType2(), combMat.getBoxType3(), combMat.getAnfme())) { throw new CoolException("淇敼鍗曟嵁鏄庣粏宸ヤ綔鏁伴噺澶辫触"); } // // 淇敼璁㈠崟鏄庣粏瀹屾垚鏁伴噺 @@ -399,7 +404,7 @@ wrkMast.setModiUser(userId); wrkMastService.insert(wrkMast); - Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr",combMat.getMatnr())); + Mat mat = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", combMat.getMatnr())); if (mat == null) { throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鐗╂枡淇℃伅涓嶅瓨鍦細" + combMat.getMatnr()); } @@ -416,7 +421,7 @@ wrkDetl.setModiUser(userId); wrkDetl.setZpallet(wrkMast.getBarcode()); wrkDetl.setBatch(combMat.getBatch()); - if(Cools.isEmpty(combMat.getBatch())){ + if (Cools.isEmpty(combMat.getBatch())) { wrkDetl.setBatch(""); } wrkDetl.setBoxType1(combMat.getBoxType1()); @@ -429,8 +434,8 @@ wrkDetlService.insert(wrkDetl); System.out.println("姝e父"); - }catch (Exception e) { - throw new CoolException("鎿嶄綔鏁版嵁寮傚父锛�"+e.getMessage()); + } catch (Exception e) { + throw new CoolException("鎿嶄綔鏁版嵁寮傚父锛�" + e.getMessage()); } } return R.ok("鎿嶄綔鎴愬姛锛�"); @@ -513,7 +518,7 @@ Wrapper<OrderDetl> wrapper1 = new EntityWrapper<>(); wrapper1.eq("status", 1); wrapper1.in("order_id", orderIds); - wrapper1.orderBy("create_time",false); + wrapper1.orderBy("create_time", false); if (!Cools.isEmpty(matnr)) { wrapper1.like("matnr", matnr); } @@ -548,25 +553,25 @@ if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) { throw new CoolException(BaseRes.PARAM); } - if(param.getCombMats().size()>1){ - throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒"); - } +// if (param.getCombMats().size() > 1) { +// throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒"); +// } // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁 if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱"); } - if(param.getBarcode().length()!=8){ + if (param.getBarcode().length() != 8) { throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode()); } - if (param.getCombMats().size()>1){ - throw new CoolException("涓嶅厑璁告贩鏂�===>>" + param.getBarcode()); - } +// if (param.getCombMats().size() > 1) { +// throw new CoolException("涓嶅厑璁告贩鏂�===>>" + param.getBarcode()); +// } - int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet",param.getBarcode())); - int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet",param.getBarcode())); - int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet",param.getBarcode())); + int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode())); + int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode())); + int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())); if (countLoc > 0 || countWrk > 0 || countwait > 0) { throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode()); } @@ -574,13 +579,13 @@ Date now = new Date(); // 鏃犲崟缁勬墭 - if (Cools.isEmpty(param.getOrderNo())) { + if (Cools.isEmpty(param.getCombMats().get(0).getOrderNo())) { // 鐢熸垚鍏ュ簱閫氱煡妗� List<DetlDto> detlDtos = new ArrayList<>(); param.getCombMats().forEach(elem -> { - DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), - elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); + DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), + elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); if (DetlDto.has(detlDtos, detlDto)) { DetlDto one = DetlDto.findDto(detlDtos, detlDto); assert one != null; @@ -598,6 +603,7 @@ } WaitPakin waitPakin = new WaitPakin(); waitPakin.sync(mat); + waitPakin.setWeight(detlDto.getWeight()); waitPakin.setBatch(detlDto.getBatch()); waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮� waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵�� @@ -607,42 +613,47 @@ waitPakin.setAppeTime(now); waitPakin.setModiUser(userId); waitPakin.setModiTime(now); + waitPakin.setBoxType1(detlDto.getBoxType1()); + waitPakin.setBoxType2(detlDto.getBoxType2()); + waitPakin.setBoxType3(detlDto.getBoxType3()); + waitPakin.setStandby1(detlDto.getStandby1()); + waitPakin.setStandby2(detlDto.getStandby2()); + waitPakin.setStandby3(detlDto.getStandby3()); if (!waitPakinService.insert(waitPakin)) { throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); } } - // 鍏宠仈缁勬墭 + // 鍏宠仈缁勬墭 } else { // Order order = orderService.selectByNo(param.getOrderNo()); - Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, param.getOrderNo()); - if (Cools.isEmpty(order) || order.getSettle() > 2) { - throw new CoolException("鍗曟嵁缂栧彿宸茶繃鏈�"); - } + // 鐢熸垚鍏ュ簱閫氱煡妗� List<DetlDto> detlDtos = new ArrayList<>(); param.getCombMats().forEach(elem -> { - // TODO 涓嶈�冭檻浠g爜鏁堢巼锛屽洜涓烘棫浠g爜bug灏� - if (!Cools.isEmpty(elem.getVbarcode())){ - NccJcQilibcBarcodeflowWms vbarcode1 = barcodeflowWmsService.selectOne(new EntityWrapper<NccJcQilibcBarcodeflowWms>().eq("vbarcode", elem.getVbarcode())); - + Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, elem.getOrderNo()); + if (Cools.isEmpty(order)) { + throw new CoolException("鍗曟嵁缂栧彿涓嶅瓨鍦�"); + } + if (order.getSettle() > 2) { + throw new CoolException("鍗曟嵁缂栧彿宸蹭綔涓氬畬鎴�"); } // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙 -// OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch()); - OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), - elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3()); + OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), + elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3()); if (elem.getAnfme() > orderDetl.getEnableQty()) { - throw new CoolException(orderDetl.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�"); + throw new CoolException(orderDetl.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�,宸茬粡瓒呰繃鍗曟嵁鍏ュ簱鏁伴噺"); } // 淇敼璁㈠崟浣滀笟鏁伴噺 // if (!orderDetlService.increaseWorkQty(order.getId(), elem.getMatnr(), elem.getBatch(), elem.getAnfme())) { // throw new CoolException("淇敼鍗曟嵁浣滀笟鏁伴噺澶辫触"); // } - OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE,order.getId(), elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), - elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); - DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),elem.getBrand(),elem.getStandby1(),elem.getStandby2(),elem.getStandby3(), - elem.getBoxType1(),elem.getBoxType2(),elem.getBoxType3(), elem.getAnfme()); + OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), + elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); + DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), + elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); + detlDto.setOrderNo(elem.getOrderNo()); if (DetlDto.has(detlDtos, detlDto)) { DetlDto one = DetlDto.findDto(detlDtos, detlDto); assert one != null; @@ -650,6 +661,8 @@ } else { detlDtos.add(detlDto); } + + OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId); }); for (DetlDto detlDto : detlDtos) { Mat mat = matService.selectByMatnr(detlDto.getMatnr()); @@ -658,7 +671,7 @@ } WaitPakin waitPakin = new WaitPakin(); waitPakin.sync(mat); - waitPakin.setOrderNo(order.getOrderNo()); // 鍗曟嵁缂栧彿 + waitPakin.setOrderNo(detlDto.getOrderNo()); // 鍗曟嵁缂栧彿 waitPakin.setBatch(detlDto.getBatch()); // 搴忓垪鐮� waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮� waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵�� @@ -668,12 +681,18 @@ waitPakin.setAppeTime(now); waitPakin.setModiUser(userId); waitPakin.setModiTime(now); + waitPakin.setBoxType1(detlDto.getBoxType1()); + waitPakin.setBoxType2(detlDto.getBoxType2()); + waitPakin.setBoxType3(detlDto.getBoxType3()); + waitPakin.setStandby1(detlDto.getStandby1()); + waitPakin.setStandby2(detlDto.getStandby2()); + waitPakin.setStandby3(detlDto.getStandby3()); if (!waitPakinService.insert(waitPakin)) { throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�"); } } // orderService.updateSettle(order.getId(), 2L, userId); - OrderInAndOutUtil.updateOrder(Boolean.TRUE,order.getId(), 2L, userId); + } } @@ -690,15 +709,15 @@ } // 鑾峰彇鍟嗗搧鍒楄〃 - for(CombParam.CombMat combMat : param.getCombMats()){ + for (CombParam.CombMat combMat : param.getCombMats()) { Mat mat = matService.selectByMatnr(combMat.getMatnr()); - if (Cools.isEmpty(mat)){ + if (Cools.isEmpty(mat)) { throw new CoolException(combMat.getMatnr() + ":鍟嗗搧妗f涓嶅瓨鍦紒"); } - if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme()==0){ + if (Cools.isEmpty(combMat.getAnfme()) || combMat.getAnfme() == 0) { throw new CoolException(combMat.getMatnr() + ":鍟嗗搧鏁伴噺鏈夎锛�"); } - if (Cools.isEmpty(combMat.getBatch())){ + if (Cools.isEmpty(combMat.getBatch())) { // throw new CoolException(combMat.getMatnr() + ":鍟嗗搧鎵瑰彿鏈夎锛�"); } ManLocDetl manLocDetl = new ManLocDetl(); @@ -719,16 +738,16 @@ @Override public void offSale(OffSaleParam offSaleParam) { ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); - if (Cools.isEmpty(manLocDetl)){ + if (Cools.isEmpty(manLocDetl)) { throw new CoolException("鏃犳鍟嗗搧锛�"); } double anfme = manLocDetl.getAnfme() - offSaleParam.getAnfme(); if (anfme < 0) { throw new CoolException("鍟嗗搧搴撳瓨涓嶈冻锛�"); - } else if (anfme == 0){ + } else if (anfme == 0) { manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr()); } - manLocDetlMapper.updateAnfme0(anfme,manLocDetl.getNodeId()); + manLocDetlMapper.updateAnfme0(anfme, manLocDetl.getNodeId()); } // 鏌ユ壘鍟嗗搧 @@ -737,14 +756,14 @@ @Override @Transactional public void adjust(MobileAdjustParam param, Long userId) { - BasDevp basDevp = basDevpService.selectById(param.getStaNo()); - if (null == basDevp || basDevp.getWrkNo() == null) { - throw new CoolException(param.getStaNo() + "鐩樼偣绔欐棤鏁�"); - } - if (!param.getWrkNo().equals(basDevp.getWrkNo())) { - throw new CoolException(param.getStaNo() + "鐩樼偣绔欐洿鏂帮紝璇烽噸鏂版绱�"); - } - WrkMast wrkMast = wrkMastService.selectById(param.getWrkNo()); +// BasDevp basDevp = basDevpService.selectById(param.getStaNo()); +// if (null == basDevp || basDevp.getWrkNo() == null) { +// throw new CoolException(param.getStaNo() + "鐩樼偣绔欐棤鏁�"); +// } +// if (!param.getWrkNo().equals(basDevp.getWrkNo())) { +// throw new CoolException(param.getStaNo() + "鐩樼偣绔欐洿鏂帮紝璇烽噸鏂版绱�"); +// } + WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode()); if (wrkMast.getWrkSts() < 10) { throw new CoolException("鐩樼偣鏃犳晥锛屼换鍔″凡鐩樼偣鍐嶅叆搴�"); } @@ -752,7 +771,10 @@ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); List<WrkDetl> list = param.getWrkDetls(); + LocDetlAdjustParam adjustParam = new LocDetlAdjustParam(); + List<LocDetlAdjustParam.LocDetlAdjust> locDetlAdjusts = new ArrayList<>(); + adjustParam.setLocNo(wrkMast.getSourceLocNo()); // 淇敼鏁伴噺 Iterator<WrkDetl> iterator = wrkDetls.iterator(); while (iterator.hasNext()) { @@ -771,6 +793,9 @@ throw new CoolException(wrkMast.getWrkNo() + "鐩樼偣浠诲姟锛�" + wrkDetl.getMatnr() + "鍟嗗搧锛�" + wrkDetl.getBatch() + "鎵瑰彿淇敼鏁伴噺澶辫触"); } } + //濡傛灉宸茬粡鎷f枡鍥炲簱锛屽氨闇�瑕佸彇locNo瀛楁 +// String locNo =Cools.isEmpty(wrkMast.getLocNo())? wrkMast.getSourceLocNo():wrkMast.getLocNo(); +// inventoryCheckOrderDetlService.selectList(new EntityWrapper<InventoryCheckOrderDetl>().eq("loc_no",locNo)) iterator.remove(); iterator1.remove(); } @@ -787,7 +812,9 @@ // 娣诲姞鏄庣粏 for (WrkDetl wrkDetl : list) { - if (wrkDetl.getAnfme() == 0.0D) { continue; } + if (wrkDetl.getAnfme() == 0.0D) { + continue; + } // todo 鐩樼偣璁板綍銆佷繚瀛樿皟鏁磋褰� String orderNo = wrkDetl.getOrderNo(); Mat mat = matService.selectByMatnr(wrkDetl.getMatnr()); @@ -800,15 +827,22 @@ if (!wrkDetlService.insert(wrkDetl)) { throw new CoolException("娣诲姞" + wrkMast.getWrkNo() + "鐩樼偣浠诲姟锛�" + wrkDetl.getMatnr() + "鍟嗗搧锛�" + wrkDetl.getBatch() + "鎵瑰彿浠诲姟鏄庣粏澶辫触"); } - } + } + List<WrkDetl> wrkDetls1 = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()); + for (WrkDetl wrkDetl : wrkDetls1) { + LocDetlAdjustParam.LocDetlAdjust locDetlAdjust = new LocDetlAdjustParam.LocDetlAdjust(wrkDetl.getMatnr(), wrkDetl.getBatch(), wrkDetl.getAnfme()); + locDetlAdjusts.add(locDetlAdjust); + } // 淇敼鐩樼偣浠诲姟涓绘。鐘舵�� - wrkMast.setFullPlt(wrkDetlService.selectByWrkNo(wrkMast.getWrkNo()).size() != 0?"Y":"N"); + wrkMast.setFullPlt(wrkDetls1.size() != 0 ? "Y" : "N"); wrkMast.setModiTime(now); wrkMast.setModiUser(userId); if (!wrkMastService.updateById(wrkMast)) { throw new CoolException("淇敼鐩樼偣浠诲姟涓绘。澶辫触"); } + adjustParam.setList(locDetlAdjusts); + workService.adjustLocDetl2(adjustParam, userId); } @@ -988,7 +1022,7 @@ //鏍规嵁璁㈠崟鍙风敓鎴愬嚭搴撲换鍔″伐浣滄。 Order order = OrderInAndOutUtil.selectByNo(Boolean.FALSE, orderNo); // Order order = orderService.selectOne(new EntityWrapper<Order>().eq("order_no", orderNo)); - if (order.getSettle() != 1 && order.getSettle() != 2){ + if (order.getSettle() != 1 && order.getSettle() != 2) { throw new CoolException("璇ヨ鍗曞凡澶勭悊"); } @@ -996,13 +1030,13 @@ List<OrderDetl> orderDetls = OrderInAndOutUtil.selectByOrderId(Boolean.FALSE, order.getId()); Date now = new Date(); - for(OrderDetl orderDetl : orderDetls){ + for (OrderDetl orderDetl : orderDetls) { //鏌ヨ鎵�鏈夊簱浣嶇姸鎬佷负F鐨勫簱浣嶄俊鎭� - List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(),orderDetl.getBatch(),null,null); + List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, null); if (locDetls.size() == 0) { throw new CoolException("搴撳瓨涓病鏈夎鐗╂枡"); } - for(LocDetl locDetl : locDetls){ + for (LocDetl locDetl : locDetls) { //濡傛灉璇ュ簱浣嶅嚭搴撹矾绾挎墍鐢ㄧ殑鍫嗗灈鏈簅ut_enable涓嶄负Y,璺宠繃璇ュ惊鐜� LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>() .eq("loc_no", locDetl.getLocNo())); @@ -1011,13 +1045,13 @@ } BasCrnp crn_no = basCrnpService.selectOne(new EntityWrapper<BasCrnp>() .eq("crn_no", locMast.getCrnNo())); - if (Cools.isEmpty(crn_no) || !crn_no.getOutEnable().equals("Y")){ + if (Cools.isEmpty(crn_no) || !crn_no.getOutEnable().equals("Y")) { continue; } //鍙嚭搴撴暟閲� = 璁㈠崟鏁伴噺 - 浣滀笟涓暟閲� Double outQty = orderDetl.getAnfme() - orderDetl.getWorkQty(); - if(outQty <= 0){ + if (outQty <= 0) { break; } // 鍒ゆ柇鍏ュ嚭搴撶被鍨嬶細101.鍏ㄦ澘鍑哄簱 or 103.鎷f枡鍑哄簱 @@ -1032,19 +1066,19 @@ // if(!orderService.update(order, new EntityWrapper<Order>().eq("order_no", orderNo))){ // throw new CoolException("鏇存柊璁㈠崟鐘舵�佸け璐�"); // } - OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(),order.getId(),2L,userId); + OrderInAndOutUtil.updateOrder(order.getPakinPakoutStatus$(), order.getId(), 2L, userId); orderDetl.setWorkQty(orderDetl.getWorkQty() + curOutQty); orderDetl.setUpdateBy(userId); orderDetl.setUpdateTime(now); Wrapper wrapper = new EntityWrapper<OrderDetl>().eq("order_no", orderNo) - .eq("matnr",orderDetl.getMatnr()); - if(!Cools.isEmpty(orderDetl.getBatch())){ + .eq("matnr", orderDetl.getMatnr()); + if (!Cools.isEmpty(orderDetl.getBatch())) { wrapper.eq("batch", orderDetl.getBatch()); } // if(!orderDetlService.update(orderDetl, wrapper)){ // throw new CoolException("鏇存柊璁㈠崟鏄庣粏澶辫触"); // } - OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(),order,orderDetl); + OrderInAndOutUtil.updateOrderDetl(order.getPakinPakoutStatus$(), order, orderDetl); } -- Gitblit v1.9.1