From 1b60f1df51e1824154018a5b6a7159b09b44c8b1 Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期一, 12 六月 2023 14:23:26 +0800
Subject: [PATCH] 化验页面--数据提交更新

---
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java |  177 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 96 insertions(+), 81 deletions(-)

diff --git a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java
index 621ad16..dd68d6f 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java
@@ -283,84 +283,84 @@
         return inoutService.inoutProgressQuery(param);
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    public PageResponse<InoutData> updateCheck(InoutData data) throws Exception {
-
-        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼", data);
-        }
-
-        CheckUpdateResult checkResult = this.updateCheckItems(data);
-        String tag = checkResult.getMsg();
-
-        if (null != tag) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鍚庡彴鎵ц寮傚父锛�" + tag, data);
-        }
-
-        // 鑾峰彇涓氬姟鏁版嵁淇℃伅
-        InoutParam param = new InoutParam();
-        param.setCompanyId(data.getCompanyId());
-        param.setId(data.getId());
-        InoutData progressData = inoutService.inoutProgressQuery(param);
-        if (null == progressData) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "娌℃湁鑾峰彇鍒板嚭鍏ュ簱涓氬姟鏁版嵁淇℃伅锛屾洿鏂板け璐�", data);
-        }
-        if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
-        }
-        progressData.setCheckStatus(data.getCheckStatus());
-
-        // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
-        if (InoutConstant.PROGRESS_CHECK.equals(progressData.getProgress())) {
-            progressData = updateBasicInfo(progressData, null);
-            // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
-            if (InoutConstant.STATUS_UNPASS.equals(progressData
-                    .getCheckStatus())) {
-                progressData = checkNoPass(progressData);
-            }
-        }
-        progressData.setCheckUser(ContextUtil.getLoginUserCName());
-        
-        if (StringUtils.isNotEmpty(data.getDepotId())) {
-            progressData.setDepotId(data.getDepotId());
-        }
-        if (StringUtils.isNotEmpty(data.getFoodVariety())) {
-            progressData.setFoodVariety(data.getFoodVariety());
-        }
-        if (StringUtils.isNotEmpty(data.getFoodLevel())) {
-            progressData.setFoodLevel(data.getFoodLevel());
-        }
-        if (StringUtils.isNotEmpty(data.getFoodLocation())) {
-            progressData.setFoodLocation(data.getFoodLocation());
-        }
-        if (StringUtils.isNotEmpty(data.getFoodYear())) {
-            progressData.setFoodYear(data.getFoodYear());
-        }
-        if (null != data.getPrice()) {
-            progressData.setPrice(data.getPrice());
-        }
-        if (StringUtils.isNotEmpty(data.getRemarks())) {
-            progressData.setRemarks(data.getRemarks());
-        }
-        if (StringUtils.isNotEmpty(data.getNoticeId())) {
-            progressData.setNoticeId(data.getNoticeId());
-        }
-
-        String msg = inoutService.updateData(progressData);
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
-        }
-        if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
-
-            inoutComplete(progressData);
-        }
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
-    }
+//    @Transactional(rollbackFor = Exception.class)
+//    public PageResponse<InoutData> updateCheck(InoutData data) throws Exception {
+//
+//        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+//            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+//                    "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼", data);
+//        }
+//
+//        CheckUpdateResult checkResult = this.updateCheckItems(data);
+//        String tag = checkResult.getMsg();
+//
+//        if (null != tag) {
+//            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+//                    "鍚庡彴鎵ц寮傚父锛�" + tag, data);
+//        }
+//
+//        // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+//        InoutParam param = new InoutParam();
+//        param.setCompanyId(data.getCompanyId());
+//        param.setId(data.getId());
+//        InoutData progressData = inoutService.inoutProgressQuery(param);
+//        if (null == progressData) {
+//            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+//                    "娌℃湁鑾峰彇鍒板嚭鍏ュ簱涓氬姟鏁版嵁淇℃伅锛屾洿鏂板け璐�", data);
+//        }
+//        if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
+//            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+//                    "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+//        }
+//        progressData.setCheckStatus(data.getCheckStatus());
+//
+//        // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
+//        if (InoutConstant.PROGRESS_CHECK.equals(progressData.getProgress())) {
+//            progressData = updateBasicInfo(progressData, null);
+//            // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
+//            if (InoutConstant.STATUS_UNPASS.equals(progressData
+//                    .getCheckStatus())) {
+//                progressData = checkNoPass(progressData);
+//            }
+//        }
+//        progressData.setCheckUser(ContextUtil.getLoginUserCName());
+//
+//        if (StringUtils.isNotEmpty(data.getDepotId())) {
+//            progressData.setDepotId(data.getDepotId());
+//        }
+//        if (StringUtils.isNotEmpty(data.getFoodVariety())) {
+//            progressData.setFoodVariety(data.getFoodVariety());
+//        }
+//        if (StringUtils.isNotEmpty(data.getFoodLevel())) {
+//            progressData.setFoodLevel(data.getFoodLevel());
+//        }
+//        if (StringUtils.isNotEmpty(data.getFoodLocation())) {
+//            progressData.setFoodLocation(data.getFoodLocation());
+//        }
+//        if (StringUtils.isNotEmpty(data.getFoodYear())) {
+//            progressData.setFoodYear(data.getFoodYear());
+//        }
+//        if (null != data.getPrice()) {
+//            progressData.setPrice(data.getPrice());
+//        }
+//        if (StringUtils.isNotEmpty(data.getRemarks())) {
+//            progressData.setRemarks(data.getRemarks());
+//        }
+//        if (StringUtils.isNotEmpty(data.getNoticeId())) {
+//            progressData.setNoticeId(data.getNoticeId());
+//        }
+//
+//        String msg = inoutService.updateData(progressData);
+//
+//        if (null != msg) {
+//            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+//        }
+//        if (InoutConstant.PROGRESS_RECORD.equals(progressData.getProgress())) {
+//
+//            inoutComplete(progressData);
+//        }
+//        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+//    }
 
     /**
      * 鍖栭獙缁撴灉涓嶉�氳繃鏃舵牎楠岄厤缃俊鎭�
@@ -1214,8 +1214,25 @@
                 return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                         "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
             }
-            curData.setCheckStatus(data.getCheckStatus());
 
+            //鏇存柊鍖栭獙椤逛俊鎭�
+            CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
+            if (null == checkResult || null != checkResult.getMsg()) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "鍚庡彴鎵ц寮傚父锛�" + checkResult.getMsg(), data);
+            }
+
+            //璁剧疆鍖栭獙淇℃伅
+            if (checkResult.getDeSum() > 0) {
+                data.setDeCheck(checkResult.getDeSum());
+            }
+            if (checkResult.getAddSum() > 0) {
+                data.setAddCheck(checkResult.getAddSum());
+            }
+            if (null == data.getCheckTime()) {
+                data.setCheckTime(new Date());
+            }
+            curData.setCheckStatus(data.getCheckStatus());
             //鏇存柊涓嬩竴娴佺▼鐘舵��
             if (InoutConstant.PROGRESS_CHECK.equals(curData.getProgress())) {
                 curData = updateBasicInfo(curData, null);
@@ -1235,11 +1252,9 @@
             }
 
             String msg = inoutService.updateCheckData(data);
-
             if (null != msg) {
                 return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
             }
-            //TODO 鏇存柊鍖栭獙椤逛俊鎭�
 
             return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
         } catch (Exception e) {

--
Gitblit v1.9.3