From 7a7ccfd74dbdff086d2aabe5117ec1dc6f804d91 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期三, 31 五月 2023 18:48:41 +0800
Subject: [PATCH] 出入库优化-称重

---
 igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java |   82 ++++++++++++++++------------------------
 1 files changed, 33 insertions(+), 49 deletions(-)

diff --git a/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java b/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java
index e82212f..0eda84d 100644
--- a/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java
+++ b/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java
@@ -11,6 +11,7 @@
 import com.ld.igds.data.BaseParam;
 import com.ld.igds.data.Page;
 import com.ld.igds.data.PageResponse;
+import com.ld.igds.data.SimpleDepot;
 import com.ld.igds.grain.dto.GrainData;
 import com.ld.igds.grain.service.CoreGrainService;
 import com.ld.igds.inout.dto.InoutParam;
@@ -64,24 +65,45 @@
     private RedisUtil redisUtil;
 
     /**
-     * 鑾峰彇鍏ュ簱鐨勪笅鎷夋
+     * 鑾峰彇鍏ュ簱浣滀笟涓紝浠撳簱涓嬫媺妗嗭紝鍊艰幏鍙栫姸鎬�=闈炴弧浠撶殑绮簱
      *
      * @return
      */
-    public List<Depot> listInDepot() {
-        List<Depot> list = listDepot(true);
-        return list;
+    public List<SimpleDepot> getCacheDeptIn(String companyId, String deptId) {
+
+        List<SimpleDepot> result = new ArrayList<>();
+        List<Depot> list = coreCommonService.getCacheDepotList(companyId, deptId);
+
+        for (Depot depot : list) {
+            if (DepotStatus.STATUS_3.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_31.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_32.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_33.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_34.getCode().equals(depot.getDepotStatus())) continue;
+
+            result.add(new SimpleDepot(depot));
+        }
+
+        return result;
     }
 
     /**
-     * 鑾峰彇鍑哄簱鐨勪笅鎷夋
+     * 鑾峰彇鍑哄簱涓嬫媺妗嗗垪琛紝鑷姩灞忚斀绌轰粨
      *
      * @return
      */
-    public List<Depot> listOutDepot() {
-        List<Depot> list = listDepot(true);
+    public List<SimpleDepot> getCacheDeptOut(String companyId, String deptId) {
+        List<SimpleDepot> result = new ArrayList<>();
+        List<Depot> list = coreCommonService.getCacheDepotList(companyId, deptId);
 
-        return list;
+        for (Depot depot : list) {
+            if (DepotStatus.STATUS_1.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_2.getCode().equals(depot.getDepotStatus())) continue;
+
+            result.add(new SimpleDepot(depot));
+        }
+
+        return result;
     }
 
     /**
@@ -117,38 +139,12 @@
     /**
      * 鏌ヨ閮ㄩ棬涓嬪睘鎵�鏈変粨搴撳垪琛�
      *
-     * @param isDelOther
+     * @param companyId
      * @param deptId
      * @return
      */
-    public List<Depot> listDepotByDeptId(boolean isDelOther, String deptId) {
-        String companyId = ContextUtil.getCompanyId();
-
-        if (StringUtils.isEmpty(deptId)) {
-            return null;
-        }
-
-        List<Depot> list = coreCommonService.getCacheDepotList(companyId);
-        if (null == list || list.isEmpty()) {
-            return list;
-        }
-
-        List<Depot> listDepot = new ArrayList<>();
-        for (Depot depot : list) {
-            if (depot.getDeptId().contains(deptId)) {
-                listDepot.add(depot);
-            }
-        }
-
-        // 鍒犻櫎闈炰粨搴撳垪琛�
-        if (isDelOther) {
-            return listDepot
-                    .stream()
-                    .filter(item -> !item.getDepotType().equals(
-                            DepotType.TYPE_99.getCode())).collect(Collectors.toList());
-        }
-
-        return listDepot;
+    public List<Depot> listDepotByDeptId(String companyId, String deptId) {
+        return coreCommonService.getCacheDepotList(companyId, deptId);
     }
 
     /**
@@ -483,18 +479,6 @@
                     "缂撳瓨涓病鏈夎幏鍙栧埌褰撳墠浠撳簱鐨勭伯鎯呬俊鎭紒");
         }
         return new PageResponse<>(RespCodeEnum.CODE_0000, data);
-    }
-
-    public PageResponse<Page<DicFoodOrigin>> pageFoodLocation(InoutParam param) {
-
-        Page<DicFoodOrigin> result = coreDicService.pageFoodLocation(param);
-
-        if (null == result.getRecords() || result.getRecords().isEmpty()) {
-            return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
-                    "鑾峰彇鍒版暟鎹俊鎭负绌�");
-        }
-        return new PageResponse<Page<DicFoodOrigin>>(RespCodeEnum.CODE_0000,
-                result);
     }
 
 

--
Gitblit v1.9.3