From d320b9ae40b3dfc1942ea484c8893ba1404c73ec Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期三, 21 六月 2023 23:36:19 +0800
Subject: [PATCH] 调整卡回收页面操作逻辑

---
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java | 1548 +++++++++++++++++++++++++---------------------------------
 1 files changed, 665 insertions(+), 883 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 417080f..74162dc 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
@@ -1,6 +1,5 @@
 package com.ld.igds.inout.manager;
 
-import com.bstek.bdf2.core.business.IUser;
 import com.ld.igds.check.CheckStandardManager;
 import com.ld.igds.check.dto.CheckItemData;
 import com.ld.igds.check.dto.CheckUpdateResult;
@@ -9,9 +8,11 @@
 import com.ld.igds.data.Page;
 import com.ld.igds.data.PageResponse;
 import com.ld.igds.file.CoreFileService;
-import com.ld.igds.file.dto.FileData;
 import com.ld.igds.inout.InoutConstant;
-import com.ld.igds.inout.dto.*;
+import com.ld.igds.inout.dto.InoutCheckData;
+import com.ld.igds.inout.dto.InoutCheckParam;
+import com.ld.igds.inout.dto.InoutData;
+import com.ld.igds.inout.dto.InoutParam;
 import com.ld.igds.inout.service.InoutService;
 import com.ld.igds.m.service.InoutCommonService;
 import com.ld.igds.models.Depot;
@@ -20,15 +21,16 @@
 import com.ld.igds.models.InoutSysConf;
 import com.ld.igds.util.ContextUtil;
 import com.ld.igds.util.DateUtil;
-import com.ld.igds.util.NumberUtil;
+
 import lombok.extern.slf4j.Slf4j;
+
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -42,18 +44,57 @@
 @Component
 public class InoutManager {
 
-    @Autowired
+    @Resource
     private InoutService inoutService;
-    @Autowired
+    @Resource
     private CoreFileService fileService;
-    @Autowired
+    @Resource
     private CoreCommonService commonService;
     @Resource
     private InoutCommonService inoutCommonService;
-    @Autowired
+    @Resource
     private CheckStandardManager checkStandardManager;
     @Resource
     private InoutDeviceManager inoutDeviceManager;
+
+
+    /**
+     * 鐩存帴浠庢暟鎹簱鏌ヨ锛屼笉鑰冭檻淇℃伅鐘舵��
+     *
+     * @param param
+     * @return
+     */
+    public PageResponse<InoutData> inoutQueryBack(InoutParam param) {
+        if (StringUtils.isEmpty(param.getPlateNum())
+                && StringUtils.isEmpty(param.getIntelCard())
+                && StringUtils.isEmpty(param.getUserId())) {
+
+            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
+                    "鏌ヨ鍙傛暟涓嶅畬鏁达紝鏌ヨ澶辫触锛�");
+        }
+
+        //鑾峰彇涓夊ぉ浠ュ唴鏈�鍚庝竴澶╄褰�
+        param.setStart(DateUtil.getNewByDay(new Date(), -3));
+        param.setType(null);
+        param.setProgress(null);
+
+        InoutData result = inoutService.getLastRecord(param);
+
+        if (null == result) {
+            return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
+                    "鏍规嵁褰撳墠鏉′欢鏈煡璇㈠埌杞﹁締淇℃伅锛�");
+        }
+
+        if (InoutConstant.PROGRESS_RECORD.equals(result.getProgress())) {
+            return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "褰撳墠杞﹁締娴佺▼宸茬粡缁撴潫", result);
+        }
+
+        if (!InoutConstant.PROGRESS_CARD_BACK.equals(result.getProgress())) {
+            return new PageResponse<>(RespCodeEnum.CODE_1008.getCode(), "褰撳墠杞﹁締娴佺▼涓嶅湪褰撳墠鐜妭锛屾棤娉曟墽琛屽嚭搴�", result);
+        }
+
+        return new PageResponse<>(RespCodeEnum.CODE_0000, result);
+    }
 
     /**
      * 棣栧厛浠庣紦瀛樹腑鑾峰彇锛岀紦瀛樹腑锛屼粠鏁版嵁搴撲腑鑾峰彇
@@ -126,153 +167,6 @@
         }
     }
 
-    public PageResponse<InoutData> outNextStep(InoutData data) throws Exception {
-        String msg;
-        IUser user = ContextUtil.getLoginUser();
-        if (StringUtils.isEmpty(data.getCompanyId())) {
-            data.setCompanyId(user.getCompanyId());
-        }
-        if (StringUtils.isEmpty(data.getDeptId())) {
-            data.setDeptId(ContextUtil.subDeptId(user));
-        }
-        if (StringUtils.isEmpty(data.getIntelCard())) {
-            data.setIntelCard(data.getUserId());
-        }
-
-        String curProgress = data.getProgress();
-        List<FileData> files = data.getFiles();
-
-        // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
-        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(
-                data.getCompanyId(), data.getDeptId());
-        if (null == inoutSysConf
-                || StringUtils.isEmpty(inoutSysConf.getProgressIn())) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "褰撳墠搴撳尯鏈厤缃嚭搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data);
-        }
-        data = updateBasicInfo(data, inoutSysConf);
-
-        // 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑
-        if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
-            InoutData progressData = this.inoutProgressQuery(data);
-            if (null != progressData) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        "褰撳墠鍗$墖/杞︾墝鍙锋湁娴佺▼鏈粨鏉熴��", progressData);
-            }
-        }
-
-        if (null != data.getPrice() && null != data.getRecordWeight()) {
-            data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2));
-        }
-
-        // 娴佺▼瀹屾垚锛岀洿鎺ヨ皟鐢ㄦ祦绋嬪畬鎴愭帴鍙�
-        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            inoutService.updateData(data);
-            // 鎵ц闄勪欢淇℃伅
-            if (null != files) {
-                fileService.saveInoutFiles(files, data.getCompanyId(),
-                        data.getId(), curProgress);
-            }
-
-            // 閫氱煡绉伴噸涓绘帶娴佺▼缁撴潫
-            inoutDeviceManager.noticeProgressComplete(data);
-
-            return inoutComplete(data);
-        }
-
-        // 璋冪敤淇濆瓨鏂规硶鎵ц
-        if (StringUtils.isEmpty(data.getId())) {
-            msg = inoutService.insertData(data);
-        } else {
-            msg = inoutService.updateData(data);
-        }
-
-        // 鎵ц闄勪欢淇℃伅
-        if (null != files) {
-            fileService.saveInoutFiles(files, data.getCompanyId(),
-                    data.getId(), curProgress);
-        }
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg,
-                    data);
-        }
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
-                data);
-    }
-
-    public PageResponse<InoutData> inNextStep(InoutData data) throws Exception {
-        String msg;
-
-        String curProgress = data.getProgress();
-        List<FileData> files = data.getFiles();
-        if (StringUtils.isEmpty(data.getIntelCard())) {
-            data.setIntelCard(data.getUserId());
-        }
-
-        // 鏇存柊涓嬩竴涓姸鎬佸拰鍩烘湰淇℃伅
-        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
-
-        if (null == inoutSysConf
-                || StringUtils.isEmpty(inoutSysConf.getProgressIn())) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "褰撳墠搴撳尯鏈厤缃叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳閰嶇疆銆�", data);
-        }
-
-        data = updateBasicInfo(data, inoutSysConf);
-
-        // 濡傛灉褰撳墠鑺傜偣鏄敞鍐岋紝鍒欓渶瑕侀獙璇佷笅锛屾槸鍚︽湁涓哄畬鎴愮殑娴佺▼鍦ㄦ墽琛屼腑
-        if (InoutConstant.PROGRESS_REGISTER.equals(curProgress)) {
-            InoutData progressData = this.inoutProgressQuery(data);
-            if (null != progressData) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        "褰撳墠鍗$墖/杞︾墝鍙锋湁娴佺▼鏈粨鏉熴��", progressData);
-            }
-        }
-
-        if (null != data.getPrice() && null != data.getRecordWeight()) {
-            data.setSettleMoney(NumberUtil.keepPrecision(data.getPrice() * data.getRecordWeight(), 2));
-        }
-
-        // 娴佺▼瀹屾垚锛岀洿鎺ヨ皟鐢ㄦ祦绋嬪畬鎴愭帴鍙�
-        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            if (StringUtils.isEmpty(data.getCompanyId())) {
-                data.setCompanyId(ContextUtil.getCompanyId());
-            }
-
-            inoutService.updateData(data);
-            // 鎵ц闄勪欢淇℃伅
-            if (null != files) {
-                fileService.saveInoutFiles(files, data.getCompanyId(),
-                        data.getId(), curProgress);
-            }
-
-            // 閫氱煡绉伴噸涓绘帶娴佺▼缁撴潫
-            inoutDeviceManager.noticeProgressComplete(data);
-
-            return inoutComplete(data);
-        }
-
-        // 璋冪敤淇濆瓨鏂规硶鎵ц
-        if (StringUtils.isEmpty(data.getId())) {
-            msg = inoutService.insertData(data);
-        } else {
-            msg = inoutService.updateData(data);
-        }
-
-        // 鎵ц闄勪欢淇℃伅
-        if (null != files) {
-            fileService.saveInoutFiles(files, data.getCompanyId(),
-                    data.getId(), curProgress);
-        }
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
-        }
-
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛",
-                data);
-    }
 
     public InoutData inoutProgressQuery(InoutData data) throws Exception {
         InoutParam param = new InoutParam();
@@ -283,85 +177,6 @@
 
         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(), "鎵ц鎴愬姛");
-//    }
 
     /**
      * 鍖栭獙缁撴灉涓嶉�氳繃鏃舵牎楠岄厤缃俊鎭�
@@ -556,81 +371,45 @@
     }
 
 
-    public PageResponse<InoutData> inoutComplete(InoutData data) throws Exception {
+    public PageResponse<InoutData> submitComplete(InoutData data) throws Exception {
 
         if (StringUtils.isEmpty(data.getId())
-                || StringUtils.isEmpty(data.getType())) {
+                || StringUtils.isEmpty(data.getType())
+                || StringUtils.isEmpty(data.getProgress())) {
 
             return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
                     "娌℃湁鑾峰彇鍒拌溅杈嗕俊鎭��", data);
         }
 
+
+        data.setUpdateTime(new Date());
+        if (null == data.getCompleteTime()) {
+            data.setCompleteTime(DateUtil.getNewByMinute(new Date(), 2));
+        }
+        if (null == data.getCompleteUser()) {
+            data.setCompleteUser(ContextUtil.getLoginUserCName());
+        }
+
+        // 璁剧疆娴佺▼鑺傜偣鐩存帴瀹屾垚
         InoutParam param = new InoutParam();
         param.setCompanyId(data.getCompanyId());
         param.setId(data.getId());
         param.setType(data.getType());
         param.setDeptId(data.getDeptId());
         param.setIntelCard(data.getIntelCard());
-        param.setUserId(ContextUtil.getLoginUserCName());
+        param.setUserId(data.getCompleteUser());
         param.setDepotId(data.getDepotId());
         param.setCompleteTime(data.getCompleteTime());
-        if (null == param.getCompleteTime()) {
-            param.setCompleteTime(new Date());
-        }
-        // 璁剧疆娴佺▼鑺傜偣鐩存帴瀹屾垚
         param.setProgress(InoutConstant.PROGRESS_RECORD);
 
-        if (null == data.getCompleteTime()) {
-            data.setCompleteTime(DateUtil.getNewByMinute(new Date(), 2));
-        }
+
         String msg = inoutService.toComplete(param);
 
         if (null != msg) {
             return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
         }
 
-        // 搴撳瓨璋冩暣
-        commonService.initInoutDepotStore(data);
-
         return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data);
-    }
-
-//    /**
-//     * 鎵︽牱鍖栭獙椤甸潰鑾峰彇妫�楠岄」鏉$洰淇℃伅
-//     *
-//     * @param data
-//     * @return
-//     */
-//    public PageResponse<List<CheckItemData>> getCheckItem(InoutData data) {
-//
-//        List<CheckItemData> result = checkStandardManager.listCheckItem(
-//                data.getCheckId(), data.getCompanyId(), data.getDeptId(),
-//                data.getFoodVariety());
-//
-//        return new PageResponse<>(RespCodeEnum.CODE_0000, result);
-//    }
-
-    /**
-     * 鍒犻櫎骞跺畬鎴�
-     *
-     * @param data
-     * @return
-     */
-    public PageResponse<InoutData> deleteInoutData(InoutData data, String msg) {
-        try {
-            data.setRemarks(msg);
-            String result = this.delInoutData(data, false);
-            if (null != result) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        result, data);
-            }
-        } catch (Exception e) {
-            log.error("鍚庡彴寮傚父:{}", e);
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�"
-                    + e.getMessage(), data);
-        }
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц瀹屾垚",
-                data);
     }
 
     /**
@@ -639,619 +418,333 @@
      * @param data
      * @return
      */
