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/LocItemServiceImpl.java | 47 ++++++++++++++++++++++++++++++++++-------------
1 files changed, 34 insertions(+), 13 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
index 15505a1..264c649 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -51,6 +51,8 @@
private WaveService waveService;
@Autowired
private BasStationService basStationService;
+ @Autowired
+ private LocItemWorkingService locItemWorkingService;
/**
@@ -106,7 +108,7 @@
//绌哄鍣ㄥ嚭搴�
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
.eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
- .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_OUT.type));
+ .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_OUT.type).last("limit 1"));
if (Objects.isNull(deviceSite)) {
throw new CoolException("绔欑偣涓嶆敮鎸佺┖瀹瑰櫒鍑哄簱锛侊紒");
}
@@ -134,9 +136,9 @@
@Synchronized
@Transactional(rollbackFor = Exception.class)
public synchronized void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception {
- if (Objects.isNull(map.getSiteNo())) {
- throw new CoolException("绔欑偣涓嶈兘涓虹┖锛�");
- }
+// if (Objects.isNull(map.getSiteNo())) {
+// throw new CoolException("绔欑偣涓嶈兘涓虹┖锛�");
+// }
if (Objects.isNull(map.getItems()) || map.getItems().isEmpty()) {
throw new CoolException("鏄庣粏涓嶈兘涓虹┖锛�");
}
@@ -175,7 +177,7 @@
throw new CoolException("搴撲綅鐘舵�佹洿鏂板け璐ワ紒锛�");
}
- //澧炲姞瀵瑰璐у崟寰楀垽鏂�
+ //澧炲姞瀵瑰璐у崟鐨勫垽鏂�
Integer taskStatus = resouce.equals(TaskResouceType.TASK_RESOUCE_STOCK_UP.val)
? TaskStsType.MISSION_INITIAL.id:TaskStsType.MISSION_INITIAL.id;
@@ -192,6 +194,7 @@
.setUpdateTime(new Date())
.setTaskStatus(taskStatus)
.setBarcode(loc.getBarcode())
+ .setTargSiteArea(map.getTargSiteAreaList())
.setMemo(map.getMemo());
List<LocItem> locItems = this.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, key));
@@ -211,7 +214,7 @@
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
.eq(DeviceSite::getSite, siteNo)
.eq(!Objects.isNull(loc.getChannel()),DeviceSite::getChannel, loc.getChannel())
- .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type));
+ .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).last("limit 1"),false);
if (Objects.isNull(deviceSite)) {
throw new CoolException("绔欑偣涓嶆敮鎸佹嫞鏂欏嚭搴擄紒锛�");
}
@@ -220,8 +223,8 @@
if (resouce.equals(TaskResouceType.TASK_RESOUCE_STOCK_UP.val)){
//鍏ㄦ澘鍑哄簱
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type));
-// .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
+ .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)
+ .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()).last("limit 1"));
if (Objects.isNull(deviceSite)) {
throw new CoolException("绔欑偣涓嶆敮鎸佽秺搴擄紒锛�");
}
@@ -229,8 +232,8 @@
} else {
//鍏ㄦ澘鍑哄簱
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
- .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type));
-// .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
+ .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type)
+ .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()).last("limit 1"));
if (Objects.isNull(deviceSite)) {
throw new CoolException("绔欑偣涓嶆敮鎸佸叏鏉垮嚭搴擄紒锛�");
}
@@ -243,7 +246,7 @@
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
.eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel())
.eq(DeviceSite::getSite, siteNo)
- .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type));
+ .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type).last("limit 1"));
if (Objects.isNull(deviceSite)) {
throw new CoolException("褰撳墠绔欑偣涓嶆敮鎸佺洏鐐瑰嚭搴擄紒锛�");
}
@@ -286,7 +289,6 @@
throw new CoolException("涓讳换鍔″叧鑱斿け璐ワ紒锛�");
}
}
-
List<TaskItem> taskItems = new ArrayList<>();
listMap.get(key).forEach(item -> {
TaskItem taskItem = new TaskItem();
@@ -340,7 +342,26 @@
if (!locItemService.updateById(item)) {
throw new CoolException("搴撳瓨淇℃伅淇敼澶辫触锛侊紒");
}
+
});
+
+ locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()));
+
+ 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("涓存椂搴撳瓨鏇存柊澶辫触锛侊紒");
+ }
if (!taskItemService.saveBatch(taskItems)) {
throw new CoolException("浠诲姟鏄庣粏鐢熸垚澶辫触锛侊紒");
@@ -381,7 +402,7 @@
//鐩爣搴撲綅涓虹┖锛岃嚜鍔ㄨ幏鍙栨柊搴撲綅
DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>()
.eq(DeviceSite::getType, TaskType.TASK_TYPE_LOC_MOVE.type)
- .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()), false);
+ .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()).last("limit 1"), false);
if (Objects.isNull(deviceSite)) {
throw new CoolException("绔欑偣淇℃伅涓嶅瓨鍦紒锛�");
}
--
Gitblit v1.9.1