From e27e33c9fb1c36fbedc3abb96307a620800f8b35 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期二, 03 二月 2026 14:49:48 +0800
Subject: [PATCH] lsh#
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 160 insertions(+), 16 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 895d116..fe84af7 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
@@ -150,11 +150,11 @@
}
Task task = new Task();
task.setTaskCode(ruleCode)
- .setTaskStatus(TaskStsType.GENERATE_IN.id)
+ .setTaskStatus(TaskStsType.MISSION_INITIAL.id)
.setTaskType(TaskType.TASK_TYPE_IN.type)
.setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)
.setTargLoc(targetLoc)
- .setTargSite(targSite)
+ //.setTargSite(targSite)//鍏ュ簱娌℃湁鐩爣绔欑偣
.setOrgSite(orgSta)
.setBarcode(pakin.getBarcode())
.setCreateBy(loginUserId)
@@ -509,7 +509,7 @@
for (BasContainer container : containers) {
String codeType = container.getCodeType(); // 鑾峰彇姝e垯琛ㄨ揪寮�
if (barcode.matches(codeType)) { // 鍒ゆ柇鏉$爜鏄惁绗﹀悎杩欎釜姝e垯
- List<Integer> areaList2 = container.getAreas();
+ List<Integer> areaList2 = container.getAreasIds();
if (!areaList2.contains(Integer.parseInt(area))) {
matches2 = false;
continue;
@@ -664,7 +664,7 @@
}
Task task = new Task();
task.setTaskCode(ruleCode)
- .setTaskStatus(TaskStsType.WCS_EXECUTE_IN.id)
+ .setTaskStatus(TaskStsType.MISSION_INITIAL.id)
.setTaskType(TaskType.TASK_TYPE_IN.type)
.setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
.setTargLoc(targetLoc)
@@ -758,9 +758,12 @@
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
//绉诲簱
moveInStock(task, loginUserId);
- } else if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type)) {
//绉诲簱
complateInstockE(task, loginUserId);
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)) {
+ //瓒婂簱
+ complateInstockDocking(task, loginUserId);
}
}
}
@@ -830,7 +833,7 @@
*/
private Task modiftyTaskSort(Task task, Long loginUserId) {
String curLoc;
- if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
+ if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type)) {
curLoc = task.getTargLoc();
} else {
curLoc = task.getOrgLoc();
@@ -981,9 +984,12 @@
for (Task task : tasks) {
//鍑哄簱浠诲姟
try {
- if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) {
+ if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)) {
//110.绌烘澘鍑哄簱
complateOutStockEmpty(task, loginUserId);
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)) {
+ //110.绌烘澘鍑哄簱
+ complateOutStockDocking(task, loginUserId);
} else {
complateOutStock(task, loginUserId);
}
@@ -1062,6 +1068,50 @@
}
/**
+ * 瓒婂簱鍥炲簱
+ *
+ * @param task
+ * @param loginUserId
+ */
+ @Transactional(rollbackFor = Exception.class)
+ public void complateInstockDocking(Task task, Long loginUserId) {
+ if (Objects.isNull(task)) {
+ return;
+ }
+ Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()));
+ if (Objects.isNull(loc)) {
+ throw new CoolException("搴撳瓨涓嶅瓨鍦紒锛�");
+ }
+// if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)) {
+// throw new CoolException("褰撳墠搴撲綅鐘舵�佷笉澶勪簬S.鍏ュ簱棰勭害锛屼笉鍙墽琛屽叆搴撴搷浣滐紒");
+// }
+ loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type)
+ .setBarcode(task.getBarcode())
+ .setUpdateBy(loginUserId).setUpdateTime(new Date());
+
+ if (!locService.updateById(loc)) {
+ throw new CoolException("搴撲綅淇℃伅鏇存柊澶辫触锛侊紒");
+ }
+
+ List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()));
+ if (taskItems.isEmpty()) {
+ throw new CoolException("浠诲姟鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+
+ TaskItem taskItem = taskItems.stream().findFirst().get();
+ //淇濆瓨鍏ュ嚭搴撴祦姘�
+ saveStockItems(taskItems, task, null, null, taskItem.getWkType(), OrderType.ORDER_IN.type, loginUserId);
+
+ locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()));
+
+ task.setTaskStatus(TaskStsType.UPDATED_IN.id).setUpdateTime(new Date()).setUpdateBy(loginUserId);
+ if (!taskService.updateById(task)) {
+ throw new CoolException("浠诲姟鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+ }
+
+ }
+
+ /**
* 浠诲姟鍙栨秷
*
* @param ids
@@ -1073,8 +1123,8 @@
public R removeTask(Long[] ids, Long loginUserId) {
List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id);
List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type,
- TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type,
- TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
+ TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPTY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type,
+ TaskType.TASK_TYPE_EMPTY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type);
List<Task> tasks = this.list(new LambdaQueryWrapper<Task>()
.in(Task::getTaskType, list)
.in(Task::getId, ids)
@@ -1148,7 +1198,7 @@
if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) {
BasStation basStation = null;
- if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
+ if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type)) {
basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
.eq(BasStation::getStationName, task.getOrgSite())
.eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type));
@@ -1156,7 +1206,7 @@
|| task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
- || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) {
+ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)) {
basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
.eq(BasStation::getStationName, task.getTargLoc())
.eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type));
@@ -1572,6 +1622,100 @@
*/
@Synchronized
@Transactional(rollbackFor = Exception.class)
+ public void complateOutStockDocking(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);
+ }
+
+
+ //娣诲姞鍑哄叆搴撹褰曚俊鎭�
+ 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_STOCK_UP.val)) {
+ WkOrderItem orderItem = asnOrderItemService.getById(key);
+ if (Objects.isNull(orderItem)) {
+ throw new CoolException("鍗曟嵁鏄庣粏涓嶅瓨鍦紒锛�");
+ }
+ try {
+ saveOutStockItem(taskItems, orderItem, null, null, loginUserId);
+ } catch (Exception e) {
+ throw new CoolException(e.getMessage());
+ }
+ }
+ });
+ } 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_S.type)
+ .set(Loc::getBarcode, loc.getBarcode())
+ .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::getTargLoc, task.getOrgLoc())
+ .set(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id))) {
+ throw new CoolException("搴撳瓨鐘舵�佹洿鏂板け璐ワ紒锛�");
+ }
+ }
+
+ /**
+ * @author Ryan
+ * @date 2025/5/20
+ * @description: 瀹屾垚鍑哄簱浠诲姟锛屾洿鏂板嚭搴撳簱瀛樹俊鎭�
+ * @version 1.0
+ */
+ @Synchronized
+ @Transactional(rollbackFor = Exception.class)
public void complateOutStockEmpty(Task task, Long loginUserId) throws Exception {
if (Objects.isNull(task)) {
throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
@@ -1759,7 +1903,7 @@
itemParam.setOriLoc(task.getOrgLoc()).setDestLoc(task.getTargLoc());
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type)
- || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
+ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type)) {
/**鍏ㄦ澘鍏ュ簱鍙傛暟*/
itemParam.setDestLoc(task.getTargLoc())
.setOriSta(task.getOrgSite());
@@ -1769,7 +1913,7 @@
.setOriSta(task.getTargSite());
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)
- || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)) {
/**鍑哄簱鍙傛暟*/
@@ -1821,7 +1965,7 @@
if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)
- || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
@@ -1847,7 +1991,7 @@
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type)
- || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)
+ || task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_OUT.type)
|| task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) {
BasStation curSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, task.getTargSite()));
if (Objects.isNull(curSta)) {
@@ -2088,7 +2232,7 @@
if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) ||
task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) ||
task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) ||
- task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type) ||
+ task.getTaskType().equals(TaskType.TASK_TYPE_EMPTY_IN.type) ||
task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
stock.setLocCode(task.getTargLoc());
} else {
--
Gitblit v1.9.1