From 32dfe79db773c8d2d3045364ac62423454fe9146 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期六, 29 十一月 2025 15:08:18 +0800
Subject: [PATCH] 库位更新不使用批量插入

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   16 +++++++++-------
 1 files changed, 9 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 e2e4833..8d152ad 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
@@ -1666,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("浠诲姟涓嶅瓨鍦�!!");
@@ -1692,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