| | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功"); |
| | | } |
| | | |
| | | public PageResponse<InoutCheckData> submitCheck(InoutCheckData data) throws Exception { |
| | | |
| | | // 获取系统参数配置 |
| | | InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); |
| | | if (null == inoutSysConf) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), |
| | | "提示:当前库区未配置出入库流程信息,请联系管理员", data); |
| | | } |
| | | |
| | | // 获取业务数据信息 |
| | | 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) { |
| | | curData.setDeCheck(checkResult.getDeSum()); |
| | | data.setDeCheck(checkResult.getDeSum()); |
| | | } |
| | | if (checkResult.getAddSum() > 0) { |
| | | curData.setAddCheck(checkResult.getAddSum()); |
| | | data.setAddCheck(checkResult.getAddSum()); |
| | | } |
| | | if (null == data.getCheckTime()) { |
| | | curData.setCheckTime(new Date()); |
| | | data.setCheckTime(new Date()); |
| | | } |
| | | curData.setCheckStatus(data.getCheckStatus()); |
| | | |
| | | |
| | | // 获取下一个流程状态 |
| | | String curProgress = curData.getProgress(); |
| | | String nextProgress = getNextProgress(curProgress, curData.getType(), inoutSysConf); |
| | | curData = updateBasicInfo(curData, curProgress, nextProgress); |
| | | |
| | | // 若化验结果不合格,判断配置后续流程 |
| | | if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) { |
| | | curData = checkNoPass(curData); |
| | | } |
| | | |
| | | curData.setProgress(curData.getProgress()); |
| | | curData.setType(curData.getType()); |
| | | |
| | | if (StringUtils.isEmpty(data.getCheckUser())) { |
| | | curData.setCheckUser(ContextUtil.getLoginUserCName()); |
| | | } |
| | | if (null == data.getCheckTime()) { |
| | | curData.setCheckTime(new Date()); |
| | | } |
| | | |
| | | String msg = inoutService.updateCheckData(curData); |
| | | |
| | | if (null != msg) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg); |
| | | } |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功"); |
| | | } |
| | | |
| | | /** |
| | | * @param param |
| | | * @return |
| | |
| | | } |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取单价信息 |