From e046dba174365eb8934ee1e4206f09821145e876 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期四, 21 八月 2025 13:23:22 +0800 Subject: [PATCH] no message --- zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java | 88 +++++++++++++++++++++++++++++--------------- 1 files changed, 58 insertions(+), 30 deletions(-) diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java index affa841..c1aacdc 100644 --- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java +++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/manage/OutManage.java @@ -3,6 +3,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.mysql.cj.util.StringUtils; import com.zy.asrs.wms.asrs.entity.param.StockOutParam; import com.zy.asrs.framework.exception.CoolException; @@ -532,6 +533,12 @@ return mergePreviewDtos; } + /** + * 娉㈡鍑哄簱棰勮 + * + * @param param + * @return + */ @Transactional(rollbackFor = Exception.class) public List<MergePreviewResultDto> orderOutMergeLocPreview(List<MergePreviewDto> param) { if (param == null) { @@ -567,7 +574,7 @@ //鏌ヨ骞冲簱涓鍚堟潯浠剁殑搴撳瓨 List<LocDetl> locs = locDetlService.queryFlatStock(pars.getMatnr(), pars.getBatch(), pars.getFieldParams()); if (!locs.isEmpty()) { - double anfme = pars.getAnfme() - pars.getWorkQty(); + Double anfme = pars.getAnfme() - pars.getWorkQty(); for (LocDetl detl : locs) { Loc loc = locService.getById(detl.getLocId()); if (loc == null) { @@ -582,7 +589,7 @@ locDto.setLocNo(detl.getLocNo()); locDto.setTypeId(LocAreaTypeSts.LOC_AREA_TYPE_FLAT.id); locDto.setLocDetlId(detl.getId()); - locDto.setAnfme(detl.getAnfme()); + locDto.setAnfme(detl.getAnfme() - detl.getWorkQty()); locDto.setWorkQty(detl.getWorkQty()); locDtos.add(locDto); //搴撲綅瀹為檯鍙敤鏁伴噺 @@ -591,8 +598,8 @@ continue; } //娉㈡鏁伴噺鍑忓幓搴撲綅鍙敤鏁伴噺鍚庯紝鐩堜綑鏁伴噺 - anfme = anfme - surplusQty; - if (anfme > 0) { + anfme = Math.round((anfme - surplusQty) * 10000) / 10000.0; + if (anfme.compareTo(0.0) > 0) { //褰撳墠鍙娇鐢ㄦ暟閲� resultDto.setFetchQty(surplusQty); //浣欎笅闇�姹傛暟閲� @@ -1021,9 +1028,10 @@ * 鏍规嵁涓嶅悓搴撲綅绫诲瀷鐢熸垚鍑哄簱鎷h揣鍗曟垨CTU浠诲姟妗� * * @param dto - * @param wave + * @param */ - private void outStockByArea(OrderOutMergeParamDto dto, Wave wave) { + @Transactional(rollbackFor = Exception.class) + public void outStockByArea(OrderOutMergeParamDto dto, Wave wave) { List<OrderOutMergeParam> params = dto.getList(); if (params.isEmpty()) { throw new CoolException("鍙傛暟涓嶈兘涓虹┖"); @@ -1103,6 +1111,11 @@ throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�"); } + wave.setSite(operationPort.getFlag()); + if (!waveService.updateById(wave)) { + throw new CoolException("娉㈡绔欏彛鐘舵�佹洿鏂板け璐ワ紒锛�"); + } + for (OrderOutMergeDto merge : list) { LocDetl locDetl = locDetlService.getById(merge.getLocDetlId()); if (locDetl == null) { @@ -1137,9 +1150,12 @@ } String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); - WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, wave.getId())); + logger.error("Matnr------>{}", taskDetl.getMatnr()); + WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>() + .eq(WaveDetl::getStockIndex, matUniqueKey) + .eq(WaveDetl::getWaveId, wave.getId())); if (waveDetl == null) { - throw new CoolException("娉㈡鏁版嵁涓嶅瓨鍦�"); + throw new CoolException("waveId:" + wave.getId() + "鐗╂枡锛�" + taskDetl.getMatnr() + "娉㈡鏁版嵁涓嶅瓨鍦�"); } waveDetl.setWorkQty(waveDetl.getWorkQty() + taskDetl.getAnfme()); waveDetl.setUpdateTime(new Date()); @@ -1153,28 +1169,31 @@ throw new CoolException("褰撳墠娉㈡璁㈠崟涓嶅瓨鍦紒锛�"); } - List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>() - .eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).eq(CacheSite::getChannel, task.getTargetSite())); - if (cacheSites.isEmpty()) { - throw new CoolException("缂撳瓨绔欑┖闂翠笉瓒筹紝璇风◢鍚庡啀璇�"); - } +// List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>() +// .eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).eq(CacheSite::getChannel, task.getTargetSite())); +// +// if (cacheSites.isEmpty()) { +// throw new CoolException("缂撳瓨绔欑┖闂翠笉瓒筹紝璇风◢鍚庡啀璇�"); +// } +// +// if (cacheSites.size() < orders.size()) { +// throw new CoolException("缂撳瓨绔欑┖闂翠笉瓒筹紝璇风◢鍚庡啀璇�"); +// } - if (cacheSites.size() < orders.size()) { - throw new CoolException("缂撳瓨绔欑┖闂翠笉瓒筹紝璇风◢鍚庡啀璇�"); - } - - for (int i = 0; i < orders.size(); i++) { - CacheSite cacheSite = cacheSites.get(i); - cacheSite.setOrderId(orders.get(i).getId()); - cacheSite.setOrderNo(orders.get(i).getOrderNo()); - cacheSite.setSiteStatus(CacheSiteStatusType.R.id); - cacheSite.setBarcode(loc.getBarcode()); - cacheSite.setUpdateTime(new Date()); - if (!cacheSiteService.updateById(cacheSite)) { - throw new CoolException("缂撳瓨绔欐洿鏂板け璐�"); - } - } +// for (int i = 0; i < orders.size(); i++) { +// CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, orders.get(i).getId())); +// if (Objects.isNull(cacheSite)) { +// cacheSite.setOrderId(orders.get(i).getId()); +// cacheSite.setOrderNo(orders.get(i).getOrderNo()); +// cacheSite.setSiteStatus(CacheSiteStatusType.R.id); +// cacheSite.setBarcode(loc.getBarcode()); +// cacheSite.setUpdateTime(new Date()); +// if (!cacheSiteService.updateById(cacheSite)) { +// throw new CoolException("缂撳瓨绔欐洿鏂板け璐�"); +// } +// } +// } //搴撲綅F => R loc.setLocStsId(LocStsType.R.val()); @@ -1226,7 +1245,7 @@ /** * @author Ryan * @date 2025/7/4 - * @description: 鐢熼潰鎷h揣鏄庣粏 + * @description: 鐢熸垚鎷h揣鏄庣粏 * @version 1.0 */ @Transactional(rollbackFor = Exception.class) @@ -1260,6 +1279,12 @@ if (!locDetlService.updateById(locDetl)) { throw new CoolException("搴撳瓨鍔犻攣澶辫触锛侊紒"); } + + orderDetlService.update(new LambdaUpdateWrapper<OrderDetl>() + .set(OrderDetl::getWareType, 2) + .eq(OrderDetl::getMatId, mat.getId()) + .eq(StringUtils.isNullOrEmpty(outOder.getBatch()), OrderDetl::getBatch, outOder.getBatch()) + .in(OrderDetl::getOrderId, outOder.getOrderIds())); }); curLoc.setLocStsId(LocStsType.R.val()); @@ -1627,7 +1652,10 @@ for (LocDetl locDetl : param.getLocDetls()) { List<OrderOutMergeParam> orders = new ArrayList<>(); - LocDetl detl = locDetlService.getOne(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocNo, locDetl.getLocNo())); + LocDetl detl = locDetlService.getOne(new LambdaQueryWrapper<LocDetl>() + .eq(LocDetl::getMatId, locDetl.getMatId()) + .eq(LocDetl::getBatch, locDetl.getBatch()) + .eq(LocDetl::getLocNo, locDetl.getLocNo())); if (Objects.isNull(detl)) { continue; } -- Gitblit v1.9.1