-    public PageResponse<InoutData> inoutBack(InoutData data) {
+    public PageResponse<InoutData> submitCardBack(InoutData data) {
         try {
-            // 浠庣紦瀛樹腑鑾峰彇鏈�鏂扮殑鏁版嵁锛屽鏋滄病鏈夊垯琛ㄧず娴佺▼宸茬粡缁撴潫銆�
-            InoutParam param = new InoutParam();
-            param.setCompanyId(data.getCompanyId());
-            param.setId(data.getId());
-            InoutData curData = inoutService.inoutProgressQuery(param);
-            if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) {
-                return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
-                        "褰撳墠鍗℃祦绋嬪凡缁忓畬鎴愶紝鏃犻渶鎵ц鍗″洖鏀�", data);
+            //濡傛灉褰撳墠鏁版嵁宸茬粡缁撴潫
+            if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+
+                //鍒犻櫎缂撳瓨
+                inoutService.delFromCache(data.getDeptId(), data.getType(), data.getId());
+
+                return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(),
+                        "褰撹溅杈嗘祦绋嬪凡缁忓畬鎴愶紝鍗$墖宸插洖鏀�", data);
             }
-            if (InoutConstant.RECORD_STATUS_DEL.equals(curData
-                    .getRecordStatus())) {
-                return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
-                        "褰撳墠鍗′俊鎭凡琚垹闄わ紝涓嶈兘鎵ц鍗″洖鏀�", data);
+
+
+            //濡傛灉褰撳墠娴佺▼涓嶆槸鍗″洖鏀�
+            if (!InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) {
+
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "褰撳墠娴佺▼鐜妭涓嶆纭紝涓嶈兘鎵ц鍗″洖鏀�", data);
             }
 
             // 濡傛灉褰撳墠娴佺▼鐘舵�佹槸鍗″洖鏀剁姸鎬侊紝灏辨槸瀹屾垚娴佺▼銆�
-            if (InoutConstant.PROGRESS_CARD_BACK.equals(curData.getProgress())) {
-                return inoutComplete(curData);
+            if (InoutConstant.PROGRESS_CARD_BACK.equals(data.getProgress())) {
+                return submitComplete(data);
             }
-
-            // 濡傛灉鏄叾浠栫姸鎬侊紝鍒欐墽琛屽垹闄ら�昏緫
-            return deleteInoutData(curData, "鍗″洖鏀跺垹闄�");
 
         } catch (Exception e) {
             return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                     "鍚庣鎵ц寮傚父锛�" + e.getMessage());
         }
