From 4114759a57d73661937f28a765fb8a67c017b14b Mon Sep 17 00:00:00 2001 From: zjj <3272660260@qq.com> Date: 星期二, 24 六月 2025 16:28:41 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/devlop' into devlop --- rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java | 56 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 28 insertions(+), 28 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..0b07961 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,11 +7,13 @@ 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; import com.vincent.rsf.server.manager.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.vincent.rsf.server.manager.utils.LocManageUtil; import com.vincent.rsf.server.manager.utils.OptimalAlgorithmUtil; import com.vincent.rsf.server.system.constant.SerialRuleCode; import com.vincent.rsf.server.system.utils.SerialRuleUtils; @@ -58,7 +60,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 +118,26 @@ if (items.isEmpty()) { throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�"); } + + for (int i = 0; i < items.size(); i++) { + List<LocItem> locItems = LocManageUtil.getEfficiencyFirstItemList(items.get(i).getMatnrCode(), items.get(i).getSplrBatch(), items.get(i).getAnfme()); + items.get(i).setStockLocs(JSONArray.toJSONString(locItems)).setStockQty(items.get(i).getAnfme()); + } /**鐢熸垚鍑哄簱浠诲姟*/ 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; + + if (!waveItemService.update(new LambdaUpdateWrapper<WaveItem>() + .set(WaveItem::getExceStatus, WaveItemExceStatus.WAVE_EXCE_STATUS_ING.val) + .in(WaveItem::getId, waveItems))) { + throw new CoolException("涓嬪彂鎵ц寮傚父锛岃绋嶅�欓噸璇曪紒"); + } + + return R.ok(); } /** @@ -142,28 +156,14 @@ for (WaveItem param : itemParams) { String locs = param.getStockLocs(); List<LocItem> locItems = JSONArray.parseArray(locs, LocItem.class); - if (locItems.isEmpty()) { - continue; - } - 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::getMatnrCode, param.getMatnrCode())); - if (items.isEmpty()) { - throw new CoolException("搴撳瓨淇℃伅鏈夊彉锛岃鍙栨秷褰撳墠娉㈡锛岀敓鏂扮敓鎴愭柊鐨勬尝娆★紒锛�"); - } /***灏嗘湁璐ф湁鐨勬槑缁嗕俊鎭瓨鏀惧埌搴撲綅淇℃伅涓�*/ - for (int i = 0; i < items.size(); i++) { - items.get(i) + for (int i = 0; i < locItems.size(); i++) { + locItems.get(i) .setSourceId(param.getWaveId()) .setSourceCode(param.getWaveCode()) .setSource(param.getId()); } - locItemList.addAll(items); + locItemList.addAll(locItems); } if (locItemList.isEmpty()) { throw new CoolException("娌℃湁鍚堥�傚簱浣嶏紒锛�"); @@ -190,17 +190,17 @@ 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) .setTaskStatus(TaskStsType.GENERATE_OUT.id) .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 +214,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 +229,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