From 0400f9faa256df6095a00e6facd10b2c4646cb9a Mon Sep 17 00:00:00 2001
From: zc <zyzc>
Date: 星期四, 20 十一月 2025 20:36:53 +0800
Subject: [PATCH] 入庫功能優化
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 80 ++++++++++++++++++++++------------------
1 files changed, 44 insertions(+), 36 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 a0d4c53..cdcfd8c 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
@@ -683,10 +683,9 @@
if (Objects.isNull(loc)) {
throw new CoolException("搴撳瓨涓嶅瓨鍦紒锛�");
}
- if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)) {
- throw new CoolException("褰撳墠搴撲綅鐘舵�佷笉澶勪簬S.鍏ュ簱棰勭害锛屼笉鍙墽琛屽叆搴撴搷浣滐紒");
- }
-
+// 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());
@@ -705,6 +704,7 @@
LocItem locItem = new LocItem();
LocItemWorking locWorking = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>()
.eq(LocItemWorking::getTaskId, taskItem.getTaskId())
+ .eq(LocItemWorking::getFieldsIndex, taskItem.getFieldsIndex())
.eq(StringUtils.isNotBlank(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch())
.eq(LocItemWorking::getMatnrId, taskItem.getMatnrId()));
if (Objects.isNull(locWorking)) {
@@ -788,7 +788,6 @@
} else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) {
List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, Arrays.asList(ids)));
if (!taskItems.isEmpty()) {
-
taskItems.forEach(taskItem -> {
if (!checkOrderItemService.update(new LambdaUpdateWrapper<WkOrderItem>()
.eq(WkOrderItem::getId, taskItem.getOrderItemId())
@@ -868,7 +867,7 @@
if (Objects.isNull(waveItem)) {
throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�");
}
- Double workQty = Math.round((waveItem.getWorkQty() - item.getAnfme()) * 10000) / 10000.0;
+ Double workQty = Math.round((waveItem.getWorkQty() - item.getAnfme()) * 100) / 100.0;
waveItem.setWorkQty(workQty).setExceStatus(WaveItemExceStatus.WAVE_ITEM_EXCE_STATUS_UN.val);
if (!waveItemService.updateById(waveItem)) {
throw new CoolException("娉㈡鏄庣粏鏇存柊澶辫触锛侊紒");
@@ -892,7 +891,7 @@
if (Objects.isNull(wkOrder)) {
throw new CoolException("鏁版嵁閿欒锛氬崟鎹凡涓嶅瓨鍦紒锛�");
}
- Double workQty = Math.round((wkOrder.getWorkQty() - item.getAnfme()) * 10000) / 10000.0;
+ Double workQty = Math.round((wkOrder.getWorkQty() - item.getAnfme()) * 100) / 100.0;
wkOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)
.setWorkQty(workQty.compareTo(0.00) > 0 ? workQty : 0.00)
@@ -907,7 +906,7 @@
throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗗凡涓嶅瓨鍦紒锛�");
}
- Double workItmQty = Math.round((orderItem.getWorkQty() - item.getAnfme()) * 10000) / 10000.0;
+ Double workItmQty = Math.round((orderItem.getWorkQty() - item.getAnfme()) * 100) / 100.0;
orderItem.setWorkQty(workItmQty);
if (!outStockItemService.updateById(orderItem)) {
@@ -1020,7 +1019,7 @@
if (taskItem.getMatnrId().equals(working.getMatnrId())) {
Double minQty = taskItem.getAnfme();
if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
- minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0;
+ minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 100) / 100.0;
}
if (minQty.compareTo(0.0) > 0) {
taskItem.setAnfme(minQty);
@@ -1029,16 +1028,16 @@
}
} else {
if (!taskItemService.removeById(taskItem)) {
- throw new CoolException("浠诲姟鏄庣粏淇敼澶辫触锛侊紒");
+ log.error("浠诲姟鏄庣粏淇敼澶辫触锛侊紒");
}
}
}
});
});
- List<Long> matnrIds = taskItems.stream().map(TaskItem::getMatnrId).collect(Collectors.toList());
+ List<String> matnrIds = taskItems.stream().map(TaskItem::getFieldsIndex).collect(Collectors.toList());
//鍒犻櫎涓庝换鍔℃槑缁嗛噸澶嶇殑搴撳瓨淇℃伅锛屼互浠诲姟鏄庣粏涓哄噯
List<LocItemWorking> itemWorkings = tempLocs.stream()
- .filter(working -> !matnrIds.contains(working.getMatnrId()))
+ .filter(working -> !matnrIds.contains(working.getFieldsIndex()))
.collect(Collectors.toList());
itemWorkings.forEach(working -> {
TaskItem taskItem = taskItems.stream().findFirst().get();
@@ -1206,27 +1205,36 @@
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.UPDATED_OUT.id))) {
- throw new CoolException("搴撳瓨鐘舵�佹洿鏂板け璐ワ紒锛�");
- }
- //鍏ㄦ澘鍑哄簱锛屽垹闄や复鏃跺簱瀛�
- if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.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("涓存椂搴撳瓨娓呴櫎澶辫触锛侊紒");
+//// }
+// }
}
@@ -1269,7 +1277,7 @@
stock.setSourceId(waveItem.getId()).setType(OrderType.ORDER_OUT.type);
} else if (!Objects.isNull(orderItem) && StringUtils.isNotBlank(orderItem.getId() + "")) {
WkOrder wkOrder = asnOrderService.getById(orderItem.getOrderId());
- Double qty = Math.round((wkOrder.getQty() + sum) * 10000) / 10000.0;
+ Double qty = Math.round((wkOrder.getQty() + sum) * 100) / 100.0;
wkOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_WORKING.val)
.setQty(qty);
if (!asnOrderService.updateById(wkOrder)) {
@@ -1393,8 +1401,8 @@
if (Objects.isNull(itemServiceOne)) {
throw new CoolException("鏁版嵁閿欒锛氳鏌ョ湅璇疯揣鍖哄簱瀛樻槸鍚﹀瓨鍦紒锛�");
}
- Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 10000) / 10000.0;
- Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 10000) / 10000.0;
+ Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 100) / 100.0;
+ Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 100) / 100.0;
itemServiceOne.setWorkQty(workQty).setQty(qty);
if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
@@ -1453,7 +1461,7 @@
.setType(taskItem.getOrderType());
locItems.add(item);
} else {
- locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 10000) / 10000.0)
+ locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 100) / 100.0)
.setUpdateTime(new Date());
locItems.add(locItem);
}
--
Gitblit v1.9.1