+        
+        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(),
+                "鎵ц鎴愬姛", data);
     }
 
-    /* ============================== 璇﹀崟椤甸潰鐩稿叧鎿嶄綔 ================================= */
 
-    /**
-     * 琛ュ崟鎿嶄綔 琛ュ崟鍥犱负瀹屾垚鏃堕棿涓嶇‘瀹氾紝鎵�浠ラ渶瑕佺郴缁熸牴鎹綋鍓嶆暟鎹繘琛岃嚜鍔ㄦ娴嬶紝璋冩暣鍘熸潵娴佹按淇℃伅鍜屽簱瀛�
-     *
-     * @param data
-     * @return
-     * @throws Exception
-     */
-    @Transactional
-    public String addInoutData(InoutData data) throws Exception {
+        /**
+         * 琛ュ崟鎿嶄綔 琛ュ崟鍥犱负瀹屾垚鏃堕棿涓嶇‘瀹氾紝鎵�浠ラ渶瑕佺郴缁熸牴鎹綋鍓嶆暟鎹繘琛岃嚜鍔ㄦ娴嬶紝璋冩暣鍘熸潵娴佹按淇℃伅鍜屽簱瀛�
+         *
+         * @param data
+         * @return
+         * @throws Exception
+         */
+        public String addInoutData(InoutData data) throws Exception {
 
-        if (data.getSettleWeight() <= 0.0) {
-            return "琛ュ崟鏁版嵁瑕佹眰缁撶畻閲嶉噺蹇呴』澶т簬0";
-        }
-
-        // 琛ュ崟鏁版嵁鐩存帴鍒扮粨鏋滅姸鎬�
-        data.setRecordStatus(InoutConstant.RECORD_STATUS_ADD);
-        data.setProgress(InoutConstant.PROGRESS_RECORD);
-        if (InoutConstant.STATUS_NONE.equals(data.getCheckStatus())) {
-            data.setCheckStatus(InoutConstant.STATUS_PASS);
-        }
-
-        String loginUser = ContextUtil.getLoginUserCName();
-        data.setRegisterUser(loginUser);
-        data.setFullWeightUser(loginUser);
-        data.setEmptyWeightUser(loginUser);
-        data.setHandleUser(loginUser);
-        data.setCompleteUser(loginUser);
-        if (null == data.getCompleteTime()) {
-            data.setCompleteTime(new Date());
-        }
-        // 娉ㄥ唽鏃堕棿姣斿畬鎴愭椂闂存棭涓�涓皬鏃�
-        data.setRegisterTime(DateUtil.getNewByMinute(new Date(), -60));
-
-        if (StringUtils.isEmpty(data.getUserId())) {
-            data.setUserId(InoutConstant.DEFAULT_ID_CARD);
-        }
-        if (null == data.getIntelCard()) {
-            data.setIntelCard(data.getUserId());
-        }
-        if (null != data.getCheckItems()) {
-            data.setCheckUser(loginUser);
-        }
-
-        // 淇濆瓨妫�娴嬮」鐩�
-        if (InoutConstant.TYPE_IN.equals(data.getType())) {
-
-            if (null == data.getFullWeightTime()) {
-                data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -50));
-            }
-            if (null == data.getEmptyWeightTime()) {
-                data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -10));
+            if (data.getSettleWeight() <= 0.0) {
+                return "琛ュ崟鏁版嵁瑕佹眰缁撶畻閲嶉噺蹇呴』澶т簬0";
             }
 
-            // 鍏堟墽琛屽寲楠屼俊鎭繚瀛�
-            CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
-            if (null != checkResult) {
+            // 琛ュ崟鏁版嵁鐩存帴鍒扮粨鏋滅姸鎬�
+            data.setRecordStatus(InoutConstant.RECORD_STATUS_ADD);
+            data.setProgress(InoutConstant.PROGRESS_RECORD);
+            if (InoutConstant.STATUS_NONE.equals(data.getCheckStatus())) {
+                data.setCheckStatus(InoutConstant.STATUS_PASS);
+            }
+
+            String loginUser = ContextUtil.getLoginUserCName();
+            data.setRegisterUser(loginUser);
+            data.setFullWeightUser(loginUser);
+            data.setEmptyWeightUser(loginUser);
+            data.setHandleUser(loginUser);
+            data.setCompleteUser(loginUser);
+            if (null == data.getCompleteTime()) {
+                data.setCompleteTime(new Date());
+            }
+            // 娉ㄥ唽鏃堕棿姣斿畬鎴愭椂闂存棭涓�涓皬鏃�
+            data.setRegisterTime(DateUtil.getNewByMinute(new Date(), -60));
+
+            if (StringUtils.isEmpty(data.getUserId())) {
+                data.setUserId(InoutConstant.DEFAULT_ID_CARD);
+            }
+            if (null == data.getIntelCard()) {
+                data.setIntelCard(data.getUserId());
+            }
+            if (null != data.getCheckItems()) {
+                data.setCheckUser(loginUser);
+            }
+
+            // 淇濆瓨妫�娴嬮」鐩�
+            if (InoutConstant.TYPE_IN.equals(data.getType())) {
+
+                if (null == data.getFullWeightTime()) {
+                    data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -50));
+                }
+                if (null == data.getEmptyWeightTime()) {
+                    data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -10));
+                }
+
+                // 鍏堟墽琛屽寲楠屼俊鎭繚瀛�
+                CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
+                if (null != checkResult) {
 //				if (null == data.getWet())data.setWet(checkResult.getWet());
 //				if (null == data.getImpurity())data.setImpurity(checkResult.getImpurity());
+                }
+            } else {
+                if (null == data.getEmptyWeightTime()) {
+                    data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -50));
+                }
+                if (null == data.getFullWeightTime()) {
+                    data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -10));
+                }
             }
-        } else {
-            if (null == data.getEmptyWeightTime()) {
-                data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -50));
+
+            // 娣诲姞琛ュ崟鏁版嵁
+            String msg = inoutService.insertData(data);
+
+            // 鍒濆鍖栭獙璇佸嚭鍏ュ簱搴撳瓨
+            commonService.initInoutDepotStore(data);
+            return msg;
+        }
+
+        /**
+         * 淇敼鎿嶄綔 淇敼閫昏緫璇存槑锛氫慨鏀规暟鎹渶瑕佽幏鍙栧師鏁版嵁搴撲腑鐨勬暟鎹繘琛屽姣斻��
+         *
+         * @param data
+         * @return
+         * @throws Exception
+         */
+        @Transactional
+        public String updateInoutData(InoutData data)throws Exception {
+
+            if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
+                return "绯荤粺锛氬凡缁忓垹闄ょ殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
             }
-            if (null == data.getFullWeightTime()) {
-                data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -10));
+            if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
+                return "绯荤粺锛氬紓甯哥粓姝㈢殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
             }
-        }
 
-        // 娣诲姞琛ュ崟鏁版嵁
-        String msg = inoutService.insertData(data);
+            // 濡傛灉娴佺▼鏈粨鏉燂紝鍙洿鏂版暟鎹�
+            if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+                return inoutService.updateData(data);
+            }
 
-        // 鍒濆鍖栭獙璇佸嚭鍏ュ簱搴撳瓨
-        commonService.initInoutDepotStore(data);
-        return msg;
-    }
+            // 濡傛灉鏄凡缁忓畬鎴愮殑鏁版嵁锛屽厛鑾峰彇鍒颁慨鏀圭洿鎺ョ殑鏁版嵁鏍规嵁鏁版嵁杩涜瀵规瘮
+            InoutParam param = new InoutParam();
+            param.setId(data.getId());
+            param.setCompanyId(data.getCompanyId());
+            param.setType(data.getType());
+            InoutData record = inoutService.inoutQueryById(param);
 
