From 1a47d9eef4cfe9385ce66b791de84db54a5ba87c Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期日, 25 六月 2023 20:30:36 +0800
Subject: [PATCH] 出入库流程优化-入库详单优化

---
 igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java b/igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java
index f5611ec..c8d3262 100644
--- a/igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java
+++ b/igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java
@@ -3,7 +3,6 @@
 import com.ld.igds.check.dto.CheckItemData;
 import com.ld.igds.check.dto.CheckUpdateResult;
 import com.ld.igds.check.service.CoreCheckStandardService;
-import com.ld.igds.inout.InoutConstant;
 import com.ld.igds.util.ContextUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,34 +23,33 @@
     @Autowired
     private CoreCheckStandardService checkStandardService;
 
-
     /**
      * 鏍规嵁鍙傛暟鑾峰彇鍖栭獙椤瑰垪琛�
      *
      * @param checkId
      * @param companyId
-     * @param deptId
      * @param foodVariety
      * @return
      */
-    public List<CheckItemData> listCheckItem(String checkId, String companyId,
-                                             String deptId, String foodVariety) {
+    public List<CheckItemData> listCheckItem(String companyId, String checkId,
+                                             String foodVariety) {
         if (StringUtils.isEmpty(companyId)) {
             companyId = ContextUtil.getCompanyId();
         }
-        if (StringUtils.isEmpty(deptId)) {
-            deptId = ContextUtil.subDeptId(ContextUtil.getLoginUser());
-        }
 
-        List<CheckItemData> list = checkStandardService.getCheckItemById(checkId, companyId);
+        List<CheckItemData> list = null;
+        if (null != checkId)
+            list = checkStandardService.getCheckItemById(checkId, companyId);
 
         if (list == null || list.isEmpty()) {
-            list = checkStandardService.getCheckItemByStandard(checkId, companyId, deptId, foodVariety);
+            list = checkStandardService.getCheckItemByStandard(companyId, checkId, foodVariety);
         }
+
         return list;
     }
 
-    public CheckUpdateResult updateCheckItems(String checkId, String companyId, List<CheckItemData> checkItems) {
+    public CheckUpdateResult updateCheckItems(String checkId, String companyId,
+                                              List<CheckItemData> checkItems) {
 
         CheckUpdateResult result = new CheckUpdateResult();
         if (null == checkItems || checkItems.isEmpty()) {
@@ -70,21 +68,26 @@
                 item.setUpperLimit(0.0);
             }
 
-            //姘村垎淇℃伅鍥炲~
-            if (InoutConstant.CHECK_ITEM_C01.equals(item.getStandardId()) || InoutConstant.CHECK_ITEM_C020101.equals(item.getStandardId())) {
-            	if(null != item.getValue()) result.setWet(Double.valueOf(item.getValue()));
+            if (null != item.getDeNum() && item.getDeNum() > 0) {
+                result.setDeSum(result.getDeSum() + item.getDeNum());
             }
-            //鏉傝川淇℃伅鍥炲~
-            if (InoutConstant.CHECK_ITEM_C02.equals(item.getStandardId()) || InoutConstant.CHECK_ITEM_C01010301.equals(item.getStandardId())) {
-            	if(null != item.getValue())  result.setImpurity(Double.valueOf(item.getValue()));
+            if (null != item.getAddNum() && item.getAddNum() > 0) {
+                result.setAddSum(result.getAddSum() + item.getAddNum());
             }
-            //鍏堟洿鏂帮紝鏇存柊澶辫触鍒欐柊澧�
+            if (null != item.getAddPrice() && item.getAddPrice() > 0) {
+                result.setAddPriceSum(result.getAddPriceSum()
+                        + item.getAddPrice());
+            }
+            if (null != item.getDePrice() && item.getDePrice() > 0) {
+                result.setDePriceSum(result.getDePriceSum() + item.getDePrice());
+            }
+
+            // 鍏堟洿鏂帮紝鏇存柊澶辫触鍒欐柊澧�
             int i = checkStandardService.updateCheckItem(item);
             if (i < 1) {
                 checkStandardService.insertCheckItem(item);
             }
         }
-
         return result;
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3