jiazx0107@163.com
2023-06-29 f46a102b5f5ab7e2c74c9d05f9d6e06c358b8c02
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java
@@ -199,9 +199,12 @@
     * @param data
     * @return
     */
    private InoutData updateCheckItems(InoutData data) throws Exception {
    private InoutData updateCheckItems(InoutData data, boolean toSave) throws Exception {
        if (null == data.getCheckItems()) return data;
        //设置没有质检ID,取消执行持久化
        if (!toSave) data.setCheckId(null);
        // 更新检验项数据
        CheckUpdateResult checkUpdateResult = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
@@ -321,7 +324,7 @@
        param.setIntelCard(data.getIntelCard());
        param.setUserId(data.getCompleteUser());
        param.setDepotId(data.getDepotId());
        param.setCompleteTime(data.getCompleteTime());
        param.setCompleteTime(new Date());
        param.setProgress(InoutConstant.PROGRESS_RECORD);
        String msg = inoutService.toComplete(param);
@@ -383,7 +386,7 @@
    public String addInoutData(InoutData data) throws Exception {
        if (data.getSettleWeight() <= 0.0) {
            return "补单数据要求结算重量必须大于0";
            return "系统:补单数据要求结算重量必须大于0";
        }
        // 补单数据直接到结果状态
@@ -415,40 +418,34 @@
            data.setCheckUser(loginUser);
        }
        // 保存检测项目
        if (InoutConstant.TYPE_IN.equals(data.getType())) {
        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));
                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());
            }
            data = this.updateCheckItems(data, false);
        } else {
            if (null == data.getEmptyWeightTime()) {
                data.setEmptyWeightTime(DateUtil
                        .getNewByMinute(new Date(), -50));
                data.setEmptyWeightTime(DateUtil.getNewByMinute(new Date(), -50));
            }
            if (null == data.getFullWeightTime()) {
                data.setFullWeightTime(DateUtil.getNewByMinute(new Date(), -10));
            }
        }
        // 添加补单数据
        String msg = inoutService.insertData(data);
        return msg;
        //先保存主表,后执行子表
        inoutService.insertData(data);
        if (InoutConstant.TYPE_IN.equals(data.getType())) {
            this.updateCheckItems(data, true);
        }
        return null;
    }
    /**
@@ -472,9 +469,9 @@
        // 保存检测项目
        if (InoutConstant.TYPE_IN.equals(data.getType())) {
            data = updateCheckItems(data);
            data = updateCheckItems(data, true);
        }
        return inoutService.updateData(data);
    }
@@ -634,7 +631,7 @@
        data = updateBasicInfo(data, curProgress, nextProgress);
        // 入库称重可能调整质检单
        data = updateCheckItems(data);
        data = updateCheckItems(data, true);
        // 执行数据更新
        String msg = inoutService.updateData(data);
@@ -698,8 +695,7 @@
        }
        // 获取系统参数配置
        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(
                data.getCompanyId(), data.getDeptId());
        InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
        if (null == inoutSysConf) {
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "提示:当前系统中流程配置异常,请联系管理员", data);
@@ -707,24 +703,20 @@
        // 获取下一个流程状态
        String curProgress = data.getProgress();
        String nextProgress = getNextProgress(curProgress, data.getType(),
                inoutSysConf);
        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);
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
        }
        // 执行附件信息
        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(),
                data.getId(), curProgress);
        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功",
                data);
        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data);
    }
    /**
@@ -856,6 +848,11 @@
        curData.setProgress(curData.getProgress());
        curData.setType(curData.getType());
        curData.setFoodLevel(data.getFoodLevel());
        curData.setFoodVariety(data.getFoodVariety());
        curData.setPrice(data.getPrice());
        curData.setRemarks(data.getRemarks());
        curData.setCheckItems(data.getCheckItems());
        if (StringUtils.isEmpty(data.getCheckUser())) {
            curData.setCheckUser(ContextUtil.getLoginUserCName());