-    /**
-     * 淇敼鎿嶄綔 淇敼閫昏緫璇存槑锛氫慨鏀规暟鎹渶瑕佽幏鍙栧師鏁版嵁搴撲腑鐨勬暟鎹繘琛屽姣斻��
-     *
-     * @param data
-     * @return
-     * @throws Exception
-     */
-    @javax.transaction.Transactional(rollbackOn = Exception.class)
-    public String updateInoutData(InoutData data) throws Exception {
+            if (null == record) {
+                return "褰撳墠淇敼鏁版嵁宸茬粡涓嶅瓨鍦紒";
+            }
 
-        if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
-            return "绯荤粺锛氬凡缁忓垹闄ょ殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
-        }
-        if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
-            return "绯荤粺锛氬紓甯哥粓姝㈢殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
-        }
+            // 閬垮厤鏁版嵁搴撲腑鐨勬暟鎹凡缁忚鍏朵粬浜轰慨鏀�
+            if (InoutConstant.RECORD_STATUS_DEL.equals(record.getRecordStatus())) {
+                return "绯荤粺锛氬凡缁忓垹闄ょ殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
+            }
+            if (InoutConstant.RECORD_STATUS_ERROR.equals(record.getRecordStatus())) {
+                return "绯荤粺锛氬紓甯哥粓姝㈢殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
+            }
 
-        // 濡傛灉娴佺▼鏈粨鏉燂紝鍙洿鏂版暟鎹�
-        if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            return inoutService.updateData(data);
-        }
-
-        // 濡傛灉鏄凡缁忓畬鎴愮殑鏁版嵁锛屽厛鑾峰彇鍒颁慨鏀圭洿鎺ョ殑鏁版嵁鏍规嵁鏁版嵁杩涜瀵规瘮
-        InoutParam param = new InoutParam();
-        param.setId(data.getId());
-        param.setCompanyId(data.getCompanyId());
-        param.setType(data.getType());
-        InoutData record = inoutService.inoutQueryById(param);
-
-        if (null == record) {
-            return "褰撳墠淇敼鏁版嵁宸茬粡涓嶅瓨鍦紒";
-        }
-
-        // 閬垮厤鏁版嵁搴撲腑鐨勬暟鎹凡缁忚鍏朵粬浜轰慨鏀�
-        if (InoutConstant.RECORD_STATUS_DEL.equals(record.getRecordStatus())) {
-            return "绯荤粺锛氬凡缁忓垹闄ょ殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
-        }
-        if (InoutConstant.RECORD_STATUS_ERROR.equals(record.getRecordStatus())) {
-            return "绯荤粺锛氬紓甯哥粓姝㈢殑鏁版嵁涓嶆敮鎸佷慨鏀癸紒";
-        }
-
-        // 淇濆瓨妫�娴嬮」鐩�
-        if (InoutConstant.TYPE_IN.equals(data.getType())) {
-            // 鍏堟墽琛屽寲楠屼俊鎭繚瀛�
-            CheckUpdateResult checkResult = checkStandardManager
-                    .updateCheckItems(data.getCheckId(), data.getCompanyId(),
-                            data.getCheckItems());
-            if (null != checkResult) {
+            // 淇濆瓨妫�娴嬮」鐩�
+            if (InoutConstant.TYPE_IN.equals(data.getType())) {
+                // 鍏堟墽琛屽寲楠屼俊鎭繚瀛�
+                CheckUpdateResult checkResult = checkStandardManager
+                        .updateCheckItems(data.getCheckId(), data.getCompanyId(),
+                                data.getCheckItems());
+                if (null != checkResult) {
 //				if (null == data.getWet())
 //					data.setWet(checkResult.getWet());
 //				if (null == data.getImpurity())
 //					data.setImpurity(checkResult.getImpurity());
+                }
             }
+
+            // 鏇存柊鏁版嵁
+            inoutService.updateData(data);
+            return null;
         }
 
-        // 鏇存柊鏁版嵁
-        inoutService.updateData(data);
-        return null;
-    }
-
-    /**
-     * 鍒犻櫎鎿嶄綔 鍒犻櫎鏁版嵁涓鸿蒋鍒犻櫎锛屽垹闄ゆ暟鎹悗闇�瑕佹牴鎹垹闄ゆ儏鍐佃仈鍔ㄥ簱瀛樼瓑淇℃伅
-     *
-     * @param data
-     * @param selected 鏄惁宸茬粡鏌ヨ杩囨暟鎹�
-     * @return
-     * @throws Exception
-     */
-    @Transactional
-    public String delInoutData(InoutData data, boolean selected)
+        /**
+         * 鍒犻櫎鎿嶄綔 鍒犻櫎鏁版嵁涓鸿蒋鍒犻櫎锛屽垹闄ゆ暟鎹悗闇�瑕佹牴鎹垹闄ゆ儏鍐佃仈鍔ㄥ簱瀛樼瓑淇℃伅
+         *
+         * @param data
+         * @param selected 鏄惁宸茬粡鏌ヨ杩囨暟鎹�
+         * @return
+         * @throws Exception
+         */
+        @Transactional
+        public String delInoutData (InoutData data,boolean selected)
             throws Exception {
 
-        // 閬垮厤椤甸潰缂撳瓨棣栧厛鑾峰彇鏁版嵁搴撲腑鏈�鏂扮殑褰撳墠鏁版嵁淇℃伅
-        InoutParam param = new InoutParam();
-        param.setCompanyId(data.getCompanyId());
-        param.setId(data.getId());
-        param.setMsg(" [" + ContextUtil.getLoginUserCName() + "]鎵ц鍒犻櫎锛屽師鍥狅細"
-                + data.getRemarks());
+            // 閬垮厤椤甸潰缂撳瓨棣栧厛鑾峰彇鏁版嵁搴撲腑鏈�鏂扮殑褰撳墠鏁版嵁淇℃伅
+            InoutParam param = new InoutParam();
+            param.setCompanyId(data.getCompanyId());
+            param.setId(data.getId());
+            param.setMsg(" [" + ContextUtil.getLoginUserCName() + "]鎵ц鍒犻櫎锛屽師鍥狅細"
+                    + data.getRemarks());
 
-        if (!selected) {
+            if (!selected) {
+                data = inoutService.inoutQueryById(param);
+
+                if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
+                    return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸侀噸澶嶅垹闄わ紒";
+                }
+                if (InoutConstant.RECORD_STATUS_ERROR
+                        .equals(data.getRecordStatus())) {
+                    return "褰撳墠鏁版嵁宸茬粡琚爣璁颁负寮傚父锛屼笉鏀寔鍒犻櫎锛�";
+                }
+            }
+
+            // 鎵ц鍒犻櫎
+            param.setProgress(InoutConstant.PROGRESS_RECORD);
+            param.setRecordStatus(InoutConstant.RECORD_STATUS_DEL);
+            param.setType(data.getType());
+            inoutService.deleteData(param);
+
+            // 濡傛灉娴佺▼鏈粨鏉燂紝鐩存帴鍒犻櫎锛屼笉鐗垫壇鍒拌仈鍔ㄨ皟鏁�
+            if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+                return null;
+            }
+            return null;
+        }
+
+        /**
+         * 寮傚父缁堟鎿嶄綔 璁剧疆寮傚父 涓轰簡閬垮厤椤甸潰鏁版嵁缂撳瓨锛岄渶瑕侀噸鏂拌幏鍙栨渶鏂版暟鎹垽鏂�
+         *
+         * @param data
+         * @return
+         * @throws Exception
+         */
+        @Transactional
+        public String errorInoutData (InoutData data){
+
+            InoutParam param = new InoutParam();
+            param.setCompanyId(data.getCompanyId());
+            param.setId(data.getId());
+            param.setMsg(" [" + ContextUtil.getLoginUserCName() + "]鎵ц寮傚父缁堟锛屽師鍥狅細"
+                    + data.getRemarks());
             data = inoutService.inoutQueryById(param);
 
             if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
-                return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸侀噸澶嶅垹闄わ紒";
+                return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸佸紓甯稿鐞嗭紒";
             }
