From 1c7184503554a6728895489b084cc4b523f261f2 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期五, 23 五月 2025 09:39:48 +0800
Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/WaveServiceImpl.java | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 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 73b2acd..9584e8a 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
@@ -1,14 +1,13 @@
package com.vincent.rsf.server.manager.service.impl;
import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.api.entity.enums.TaskStsType;
-import com.vincent.rsf.server.api.entity.enums.TaskType;
+import com.vincent.rsf.server.manager.enums.TaskStsType;
+import com.vincent.rsf.server.manager.enums.TaskType;
import com.vincent.rsf.server.manager.entity.*;
import com.vincent.rsf.server.manager.enums.AsnExceStatus;
import com.vincent.rsf.server.manager.enums.WaveExceStatus;
@@ -18,6 +17,7 @@
import com.vincent.rsf.server.manager.utils.OptimalAlgorithmUtil;
import com.vincent.rsf.server.system.constant.SerialRuleCode;
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
+import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
@@ -68,7 +68,6 @@
if (Objects.isNull(waves)) {
throw new CoolException("娉㈡鏁版嵁涓嶅瓨鍦紒锛�");
}
-// List<Long> list = itemParams.stream().map(WaveItem::getWaveId).collect(Collectors.toList());
List<WaveItem> waveItems = waveItemService.list(new LambdaQueryWrapper<WaveItem>().eq(WaveItem::getWaveId, waves.getId()));
if (waveItems.isEmpty()) {
throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�");
@@ -85,17 +84,12 @@
// 3. 淇敼涓诲崟銆佹尝娆℃墽琛屾暟閲�
// 4. 鍒ゆ柇鍏ㄤ粨鍑哄簱鎴栨嫞鏂欏嚭搴�
List<Long> orderIds = waveItems.stream().map(WaveItem::getOrderId).collect(Collectors.toList());
-// List<AsnOrder> orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, orderIds));
/**淇敼鍑哄簱鍗曠姸鎬�*/
if (!asnOrderService.update(new LambdaUpdateWrapper<AsnOrder>()
.set(AsnOrder::getExceStatus, AsnExceStatus.OUT_STOCK_STATUS_TASK_WORKING.val)
.in(AsnOrder::getId, orderIds))) {
throw new CoolException("鍑哄簱鍗曟嵁鐘舵�佷慨鏀瑰け璐ワ紒锛�");
}
-// /**淇敼娉㈡鍗曟嵁鎵ц鐘舵��*/
-// if (!this.update(new LambdaUpdateWrapper<Wave>().set(Wave::getExceStatus, WaveExceStatus.WAVE_EXCE_STATUS_TASK).eq(Wave::getId, waves.getId()))) {
-// throw new CoolException("娉㈡鐘舵�佷慨鏀瑰け璐ワ紒锛�");
-// }
return R.ok();
}
@@ -108,8 +102,9 @@
* @description 鐢熸垚鍑哄簱浠诲姟
* @time 2025/4/28 14:01
*/
+ @Synchronized
@Transactional(rollbackFor = Exception.class)
- private synchronized void generateOutTask(List<WaveItem> itemParams, Long loginUserId, Wave wave) throws Exception {
+ public void generateOutTask(List<WaveItem> itemParams, Long loginUserId, Wave wave) throws Exception {
List<LocItem> locItemList = new ArrayList<>();
for (WaveItem param : itemParams) {
String locs = param.getStockLocs();
@@ -160,6 +155,12 @@
if (Objects.isNull(loc)) {
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)
@@ -178,7 +179,10 @@
TaskItem taskItem = new TaskItem();
BeanUtils.copyProperties(item, taskItem);
taskItem.setTaskId(task.getId())
+ .setAnfme(waveItem.getAnfme())
.setId(null)
+ .setSourceCode(wave.getCode())
+ .setSourceId(wave.getId())
.setSource(item.getWaveItemId());
taskItems.add(taskItem);
}
@@ -244,7 +248,8 @@
* @description 鏍规嵁鐗╂枡缂栫爜锛屾壒娆★紝鍔ㄦ�佸瓧娈� 鏌ヨ绗﹀悎鐨勫簱浣嶏紝鍐嶆牴鎹簱浣嶄腑鐗╂枡鐨勬暟閲忛�夋嫨鏈�閫傚悎鐨勫簱浣�
* @time 2025/4/27 09:26
*/
- private synchronized List<WaveItem> getLocs(List<WaveItem> waveItems) throws Exception {
+ @Synchronized
+ private List<WaveItem> getLocs(List<WaveItem> waveItems) throws Exception {
//TODO 鏍规嵁鐗╂枡缂栫爜锛屾壒娆★紝鍔ㄦ�佸瓧娈� 鏌ヨ绗﹀悎鐨勫簱浣嶏紝鍐嶆牴鎹簱浣嶄腑鐗╂枡鐨勬暟閲忛�夋嫨鏈�閫傚悎鐨勫簱浣�
waveItems.forEach(waveItem -> {
List<LocItem> locItems = locItemService.list(new QueryWrapper<LocItem>()
--
Gitblit v1.9.1