czt
2023-06-12 1b60f1df51e1824154018a5b6a7159b09b44c8b1
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) {