From 498f1e36c99529f1a25bd7c6916a762375884bcb Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 24 六月 2025 16:28:02 +0800 Subject: [PATCH] #波次拣货 --- rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java | 44 ++++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java index dc7c842..53d92c7 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.vincent.rsf.framework.common.R; import com.vincent.rsf.framework.exception.CoolException; +import com.vincent.rsf.server.common.constant.Constants; import com.vincent.rsf.server.manager.enums.*; import com.vincent.rsf.server.manager.entity.*; import com.vincent.rsf.server.manager.mapper.WaveMapper; @@ -58,7 +59,7 @@ @Override @Transactional(rollbackFor = Exception.class) public R publicTask(Map<String, Object> map, Long loginUserId) { - List<WaveItem> itemParams = (List<WaveItem>) map.get("waveItem"); + List<WaveItem> itemParams = JSONArray.parseArray(JSON.toJSONString(map.get("waveItem")), WaveItem.class); if (Objects.isNull(itemParams) || itemParams.isEmpty()) { throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒"); } @@ -116,14 +117,21 @@ if (items.isEmpty()) { throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�"); } + + if (!waveItemService.update(new LambdaUpdateWrapper<WaveItem>() + .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_ING.val) + .in(WaveItem::getId, waveItems))) { + throw new CoolException("涓嬪彂鎵ц寮傚父锛岃绋嶅�欓噸璇曪紒"); + } + /**鐢熸垚鍑哄簱浠诲姟*/ try { generateOutTask(items, loginUserId, waves); } catch (Exception e) { - log.error(e.getMessage()); - throw new CoolException("鍑哄簱浠诲姟鐢熸垚澶辫触锛侊紒锛�"); + log.error("UNK", e); + throw new CoolException(e.getMessage()); } - return null; + return R.ok(); } /** @@ -142,16 +150,19 @@ for (WaveItem param : itemParams) { String locs = param.getStockLocs(); List<LocItem> locItems = JSONArray.parseArray(locs, LocItem.class); - if (locItems.isEmpty()) { - continue; + List<Long> list = new ArrayList<>(); + if (Objects.isNull(locItems) || locItems.isEmpty()) { + //TODO + } else { + list = locItems.stream().map(LocItem::getLocId).collect(Collectors.toList()); } - List<Long> list = locItems.stream().map(LocItem::getLocId).collect(Collectors.toList()); + /**鏍规嵁渚涘簲鍟嗘壒娆★紝鐗╂枡鐮侊紝 鍔ㄦ�佸瓧娈垫煡璇㈡寚瀹氱殑鐗╂枡搴撳瓨淇℃伅*/ //TODO 杩欓噷闇�瑕佽鏍规嵁娉㈡瑙勫垯鏌ユ壘搴撳瓨淇℃伅 List<LocItem> items = locItemService.list(new LambdaQueryWrapper<LocItem>() - .eq(LocItem::getSplrBatch, param.getSplrBatch()) - .in(LocItem::getLocId, list) - .eq(StringUtils.isNotBlank(param.getFieldsIndex()), LocItem::getFieldsIndex, param.getFieldsIndex()) + .eq(LocItem::getBatch, param.getSplrBatch()) + .in(!list.isEmpty(), LocItem::getLocId, list) +// .eq(StringUtils.isNotBlank(param.getFieldsIndex()), LocItem::getFieldsIndex, param.getFieldsIndex()) .eq(LocItem::getMatnrCode, param.getMatnrCode())); if (items.isEmpty()) { throw new CoolException("搴撳瓨淇℃伅鏈夊彉锛岃鍙栨秷褰撳墠娉㈡锛岀敓鏂扮敓鎴愭柊鐨勬尝娆★紒锛�"); @@ -190,10 +201,10 @@ throw new CoolException("搴撲綅涓嶅瓨鍦紒锛�"); } - List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getSourceId, wave.getId())); - if (items.isEmpty()) { - throw new CoolException("娉㈡浠诲姟宸茬敓鎴愶紝涓嶈兘閲嶅鐢熸垚锛侊紒"); - } +// List<TaskItem> items = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getSourceId, wave.getId())); +// if (!items.isEmpty()) { +// throw new CoolException("娉㈡浠诲姟宸茬敓鎴愶紝涓嶈兘閲嶅鐢熸垚锛侊紒"); +// } task.setTaskCode(ruleCode) .setTaskType(TaskType.TASK_TYPE_OUT.type) @@ -201,6 +212,7 @@ .setResource(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val) .setBarcode(loc.getBarcode()) .setOrgLoc(loc.getCode()) + .setSort(Constants.TASK_SORT_DEFAULT_VALUE) .setCreateBy(loginUserId) .setUpdateBy(loginUserId) .setTargSite(wave.getTargSite()); @@ -214,7 +226,7 @@ TaskItem taskItem = new TaskItem(); BeanUtils.copyProperties(item, taskItem); taskItem.setTaskId(task.getId()) - .setAnfme(waveItem.getAnfme()) + .setAnfme(item.getAnfme()) .setId(null) .setSourceCode(wave.getCode()) .setSourceId(wave.getId()) @@ -229,7 +241,7 @@ taskItems.forEach(item -> { boolean update = waveItemService.update(new LambdaUpdateWrapper<WaveItem>() .eq(WaveItem::getId, item.getSource()) - .set(WaveItem::getExceStatus, AsnExceStatus) + .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_SEED.val) .set(WaveItem::getWorkQty, item.getAnfme())); if (!update) { throw new CoolException("娉㈡鎵ц鏁伴噺淇敼澶辫触锛侊紒"); -- Gitblit v1.9.1