-            if (InoutConstant.RECORD_STATUS_ERROR
-                    .equals(data.getRecordStatus())) {
-                return "褰撳墠鏁版嵁宸茬粡琚爣璁颁负寮傚父锛屼笉鏀寔鍒犻櫎锛�";
+            if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
+                return "涓嶆敮鎸侀噸澶嶅紓甯稿鐞嗭紒";
             }
+            if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+                return "娴佺▼缁撴潫鐨勬暟鎹笉鏀寔寮傚父澶勭悊锛�";
+            }
+
+            return inoutService.inoutStop(param);
         }
 
-        // 鎵ц鍒犻櫎
-        param.setProgress(InoutConstant.PROGRESS_RECORD);
-        param.setRecordStatus(InoutConstant.RECORD_STATUS_DEL);
-        param.setType(data.getType());
-        inoutService.deleteData(param);
+        /**
+         * 蹇�熺粨鏉熸搷浣� 娴佺▼娌℃湁缁撴潫鐨勫崟鎹繘琛岀粨鏉�
+         *
+         * @param data
+         * @return
+         */
+        public String completeInoutData (InoutData data) throws Exception {
+            if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
+                return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸佸畬鎴愶紒";
+            }
+            if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
+                return "寮傚父缁堟鐨勬暟鎹紝涓嶆敮鎸佸畬鎴愶紒";
+            }
+            if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
+                return "娴佺▼宸插畬鎴愮殑鏁版嵁锛屼笉鏀寔瀹屾垚锛�";
+            }
 
-        // 濡傛灉娴佺▼鏈粨鏉燂紝鐩存帴鍒犻櫎锛屼笉鐗垫壇鍒拌仈鍔ㄨ皟鏁�
-        if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            return null;
-        }
-        return null;
-    }
+            // 浠庢柊鏌ヨ鏁版嵁
+            InoutParam param = new InoutParam();
+            param.setId(data.getId());
+            param.setCompanyId(data.getCompanyId());
+            param.setType(data.getType());
+            InoutData cuData = inoutService.inoutProgressQuery(param);
+            if (null == cuData) {
+                return "褰撳墠杞﹁締娴佺▼鐘舵�佸凡缁忓彉鍖栵紝璇峰埛鏂伴〉闈㈤噸鏂版搷浣滐紒";
+            }
+            if (!cuData.getProgress().equals(data.getProgress())) {
+                return "褰撳墠杞﹁締娴佺▼鐘舵�佸凡缁忓彉鍖栵紝璇峰埛鏂伴〉闈㈤噸鏂版搷浣滐紒";
+            }
 
-    /**
-     * 寮傚父缁堟鎿嶄綔 璁剧疆寮傚父 涓轰簡閬垮厤椤甸潰鏁版嵁缂撳瓨锛岄渶瑕侀噸鏂拌幏鍙栨渶鏂版暟鎹垽鏂�
-     *
-     * @param data
-     * @return
-     * @throws Exception
-     */
-    @Transactional
-    public String errorInoutData(InoutData data) {
+            if (null == data.getCompleteTime()) {
+                return "璇峰~鍐欏畬鎴愭椂闂达紒锛�";
+            }
+            if (StringUtils.isEmpty(data.getDepotId())) {
+                return "璇峰~鍐欎粨搴撲俊鎭紒";
+            }
+            if (StringUtils.isEmpty(data.getFoodYear())) {
+                return "璇峰~鍐欑伯椋熷勾浠戒俊鎭紒";
+            }
+            if (StringUtils.isEmpty(data.getFoodVariety())) {
+                return "璇峰~鍐欑伯椋熷搧绉嶄俊鎭紒";
+            }
 
-        InoutParam param = new InoutParam();
-        param.setCompanyId(data.getCompanyId());
-        param.setId(data.getId());
-        param.setMsg(" [" + ContextUtil.getLoginUserCName() + "]鎵ц寮傚父缁堟锛屽師鍥狅細"
-                + data.getRemarks());
-        data = inoutService.inoutQueryById(param);
+            if (data.getSettleWeight() <= 0) {
+                return "璇峰~鍐欑粨绠楀噣閲嶄俊鎭紒";
+            }
 
-        if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
-            return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸佸紓甯稿鐞嗭紒";
-        }
-        if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
-            return "涓嶆敮鎸侀噸澶嶅紓甯稿鐞嗭紒";
-        }
-        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            return "娴佺▼缁撴潫鐨勬暟鎹笉鏀寔寮傚父澶勭悊锛�";
+            String msg = inoutService.quickComplete(data);
+
+            if (null == msg) {
+                data.setProgress(InoutConstant.PROGRESS_RECORD);
+                commonService.initInoutDepotStore(data);
+            }
+            return msg;
         }
 
