From da9beff5142f6654d5008080aca0caaad7e161de Mon Sep 17 00:00:00 2001
From: futian.liu <liufutianyoo@163.com>
Date: 星期一, 27 十一月 2023 14:45:44 +0800
Subject: [PATCH] update

---
 consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java |   12 +++---------
 consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java   |   17 +++++++++++++++--
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java
index d7eeeb0..45a18cd 100644
--- a/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java
+++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java
@@ -9,7 +9,6 @@
 import com.consum.base.pojo.response.FormInventoryGoodsVO;
 import com.consum.base.pojo.response.FormInventoryVO;
 import com.consum.base.service.FinSysTenantUserServiceImpl;
-import com.consum.base.service.LWhFormInventoryCoreService;
 import com.consum.base.service.LWhFormInventoryServiceImpl;
 import com.consum.model.po.FinSysTenantUser;
 import com.consum.model.po.LWhFormInventory;
@@ -46,8 +45,6 @@
     private LWhFormInventoryServiceImpl lWhFormInventoryService;
     @Autowired
     private FinSysTenantUserServiceImpl finSysTenantUserService;
-    @Autowired
-    private LWhFormInventoryCoreService lWhFormInventoryCoreService;
 
 
     /**
@@ -193,7 +190,7 @@
             return ResponseValue.error("鍙傛暟閿欒");
         }
 
-        int num = this.lWhFormInventoryService.updateInventoryInfo(dto, 1);
+        int num = this.lWhFormInventoryService.updateInventoryInfo(dto, 1, null, null);
         return num > 0 ? ResponseValue.success(1) : ResponseValue.error("鏆傚瓨澶辫触锛�");
     }
 
@@ -212,14 +209,11 @@
         if (dto == null) {
             return ResponseValue.error("鍙傛暟閿欒");
         }
-
-        int num = this.lWhFormInventoryService.updateInventoryInfo(dto, 2);
-
         S_user_core currentUser = this.getCurrentUser();
         FinSysTenantUser sysInfo = this.getSysInfo();
+        int num = this.lWhFormInventoryService.updateInventoryInfo(dto, 2, currentUser, sysInfo);
 
-        String inOutFormByInventoryId = lWhFormInventoryCoreService.createInOutFormByInventoryId(dto.getId(), currentUser, sysInfo);
-        return num > 0 ? ResponseValue.success(1) : ResponseValue.error(inOutFormByInventoryId);
+        return num > 0 ? ResponseValue.success(1) : ResponseValue.error("鐩樼偣澶辫触锛�");
     }
 
     /**
diff --git a/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java
index fd99dd7..0535c92 100644
--- a/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java
+++ b/consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java
@@ -16,6 +16,7 @@
 import com.consum.model.po.FinSysTenant;
 import com.consum.model.po.FinSysTenantUser;
 import com.consum.model.po.LWhFormInventory;
+import com.iplatform.model.po.S_user_core;
 import com.walker.db.page.GenericPager;
 import com.walker.infrastructure.utils.DateUtils;
 import com.walker.infrastructure.utils.StringUtils;
@@ -27,6 +28,7 @@
 import org.apache.commons.compress.utils.Lists;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -53,6 +55,9 @@
     private LWhGoodsService lWhGoodsService;
     @Autowired
     private FinSysTenantServiceImpl finSysTenantService;
+    @Autowired
+    @Lazy
+    private LWhFormInventoryCoreService lWhFormInventoryCoreService;
 
 
     private static final String QUERY_LIST = "select * from l_wh_form_inventory where 1=1 ";
@@ -180,13 +185,14 @@
 
     }
 
+
     /**
      * 淇濆瓨鐩樼偣淇℃伅
      *
      * @author 鍗㈠簡闃�
      * @date 2023/10/31
      */
-    public int updateInventoryInfo(LWhFormInventoryParam dto, Integer state) {
+    public int updateInventoryInfo(LWhFormInventoryParam dto, Integer state, S_user_core currentUser, FinSysTenantUser sysInfo) {
         //1.鏍规嵁鐩樼偣鍗昳d鏌ヨ鐩樼偣鍗�
         LWhFormInventory lWhFormInventory = this.get(new LWhFormInventory(dto.getId()));
         if (lWhFormInventory == null) {
@@ -194,11 +200,18 @@
             return 0;
         }
         //2.淇敼鐩樼偣鍗�
-        lWhFormInventory.setStates(state);
         if (state == 2) {
             //瀹屾垚鐩樼偣鏃惰缃畬鎴愮洏鐐规椂闂�
             lWhFormInventory.setStopTime(DateUtils.getDateTimeNumber(System.currentTimeMillis()));
+
+            //瀹屾垚鐩樼偣鏃惰缃畬鎴愮洏鐐规椂闂�
+            String inOutFormByInventoryId = lWhFormInventoryCoreService.createInOutFormByInventoryId(dto.getId(), currentUser, sysInfo);
+            if (!StringUtils.isEmpty(inOutFormByInventoryId)) {
+                log.error(inOutFormByInventoryId);
+                return 0;
+            }
         }
+        lWhFormInventory.setStates(state);
         lWhFormInventory.setInventoryDate(DateUtils.getDateTimeNumber(System.currentTimeMillis()));
         int flag1 = this.update(lWhFormInventory);
         if (flag1 == 0) {

--
Gitblit v1.9.1