From 87f07e589fb1c8103513a5fcc8febe3b14f5535f Mon Sep 17 00:00:00 2001
From: 石广澎 <shiguangpeng@163.com>
Date: 星期五, 01 十二月 2023 17:30:46 +0800
Subject: [PATCH] feat: 1、图片预览使用半路径 2、部门物品退回详情

---
 consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java
index ff3142a..4bfe3ca 100644
--- a/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java
+++ b/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java
@@ -8,6 +8,8 @@
 import java.util.List;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * @Description 鐩樼偣鍗曠墿鍝�
@@ -16,6 +18,7 @@
  */
 @Slf4j
 @Service
+@Transactional(propagation = Propagation.REQUIRED)
 public class LWhFormInventoryGoodsServiceImpl extends BaseServiceImpl {
 
     /**
@@ -31,7 +34,7 @@
     }
 
 
-    public int add(List<FormInventoryGoodsVO> inventoryGoodsList, Long inventoryId) {
+    public List<FormInventoryGoodsVO> add(List<FormInventoryGoodsVO> inventoryGoodsList, Long inventoryId) {
         List<LWhFormInventoryGoods> goodsList = new ArrayList<>();
         for (FormInventoryGoodsVO inventoryGoods : inventoryGoodsList) {
             LWhFormInventoryGoods lWhFormInventoryGoods = new LWhFormInventoryGoods();
@@ -43,9 +46,12 @@
             lWhFormInventoryGoods.setBaseGoodsModelsId(inventoryGoods.getId());
             lWhFormInventoryGoods.setBaseGoodsModelsName(inventoryGoods.getBaseGoodsModelsName());
             lWhFormInventoryGoods.setInitCounts(inventoryGoods.getInventoryCount());
+            //淇濆瓨鎴愬姛鍚庤繑鍥瀒d,鐢ㄦ潵杩涜璁板綍鐨勬洿鏂�
+            inventoryGoods.setId(lWhFormInventoryGoods.getId());
             goodsList.add(lWhFormInventoryGoods);
         }
-        return this.insert(goodsList);
+        this.insert(goodsList);
+        return inventoryGoodsList;
     }
 
     public int updateInventoryGoods(List<FormInventoryGoodsVO> inventoryGoodsList) {
@@ -56,16 +62,18 @@
             Integer inventoryCount = inventoryGoods.getInventoryCount();
             Integer realNum = inventoryGoods.getRealNum();
             if (realNum != null) {
-                int errorCount = inventoryCount - realNum;
+                int errorCount = realNum - inventoryCount;
                 lWhFormInventoryGoods.setInventoryCounts(realNum);
-                lWhFormInventoryGoods.setErrorCounts(errorCount);
+                lWhFormInventoryGoods.setErrorCounts(Math.abs(errorCount));
                 //鐩樼偣缁撴灉锛�1=姝e父锛�2=鐩樼泩锛�3=鐩樹簭锛�
                 lWhFormInventoryGoods.setInventoryResult((errorCount > 0) ? 2 : (errorCount < 0) ? 3 : 1);
-                goodsList.add(lWhFormInventoryGoods);
+                // TODO 鎵归噺鏇存柊
+                this.update(lWhFormInventoryGoods);
+//                goodsList.add(lWhFormInventoryGoods);
             }
 
         }
-        return this.updateBatch(goodsList);
+        return 1;
     }
 
     /**

--
Gitblit v1.9.1