-        return inoutService.inoutStop(param);
-    }
-
-    /**
-     * 蹇�熺粨鏉熸搷浣� 娴佺▼娌℃湁缁撴潫鐨勫崟鎹繘琛岀粨鏉�
-     *
-     * @param data
-     * @return
-     */
-    public String completeInoutData(InoutData data) throws Exception {
-        if (InoutConstant.RECORD_STATUS_DEL.equals(data.getRecordStatus())) {
-            return "宸茬粡鍒犻櫎鐨勬暟鎹紝涓嶆敮鎸佸畬鎴愶紒";
-        }
-        if (InoutConstant.RECORD_STATUS_ERROR.equals(data.getRecordStatus())) {
-            return "寮傚父缁堟鐨勬暟鎹紝涓嶆敮鎸佸畬鎴愶紒";
-        }
-        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
-            return "娴佺▼宸插畬鎴愮殑鏁版嵁锛屼笉鏀寔瀹屾垚锛�";
+        public void initLpr (InoutConf conf){
+            inoutDeviceManager.initLpr(conf);
         }
 
-        // 浠庢柊鏌ヨ鏁版嵁
-        InoutParam param = new InoutParam();
-        param.setId(data.getId());
-        param.setCompanyId(data.getCompanyId());
-        param.setType(data.getType());
-        InoutData cuData = inoutService.inoutProgressQuery(param);
-        if (null == cuData) {
-            return "褰撳墠杞﹁締娴佺▼鐘舵�佸凡缁忓彉鍖栵紝璇峰埛鏂伴〉闈㈤噸鏂版搷浣滐紒";
-        }
-        if (!cuData.getProgress().equals(data.getProgress())) {
-            return "褰撳墠杞﹁締娴佺▼鐘舵�佸凡缁忓彉鍖栵紝璇峰埛鏂伴〉闈㈤噸鏂版搷浣滐紒";
-        }
+        /**
+         * 鍑哄叆搴撴敞鍐屾暟鎹彁浜わ紝鍏ュ簱鐧昏鍜屽嚭鍏ュ簱鐧昏浣跨敤鍚屼竴涓柟娉�
+         *
+         * @param data
+         * @return
+         * @throws Exception
+         */
+        public PageResponse<InoutData> submitRegisterInout (InoutData data) throws Exception {
 
-        if (null == data.getCompleteTime()) {
-            return "璇峰~鍐欏畬鎴愭椂闂达紒锛�";
-        }
-        if (StringUtils.isEmpty(data.getDepotId())) {
-            return "璇峰~鍐欎粨搴撲俊鎭紒";
-        }
-        if (StringUtils.isEmpty(data.getFoodYear())) {
-            return "璇峰~鍐欑伯椋熷勾浠戒俊鎭紒";
-        }
-        if (StringUtils.isEmpty(data.getFoodVariety())) {
-            return "璇峰~鍐欑伯椋熷搧绉嶄俊鎭紒";
-        }
-
-        if (data.getSettleWeight() <= 0) {
-            return "璇峰~鍐欑粨绠楀噣閲嶄俊鎭紒";
-        }
-
-        String msg = inoutService.quickComplete(data);
-
-        if (null == msg) {
-            data.setProgress(InoutConstant.PROGRESS_RECORD);
-            commonService.initInoutDepotStore(data);
-        }
-        return msg;
-    }
-
-    public void initLpr(InoutConf conf) {
-        inoutDeviceManager.initLpr(conf);
-    }
-
-    /**
-     * 鍑哄叆搴撴敞鍐屾暟鎹彁浜わ紝鍏ュ簱鐧昏鍜屽嚭鍏ュ簱鐧昏浣跨敤鍚屼竴涓柟娉�
-     *
-     * @param data
-     * @return
-     * @throws Exception
-     */
-    public PageResponse<InoutData> submitRegisterInout(InoutData data) throws Exception {
-
-        //棣栧厛鍒ゆ柇娴佺▼涓槸鍚︽湁宸茬粡瀛樺湪鐨勮溅杈嗕俊鎭湭鎵ц瀹屾垚锛岀洿鎺ヤ粠鏁版嵁搴撲腑鏌ヨ
-        InoutParam param = new InoutParam();
-        param.setCompanyId(data.getCompanyId());
-        param.setPlateNum(data.getPlateNum());
-        param.setIntelCard(data.getIntelCard());
-        param.setType(data.getType());
-        param.setStart(DateUtil.getNewByDay(null, -10));
-
-        int num = inoutService.checkExist(param);
-        if (num > 0) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "褰撳墠杞︾墝鎴栨櫤鎱у崱鏈夋鍦ㄦ墽琛屾祦绋嬫湭缁撴潫锛岃鑱旂郴绠$悊鍛�", data);
-        }
-
-
-        //鑾峰彇绯荤粺鍙傛暟閰嶇疆
-        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
-        if (null == inoutSysConf) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鎻愮ず锛氬綋鍓嶅簱鍖烘湭閰嶇疆鍑哄叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳", data);
-        }
-
-
-        //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
-        String curProgress = data.getProgress();
-        String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
-
-
-        data = updateBasicInfo(data, curProgress, nextProgress);
-
-        String msg = inoutService.insertData(data);
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    msg, data);
-        }
-
-        // 鎵ц闄勪欢淇℃伅
-        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
-
-
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
-    }
-
-    public PageResponse<InoutData> submitWeightIn(InoutData data) throws Exception {
-        //鑾峰彇绯荤粺鍙傛暟閰嶇疆
-        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
-        if (null == inoutSysConf) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data);
-        }
-
-
-        //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
-        String curProgress = data.getProgress();
-        String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
-        data = updateBasicInfo(data, curProgress, nextProgress);
-
-
-        //鍏ュ簱绉伴噸鍙兘璋冩暣璐ㄦ鍗�
-        CheckUpdateResult checkUpdateResult = updateCheckItems(data);
-        if (data.getDeCheck() == 0) {
-            data.setDeCheck(checkUpdateResult.getDeSum());
-        }
-        if (data.getAddCheck() == 0) {
-            data.setAddCheck(checkUpdateResult.getAddSum());
-        }
-
-        //鎵ц鏁版嵁鏇存柊
-        String msg = inoutService.updateData(data);
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
-        }
-
-        // 鎵ц闄勪欢淇℃伅
-        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
-
-        //绉伴噸瀹屾垚锛岃皟鐢ㄥ嚭鍏ュ簱鎺у埗閫昏緫澶勭悊
-        inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
-
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
-    }
-
-
-    public PageResponse<InoutData> submitWeightOut(InoutData data) throws Exception {
-        //鑾峰彇绯荤粺鍙傛暟閰嶇疆
-        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
-        if (null == inoutSysConf) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data);
-        }
-
-
-        //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
-        String curProgress = data.getProgress();
-        String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
-        data = updateBasicInfo(data, curProgress, nextProgress);
-
-        //鎵ц鏁版嵁鏇存柊
-        String msg = inoutService.updateData(data);
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
-        }
-
-        // 鎵ц闄勪欢淇℃伅
-        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
-
-        //绉伴噸鍚庢牴鎹綋鍓嶆祦绋嬬姸鎬佸拰涓嬩竴涓姸鎬侊紝閫氱煡绉伴噸鎺у埗鍣�
-        inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
-
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
-    }
-
-    public PageResponse<InoutData> submitHandle(InoutData data) throws Exception {
-
-
-        if (null == data.getHandleUser()) {
-            data.setHandleUser(ContextUtil.getLoginUserCName());
-        }
-
-        //鑾峰彇绯荤粺鍙傛暟閰嶇疆
-        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
-        if (null == inoutSysConf) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data);
-        }
-
-        //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
-        String curProgress = data.getProgress();
-        String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
-        data = updateBasicInfo(data, curProgress, nextProgress);
-
-
-        //鎵ц鏁版嵁鏇存柊
-        String msg = inoutService.updateDataByHandle(data);
-
-        if (null != msg) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
-        }
-
-        // 鎵ц闄勪欢淇℃伅
-        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
-
-        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
-    }
-
-
-    /**
-     * 鏍规嵁鏉′欢鑾峰彇鎵︽牱鏁版嵁
-     *
-     * @param param
-     * @return
-     */
-    public PageResponse<Page<InoutCheckData>> pageSampleData(InoutCheckParam param) {
-
-        if (StringUtils.isEmpty(param.getCompanyId())) {
-            param.setCompanyId(ContextUtil.getCompanyId());
-        }
-        if (StringUtils.isEmpty(param.getDeptId())) {
-            param.setDeptId(ContextUtil.subDeptId(null));
-        }
-
-        //鑻ユ煡璇㈡潯浠朵负宸叉墻鏍凤紝鍒欐祦绋嬬疆绌猴紱鑻ユ湭鎵︽牱锛屽垯娴佺▼涓嶅鐞嗭紝浠嶄负鎵︽牱鍖栭獙娴佺▼(CHECK)
-        if (!"NONE".equals(param.getSampleStatus())) {
-            param.setProgress(null);
-        }
-
-        //鑾峰彇鎵︽牱鏁版嵁
-        Page<InoutCheckData> sampleList = inoutService.pageSampleData(param);
-
-
-        if (null == sampleList.getRecords() || sampleList.getRecords().isEmpty()) {
-            return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
-                    "鑾峰彇鍒版暟鎹俊鎭负绌�");
-        }
-        return new PageResponse<>(RespCodeEnum.CODE_0000, sampleList);
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data) {
-
-        try {
-            // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+            //棣栧厛鍒ゆ柇娴佺▼涓槸鍚︽湁宸茬粡瀛樺湪鐨勮溅杈嗕俊鎭湭鎵ц瀹屾垚锛岀洿鎺ヤ粠鏁版嵁搴撲腑鏌ヨ
             InoutParam param = new InoutParam();
             param.setCompanyId(data.getCompanyId());
-            param.setId(data.getId());
-            InoutData curData = inoutService.inoutProgressQuery(param);
-            if (null == curData) {
+            param.setPlateNum(data.getPlateNum());
+            param.setIntelCard(data.getIntelCard());
+            param.setType(data.getType());
+            param.setStart(DateUtil.getNewByDay(null, -10));
+
+            int num = inoutService.checkExist(param);
+            if (num > 0) {
                 return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", data);
-            }
-            if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+                        "褰撳墠杞︾墝鎴栨櫤鎱у崱鏈夋鍦ㄦ墽琛屾祦绋嬫湭缁撴潫锛岃鑱旂郴绠$悊鍛�", data);
             }
 
-            //鎵︽牱鏃堕棿鍜屾墻鏍蜂汉
-            if (StringUtils.isEmpty(data.getSampleUser())) {
-                data.setSampleUser(ContextUtil.getLoginUserCName());
-            }
-            if (null == data.getSampleTime()) {
-                data.setSampleTime(new Date());
-            }
-            String msg = inoutService.updateSampleData(data);
-
-            if (null != msg) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
-            }
-
-            return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
-        } catch (Exception e) {
-            log.error("鍚庡彴寮傚父:{}", e);
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鍚庡彴寮傚父锛�" + e.getMessage(), null);
-        }
-    }
-
-    /**
-     * @param param
-     * @return
-     */
-    public PageResponse<Page<InoutCheckData>> pageCheckData(InoutCheckParam param) {
-
-        if (StringUtils.isEmpty(param.getCompanyId())) {
-            param.setCompanyId(ContextUtil.getCompanyId());
-        }
-        if (StringUtils.isEmpty(param.getDeptId())) {
-            param.setDeptId(ContextUtil.subDeptId(null));
-        }
-        // 濡傛灉鏄凡鍖栭獙锛屽垯灏嗘祦绋嬬姸鎬佺疆绌猴紝濡傛灉鏄湭鍖栭獙锛屽垯娴佺▼鐘舵�佷笉澶勭悊锛屼粛鏄疌HECK鐘舵��
-        if (!"NONE".equals(param.getCheckStatus())) {
-            param.setProgress(null);
-        }
-
-        Page<InoutCheckData> checkList = inoutService.pageCheckData(param);
-
-
-        if (null == checkList.getRecords() || checkList.getRecords().isEmpty()) {
-            return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
-                    "鑾峰彇鍒版暟鎹俊鎭负绌�");
-        }
-        return new PageResponse<>(RespCodeEnum.CODE_0000, checkList);
-    }
-
-    /**
-     * 鑾峰彇鍖栭獙椤逛俊鎭�
-     *
-     * @param param
-     * @return
-     */
-    public PageResponse<List<CheckItemData>> getCheckItemData(InoutCheckParam param) {
-
-        try {
-            List<CheckItemData> result = checkStandardManager.listCheckItem(param.getCheckId(),
-                    param.getCompanyId(), param.getFoodVariety());
-
-            return new PageResponse<>(RespCodeEnum.CODE_0000, result);
-        } catch (Exception e) {
-            return new PageResponse<>(
-                    RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
-        }
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public PageResponse<InoutCheckData> updateCheckData(InoutCheckData data) {
-        try {
-
-            // 鑾峰彇涓氬姟鏁版嵁淇℃伅
-            InoutParam param = new InoutParam();
-            param.setCompanyId(data.getCompanyId());
-            param.setId(data.getId());
-            InoutData curData = inoutService.inoutProgressQuery(param);
-            if (null == curData) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", data);
-            }
-            if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                        "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
-            }
-
-            //鏇存柊鍖栭獙椤逛俊鎭�
-            CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
-            if (StringUtils.isNotEmpty(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());
 
             //鑾峰彇绯荤粺鍙傛暟閰嶇疆
             InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
@@ -1259,55 +752,344 @@
                 return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                         "鎻愮ず锛氬綋鍓嶅簱鍖烘湭閰嶇疆鍑哄叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳", data);
             }
-            //鏇存柊涓嬩竴娴佺▼鐘舵��
-            if (InoutConstant.PROGRESS_CHECK.equals(curData.getProgress())) {
-                curData = updateBasicInfo(curData, inoutSysConf);
-                // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
-                if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) {
-                    curData = checkNoPass(curData);
-                }
-            }
 
