From 7a92ebbfb8227ff30ebe3300cc9db263a75b7e22 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期四, 05 三月 2026 13:06:15 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 162 insertions(+), 7 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index a3a28ed..db8643e 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -494,12 +494,13 @@
throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
}
- List<Long> areaList = basStation.getCrossZoneArea();
- if (!areaList.contains(Long.parseLong(area))) {
+ if (!basStation.getCrossZoneArea().contains(Integer.parseInt(area))) {
throw new CoolException("褰撳墠绔欑偣涓嶆敮鎸佺洰鏍囧簱鍖�");
}
if (!Cools.isEmpty(basStation.getContainerType())) {
- List<Long> longs1 = basStation.getContainerType();
+ List<Long> longs1 = basStation.getContainerType().stream()
+ .map(Integer::longValue)
+ .collect(Collectors.toList());
List<BasContainer> containers = basContainerService.list(
new LambdaQueryWrapper<BasContainer>()
.in(BasContainer::getContainerType, longs1)
@@ -558,7 +559,9 @@
throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
}
if (!Cools.isEmpty(basStation.getContainerType())) {
- List<Long> longs1 = basStation.getContainerType();
+ List<Long> longs1 = basStation.getContainerType().stream()
+ .map(Integer::longValue)
+ .collect(Collectors.toList());
List<BasContainer> containers = basContainerService.list(
new LambdaQueryWrapper<BasContainer>()
.in(BasContainer::getContainerType, longs1)
@@ -612,7 +615,9 @@
}
warehouseAreasList.add(warehouseArea);
} else {
- List<Long> areaList = basStation.getCrossZoneArea();
+ List<Long> areaList = basStation.getCrossZoneArea().stream()
+ .map(Integer::longValue)
+ .collect(Collectors.toList());
if (areaList.isEmpty()) {
throw new CoolException("褰撳墠绔欑偣搴撳尯鏈厤缃�");
}
@@ -992,10 +997,12 @@
complateOutStockDocking(task, loginUserId);
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) {
//107.鐩�
- pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK);
+// pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK);
+ complateOutStock2(task, loginUserId);
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) {
//103.鎷i��
- pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK);
+// pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_PICK);
+ complateOutStock2(task, loginUserId);
} else {
complateOutStock(task, loginUserId);
}
@@ -1498,6 +1505,154 @@
*/
@Synchronized
@Transactional(rollbackFor = Exception.class)
+ public void complateOutStock2(Task task, Long loginUserId) throws Exception {
+ if (Objects.isNull(task)) {
+ throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
+ }
+ Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc()));
+ if (Objects.isNull(loc)) {
+ throw new CoolException("搴撲綅涓嶅瓨鍦紒锛�");
+ }
+ if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) {
+ throw new CoolException("搴撲綅鐘舵�佷笉澶勭悊浜嶳.鍑哄簱棰勭害锛侊紒");
+ }
+
+ List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
+ if (taskItems.isEmpty()) {
+ throw new CoolException("浠诲姟鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+
+ List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId()));
+ if (locItems.isEmpty()) {
+ throw new CoolException("搴撲綅鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+
+ List<LocItemWorking> workings = new ArrayList<>();
+ for (LocItem item : locItems) {
+ LocItemWorking working = new LocItemWorking();
+ BeanUtils.copyProperties(item, working);
+ working.setId(null)
+ .setTaskId(task.getId())
+ .setLocItemId(item.getId())
+ .setUpdateBy(loginUserId)
+ .setUpdateTime(new Date());
+ workings.add(working);
+ }
+
+ if (!locItemWorkingService.saveBatch(workings)) {
+ throw new CoolException("涓存椂搴撳瓨淇濆瓨澶辫触锛侊紒");
+ }
+
+ try {
+ //鏇存柊搴撲綅鏄庣粏
+ subtractLocItem(loc);
+ } catch (Exception e) {
+ logger.error("<UNK>", e);
+ throw new CoolException(e.getMessage());
+ }
+
+ //娣诲姞鍑哄叆搴撹褰曚俊鎭�
+ Map<Short, List<TaskItem>> listMap = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getWkType));
+ /***鑾峰彇搴撳瓨鍑哄簱鍊硷紝濡傛灉涓虹┖琛ㄧず姝e父鍗曟嵁鍑哄簱锛岄潪绌鸿〃鏄庢槸搴撳瓨鍑哄簱
+ * 1. 搴撳瓨鍑哄簱娌℃湁鍗曟嵁淇℃伅锛屽崟鎹俊鎭粯璁や负绌�
+ * 2. 鍗曟嵁搴撳瓨闇�閫氳繃娉㈡鏌ヨ鍘熷鍗曟嵁淇℃伅锛屽皢鍗曟嵁淇℃伅濉叆stock涓�
+ * */
+ List<TaskItem> list = listMap.get(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type));
+ if (Objects.isNull(list) || list.isEmpty()) {
+ Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource));
+ maps.keySet().forEach(key -> {
+ if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) {
+ WaveItem waveItem = waveItemService.getById(key);
+ if (Objects.isNull(waveItem)) {
+ throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+// try {
+// saveOutStockItem(maps.get(key), null, waveItem, null, loginUserId);
+// } catch (Exception e) {
+// throw new CoolException(e.getMessage());
+// }
+ } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val)) {
+ WkOrderItem orderItem = asnOrderItemService.getById(key);
+ if (Objects.isNull(orderItem)) {
+ throw new CoolException("鍗曟嵁鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+ try {
+ saveOutStockItem(maps.get(key), orderItem, loginUserId);
+ } catch (Exception e) {
+ throw new CoolException(e.getMessage());
+ }
+ } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val)) {
+ WkOrderItem orderItem = asnOrderItemService.getById(key);
+ if (Objects.isNull(orderItem)) {
+ throw new CoolException("鍗曟嵁鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+ try {
+ saveOutStockItem(maps.get(key), null, null, orderItem, loginUserId);
+ } catch (Exception e) {
+ throw new CoolException(e.getMessage());
+ }
+ } else {
+
+ }
+ });
+ } else {
+ try {
+ saveOutStockItem(taskItems, null, null, null, loginUserId);
+ } catch (Exception e) {
+ throw new CoolException(e.getMessage());
+ }
+ }
+
+ /**淇敼涓哄簱浣嶇姸鎬佷负O.绌哄簱*/
+ if (!locService.update(new LambdaUpdateWrapper<Loc>()
+ .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)
+ .set(Loc::getBarcode, null)
+ .set(Loc::getUpdateBy, loginUserId)
+ .set(Loc::getUpdateTime, new Date())
+ .eq(Loc::getId, loc.getId()))) {
+ throw new CoolException("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+
+ if (!this.update(new LambdaUpdateWrapper<Task>()
+ .eq(Task::getId, task.getId())
+ .set(Task::getUpdateBy, loginUserId)
+ .set(Task::getUpdateTime, new Date())
+ .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) {
+ throw new CoolException("搴撳瓨鐘舵�佹洿鏂板け璐ワ紒锛�");
+ }
+
+// if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) {
+// if (!this.update(new LambdaUpdateWrapper<Task>()
+// .eq(Task::getId, task.getId())
+// .set(Task::getUpdateBy, loginUserId)
+// .set(Task::getUpdateTime, new Date())
+// .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) {
+// throw new CoolException("搴撳瓨鐘舵�佹洿鏂板け璐ワ紒锛�");
+// }
+// } else {
+// if (!this.update(new LambdaUpdateWrapper<Task>()
+// .eq(Task::getId, task.getId())
+// .set(Task::getUpdateBy, loginUserId)
+// .set(Task::getUpdateTime, new Date())
+// .set(Task::getTaskStatus, TaskStsType.WAVE_SEED.id))) {
+// throw new CoolException("搴撳瓨鐘舵�佹洿鏂板け璐ワ紒锛�");
+// }
+//// //鍏ㄦ澘鍑哄簱锛屽垹闄や复鏃跺簱瀛�
+//// if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) {
+//// throw new CoolException("涓存椂搴撳瓨娓呴櫎澶辫触锛侊紒");
+//// }
+// }
+
+ }
+
+ /**
+ * @author Ryan
+ * @date 2025/5/20
+ * @description: 瀹屾垚鍑哄簱浠诲姟锛屾洿鏂板嚭搴撳簱瀛樹俊鎭�
+ * @version 1.0
+ */
+ @Synchronized
+ @Transactional(rollbackFor = Exception.class)
public void complateOutStock(Task task, Long loginUserId) throws Exception {
if (Objects.isNull(task)) {
throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
--
Gitblit v1.9.1