From abd07017e715e62d195806ee3c78a98e0f0edd4c Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期六, 29 十一月 2025 17:48:01 +0800
Subject: [PATCH] 单条上报加入历史档
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 43 +++++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 20 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 484ccf4..11cc866 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
@@ -707,7 +707,7 @@
* @param loginUserId
*/
@Transactional(rollbackFor = Exception.class)
- public void pickComplateInStock(Task task, Long loginUserId) throws Exception {
+ public void pickComplateInStock(Task task, Long loginUserId) {
if (Objects.isNull(task)) {
return;
}
@@ -737,10 +737,10 @@
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(StringUtils.isNotEmpty(taskItem.getBatch()), LocItemWorking::getBatch, taskItem.getBatch())
.eq(LocItemWorking::getMatnrId, taskItem.getMatnrId()));
if (Objects.isNull(locWorking)) {
- throw new CoolException("鏁版嵁閿欒锛屼綔涓氫腑搴撳瓨鏁版嵁涓㈠け锛侊紒");
+ continue;
}
if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
locWorking.setAnfme(taskItem.getAnfme());
@@ -756,7 +756,7 @@
TaskItem taskItem = taskItems.stream().findFirst().get();
//淇濆瓨鍏ュ嚭搴撴祦姘�
- saveStockItems(taskItems, task, null, null, taskItem.getWkType(), taskItem.getOrderType(), loginUserId);
+ saveStockItems(taskItems, task, null, null, taskItem.getWkType(), OrderType.ORDER_IN.type, loginUserId);
locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()));
@@ -899,7 +899,7 @@
if (Objects.isNull(waveItem)) {
throw new CoolException("娉㈡鏄庣粏涓嶅瓨鍦紒锛�");
}
- Double workQty = Math.round((waveItem.getWorkQty() - item.getAnfme()) * 100) / 100.0;
+ Double workQty = Math.round((waveItem.getWorkQty() - item.getAnfme()) * 1000000) / 1000000.0;
waveItem.setWorkQty(workQty).setExceStatus(WaveItemExceStatus.WAVE_ITEM_EXCE_STATUS_UN.val);
if (!waveItemService.updateById(waveItem)) {
throw new CoolException("娉㈡鏄庣粏鏇存柊澶辫触锛侊紒");
@@ -923,7 +923,7 @@
if (Objects.isNull(wkOrder)) {
throw new CoolException("鏁版嵁閿欒锛氬崟鎹凡涓嶅瓨鍦紒锛�");
}
- Double workQty = Math.round((wkOrder.getWorkQty() - item.getAnfme()) * 100) / 100.0;
+ Double workQty = Math.round((wkOrder.getWorkQty() - item.getAnfme()) * 1000000) / 1000000.0;
wkOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)
.setWorkQty(workQty.compareTo(0.00) > 0 ? workQty : 0.00)
@@ -938,7 +938,7 @@
throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗗凡涓嶅瓨鍦紒锛�");
}
- Double workItmQty = Math.round((orderItem.getWorkQty() - item.getAnfme()) * 100) / 100.0;
+ Double workItmQty = Math.round((orderItem.getWorkQty() - item.getAnfme()) * 1000000) / 1000000.0;
orderItem.setWorkQty(workItmQty);
if (!outStockItemService.updateById(orderItem)) {
@@ -1048,12 +1048,12 @@
tempLocs.forEach(working -> {
taskItems.forEach(taskItem -> {
- if (taskItem.getId().equals(working.getMatnrId()) && taskItem.getFieldsIndex().equals(working.getFieldsIndex())) {
+ if (taskItem.getFieldsIndex().equals(working.getFieldsIndex())) {
Double minQty = taskItem.getAnfme();
if (!task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
- minQty = Math.round((working.getAnfme() - taskItem.getAnfme()) * 100) / 100.0;
+ minQty = Math.round((working.getAnfme() - taskItem.getQty()) * 1000000) / 1000000.0;
}
- if (minQty.compareTo(0.0) > 0) {
+ if (minQty.compareTo(0.0) >= 0) {
taskItem.setAnfme(minQty);
if (!taskItemService.updateById(taskItem)) {
throw new CoolException("浠诲姟鏄庣粏淇敼澶辫触锛侊紒");
@@ -1104,6 +1104,7 @@
LocItemWorking itemWorking = new LocItemWorking();
BeanUtils.copyProperties(taskItem, itemWorking);
itemWorking.setTaskId(task.getId())
+ .setQty(0.0)
.setLocId(loc1.getId())
.setLocCode(loc1.getCode());
workings.add(itemWorking);
@@ -1309,7 +1310,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) * 100) / 100.0;
+ Double qty = Math.round((wkOrder.getQty() + sum) * 1000000) / 1000000.0;
wkOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_WORKING.val)
.setQty(qty);
if (!asnOrderService.updateById(wkOrder)) {
@@ -1633,8 +1634,8 @@
if (Objects.isNull(itemServiceOne)) {
throw new CoolException("鏁版嵁閿欒锛氳鏌ョ湅璇疯揣鍖哄簱瀛樻槸鍚﹀瓨鍦紒锛�");
}
- Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 100) / 100.0;
- Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 100) / 100.0;
+ Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 1000000) / 1000000.0;
+ Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 1000000) / 1000000.0;
itemServiceOne.setWorkQty(workQty).setQty(qty);
if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>()
@@ -1665,7 +1666,7 @@
* @time 2025/4/15 15:28
*/
@Transactional(rollbackFor = Exception.class)
- public synchronized void saveLocItem(List<TaskItem> items, Long taskId, Long loginUserId) throws Exception {
+ public synchronized void saveLocItem(List<TaskItem> items, Long taskId, Long loginUserId) {
Task task = this.getById(taskId);
if (Objects.isNull(task)) {
throw new CoolException("浠诲姟涓嶅瓨鍦�!!");
@@ -1691,16 +1692,18 @@
.setUpdateBy(loginUserId)
.setWkType(taskItem.getWkType())
.setType(taskItem.getOrderType());
- locItems.add(item);
+ if (!locItemService.saveOrUpdate(item)) {
+ throw new CoolException("搴撲綅鏄庣粏鏇存柊澶辫触锛侊紒");
+ }
} else {
- locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 100) / 100.0)
+ locItem.setAnfme(Math.round((locItem.getAnfme() + taskItem.getAnfme()) * 1000000) / 1000000.0)
.setUpdateTime(new Date());
- locItems.add(locItem);
+ if (!locItemService.saveOrUpdate(locItem)) {
+ throw new CoolException("搴撲綅鏄庣粏鏇存柊澶辫触锛侊紒");
+ }
}
});
- if (!locItemService.saveBatch(locItems)) {
- throw new CoolException("搴撲綅鏄庣粏鏇存柊澶辫触锛侊紒");
- }
+
}
/**
--
Gitblit v1.9.1