-            //鍖栭獙浜恒�佸寲楠屾椂闂�
-            data.setCheckStatus(curData.getCheckStatus());
-            data.setProgress(curData.getProgress());
-            if (StringUtils.isEmpty(data.getCheckUser())) {
-                data.setCheckUser(ContextUtil.getLoginUserCName());
-            }
-            if (null == data.getCheckTime()) {
-                data.setCheckTime(new Date());
-            }
 
-            String msg = inoutService.updateCheckData(data);
+            //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
+            String curProgress = data.getProgress();
+            String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
+
+
+            data = updateBasicInfo(data, curProgress, nextProgress);
+
+            String msg = inoutService.insertData(data);
+
             if (null != msg) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        msg, data);
             }
 
-            return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
-        } catch (Exception e) {
-            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
-                    "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+            // 鎵ц闄勪欢淇℃伅
+            fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+
+
+            return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
         }
-    }
 
-    /**
-     * 鑾峰彇鍗曚环淇℃伅
-     *
-     * @param param
-     * @return
-     */
-    public PageResponse<InoutPrice> getPrice(InoutCheckParam param) {
-        try {
-
-            List<InoutPrice> price = inoutService.getPrice(param);
-            if (null == price || price.isEmpty()) {
-                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鏈幏鍙栧埌绮瀹氫环閰嶇疆淇℃伅");
+        public PageResponse<InoutData> submitWeightIn (InoutData data) throws Exception {
+            //鑾峰彇绯荤粺鍙傛暟閰嶇疆
+            InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
+            if (null == inoutSysConf) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data);
             }
-            return new PageResponse<>(RespCodeEnum.CODE_0000, price.get(0));
 
-        } catch (Exception e) {
-            return new PageResponse<>(
-                    RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+
+            //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
+            String curProgress = data.getProgress();
+            String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
+            data = updateBasicInfo(data, curProgress, nextProgress);
+
+
+            //鍏ュ簱绉伴噸鍙兘璋冩暣璐ㄦ鍗�
+            CheckUpdateResult checkUpdateResult = updateCheckItems(data);
+            if (data.getDeCheck() == 0) {
+                data.setDeCheck(checkUpdateResult.getDeSum());
+            }
+            if (data.getAddCheck() == 0) {
+                data.setAddCheck(checkUpdateResult.getAddSum());
+            }
+
+            //鎵ц鏁版嵁鏇存柊
+            String msg = inoutService.updateData(data);
+
+            if (null != msg) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
+            }
+
+            // 鎵ц闄勪欢淇℃伅
+            fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+
+            //绉伴噸瀹屾垚锛岃皟鐢ㄥ嚭鍏ュ簱鎺у埗閫昏緫澶勭悊
+            inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
+
+            return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
         }
-    }
-}
\ No newline at end of file
+
+
+        public PageResponse<InoutData> submitWeightOut (InoutData data) throws Exception {
+            //鑾峰彇绯荤粺鍙傛暟閰嶇疆
+            InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
+            if (null == inoutSysConf) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data);
+            }
+
+
+            //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
+            String curProgress = data.getProgress();
+            String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
+            data = updateBasicInfo(data, curProgress, nextProgress);
+
+            //鎵ц鏁版嵁鏇存柊
+            String msg = inoutService.updateData(data);
+
+            if (null != msg) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
+            }
+
+            // 鎵ц闄勪欢淇℃伅
+            fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+
+            //绉伴噸鍚庢牴鎹綋鍓嶆祦绋嬬姸鎬佸拰涓嬩竴涓姸鎬侊紝閫氱煡绉伴噸鎺у埗鍣�
+            inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
+
+            return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
+        }
+
+        public PageResponse<InoutData> submitHandle (InoutData data) throws Exception {
+
+
+            if (null == data.getHandleUser()) {
+                data.setHandleUser(ContextUtil.getLoginUserCName());
+            }
+
+            //鑾峰彇绯荤粺鍙傛暟閰嶇疆
+            InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
+            if (null == inoutSysConf) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "鎻愮ず锛氬綋鍓嶇郴缁熶腑娴佺▼閰嶇疆寮傚父锛岃鑱旂郴绠$悊鍛�", data);
+            }
+
+            //鑾峰彇涓嬩竴涓祦绋嬬姸鎬�
+            String curProgress = data.getProgress();
+            String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
+            data = updateBasicInfo(data, curProgress, nextProgress);
+
+
+            //鎵ц鏁版嵁鏇存柊
+            String msg = inoutService.updateDataByHandle(data);
+
+            if (null != msg) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
+            }
+
+            // 鎵ц闄勪欢淇℃伅
+            fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
+
+            return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛", data);
+        }
+
+
+        /**
+         * 鏍规嵁鏉′欢鑾峰彇鎵︽牱鏁版嵁
+         *
+         * @param param
+         * @return
+         */
+        public PageResponse<Page<InoutCheckData>> pageSampleData (InoutCheckParam param){
+
+            if (StringUtils.isEmpty(param.getCompanyId())) {
+                param.setCompanyId(ContextUtil.getCompanyId());
+            }
+            if (StringUtils.isEmpty(param.getDeptId())) {
+                param.setDeptId(ContextUtil.subDeptId(null));
+            }
+
+            //鑻ユ煡璇㈡潯浠朵负宸叉墻鏍凤紝鍒欐祦绋嬬疆绌猴紱鑻ユ湭鎵︽牱锛屽垯娴佺▼涓嶅鐞嗭紝浠嶄负鎵︽牱鍖栭獙娴佺▼(CHECK)
+            if (!"NONE".equals(param.getSampleStatus())) {
+                param.setProgress(null);
+            }
+
+            //鑾峰彇鎵︽牱鏁版嵁
+            Page<InoutCheckData> sampleList = inoutService.pageSampleData(param);
+
+
+            if (null == sampleList.getRecords() || sampleList.getRecords().isEmpty()) {
+                return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
+                        "鑾峰彇鍒版暟鎹俊鎭负绌�");
+            }
+            return new PageResponse<>(RespCodeEnum.CODE_0000, sampleList);
+        }
+
+        @Transactional(rollbackFor = Exception.class)
+        public PageResponse<InoutCheckData> updateSampleData (InoutCheckData data){
+
+            try {
+                // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+                InoutParam param = new InoutParam();
+                param.setCompanyId(data.getCompanyId());
+                param.setId(data.getId());
+                InoutData curData = inoutService.inoutProgressQuery(param);
+                if (null == curData) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                            "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", data);
+                }
+                if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                            "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+                }
+
+                //鎵︽牱鏃堕棿鍜屾墻鏍蜂汉
+                if (StringUtils.isEmpty(data.getSampleUser())) {
+                    data.setSampleUser(ContextUtil.getLoginUserCName());
+                }
+                if (null == data.getSampleTime()) {
+                    data.setSampleTime(new Date());
+                }
+                String msg = inoutService.updateSampleData(data);
+
+                if (null != msg) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+                }
+
+                return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+            } catch (Exception e) {
+                log.error("鍚庡彴寮傚父:{}", e);
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+            }
+        }
+
+        /**
+         * @param param
+         * @return
+         */
+        public PageResponse<Page<InoutCheckData>> pageCheckData (InoutCheckParam param){
+
+            if (StringUtils.isEmpty(param.getCompanyId())) {
+                param.setCompanyId(ContextUtil.getCompanyId());
+            }
+            if (StringUtils.isEmpty(param.getDeptId())) {
+                param.setDeptId(ContextUtil.subDeptId(null));
+            }
+            // 濡傛灉鏄凡鍖栭獙锛屽垯灏嗘祦绋嬬姸鎬佺疆绌猴紝濡傛灉鏄湭鍖栭獙锛屽垯娴佺▼鐘舵�佷笉澶勭悊锛屼粛鏄疌HECK鐘舵��
+            if (!"NONE".equals(param.getCheckStatus())) {
+                param.setProgress(null);
+            }
+
+            Page<InoutCheckData> checkList = inoutService.pageCheckData(param);
+
+
+            if (null == checkList.getRecords() || checkList.getRecords().isEmpty()) {
+                return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
+                        "鑾峰彇鍒版暟鎹俊鎭负绌�");
+            }
+            return new PageResponse<>(RespCodeEnum.CODE_0000, checkList);
+        }
+
+        /**
+         * 鑾峰彇鍖栭獙椤逛俊鎭�
+         *
+         * @param param
+         * @return
+         */
+        public PageResponse<List<CheckItemData>> getCheckItemData (InoutCheckParam param){
+
+            try {
+                List<CheckItemData> result = checkStandardManager.listCheckItem(param.getCheckId(),
+                        param.getCompanyId(), param.getFoodVariety());
+
+                return new PageResponse<>(RespCodeEnum.CODE_0000, result);
+            } catch (Exception e) {
+                return new PageResponse<>(
+                        RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+            }
+        }
+
+        @Transactional(rollbackFor = Exception.class)
+        public PageResponse<InoutCheckData> updateCheckData (InoutCheckData data){
+            try {
+
+                // 鑾峰彇涓氬姟鏁版嵁淇℃伅
+                InoutParam param = new InoutParam();
+                param.setCompanyId(data.getCompanyId());
+                param.setId(data.getId());
+                InoutData curData = inoutService.inoutProgressQuery(param);
+                if (null == curData) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                            "娌℃湁鑾峰彇鍒板叆搴撲笟鍔℃暟鎹俊鎭紝鏇存柊澶辫触", data);
+                }
+                if (InoutConstant.PROGRESS_RECORD.equals(curData.getProgress())) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                            "褰撳墠娴佺▼宸茬粡缁撴潫锛屼笉鏀寔淇敼");
+                }
+
+                //鏇存柊鍖栭獙椤逛俊鎭�
+                CheckUpdateResult checkResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
+                if (StringUtils.isNotEmpty(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());
+
+                //鑾峰彇绯荤粺鍙傛暟閰嶇疆
+                InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
+                if (null == inoutSysConf) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                            "鎻愮ず锛氬綋鍓嶅簱鍖烘湭閰嶇疆鍑哄叆搴撴祦绋嬩俊鎭紝璇疯仈绯荤鐞嗗憳", data);
+                }
+                //鏇存柊涓嬩竴娴佺▼鐘舵��
+                if (InoutConstant.PROGRESS_CHECK.equals(curData.getProgress())) {
+                    curData = updateBasicInfo(curData, inoutSysConf);
+                    // 鑻ュ寲楠岀粨鏋滀笉鍚堟牸锛屽垽鏂厤缃悗缁祦绋�
+                    if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) {
+                        curData = checkNoPass(curData);
+                    }
+                }
+
+                //鍖栭獙浜恒�佸寲楠屾椂闂�
+                data.setCheckStatus(curData.getCheckStatus());
+                data.setProgress(curData.getProgress());
+                if (StringUtils.isEmpty(data.getCheckUser())) {
+                    data.setCheckUser(ContextUtil.getLoginUserCName());
+                }
+                if (null == data.getCheckTime()) {
+                    data.setCheckTime(new Date());
+                }
+
+                String msg = inoutService.updateCheckData(data);
+                if (null != msg) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
+                }
+
+                return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "鎵ц鎴愬姛");
+            } catch (Exception e) {
+                return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
+                        "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+            }
+        }
+
+        /**
+         * 鑾峰彇鍗曚环淇℃伅
+         *
+         * @param param
+         * @return
+         */
+        public PageResponse<InoutPrice> getPrice (InoutCheckParam param){
+            try {
+
+                List<InoutPrice> price = inoutService.getPrice(param);
+                if (null == price || price.isEmpty()) {
+                    return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "鏈幏鍙栧埌绮瀹氫环閰嶇疆淇℃伅");
+                }
+                return new PageResponse<>(RespCodeEnum.CODE_0000, price.get(0));
+
+            } catch (Exception e) {
+                return new PageResponse<>(
+                        RespCodeEnum.CODE_1111.getCode(), "鍚庡彴寮傚父锛�" + e.getMessage(), null);
+            }
+        }
+
+
+    }
\ No newline at end of file

--
Gitblit v1.9.3