| | |
| | | return data; |
| | | } |
| | | |
| | | public PageResponse<Page<InoutData>> pageRecordData(InoutParam param) { |
| | | // public PageResponse<Page<InoutData>> pageRecordData(InoutParam param) { |
| | | // |
| | | // log.debug("分页信息--page={},limit={},cuur={}", param.getPage(), |
| | | // param.getLimit(), param.getCurr()); |
| | | // |
| | | // Page<InoutData> result = inoutService.pageRecordData(param); |
| | | // |
| | | // if (null == result.getRecords() || result.getRecords().isEmpty()) { |
| | | // return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), |
| | | // "获取到数据信息为空"); |
| | | // } |
| | | // |
| | | // return new PageResponse<>(RespCodeEnum.CODE_0000, result); |
| | | // } |
| | | |
| | | log.debug("分页信息--page={},limit={},cuur={}", param.getPage(), |
| | | param.getLimit(), param.getCurr()); |
| | | |
| | | Page<InoutData> result = inoutService.pageRecordData(param); |
| | | |
| | | if (null == result.getRecords() || result.getRecords().isEmpty()) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), |
| | | "获取到数据信息为空"); |
| | | } |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000, result); |
| | | } |
| | | |
| | | /** |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public PageResponse<Page<InoutData>> pageCheckData(InoutParam param) { |
| | | // 如果是已化验,则将流程状态置空,如果是未化验,则流程状态不处理,仍是CHECK状态 |
| | | if (!"NONE".equals(param.getCheckStatus())) { |
| | | param.setProgress(null); |
| | | } |
| | | // 设置分库Id |
| | | String deptId = ContextUtil.subDeptId(null); |
| | | param.setDeptId(deptId); |
| | | return pageRecordData(param); |
| | | } |
| | | // /** |
| | | // * @param param |
| | | // * @return |
| | | // */ |
| | | // public PageResponse<Page<InoutData>> pageCheckData(InoutParam param) { |
| | | // // 如果是已化验,则将流程状态置空,如果是未化验,则流程状态不处理,仍是CHECK状态 |
| | | // if (!"NONE".equals(param.getCheckStatus())) { |
| | | // param.setProgress(null); |
| | | // } |
| | | // // 设置分库Id |
| | | // String deptId = ContextUtil.subDeptId(null); |
| | | // param.setDeptId(deptId); |
| | | // return pageRecordData(param); |
| | | // } |
| | | |
| | | |
| | | public PageResponse<InoutData> inoutComplete(InoutData data) throws Exception { |
| | |
| | | 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<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); |
| | | // } |
| | | |
| | | /** |
| | | * 删除并完成 |
| | |
| | | } |
| | | |
| | | //若查询条件为已扦样,则流程置空;若未扦样,则流程不处理,仍为扦样化验流程(CHECK) |
| | | if ("SAMPLE".equals(param.getSampleStatus())) { |
| | | if (!"NONE".equals(param.getSampleStatus())) { |
| | | param.setProgress(null); |
| | | } |
| | | |
| | |
| | | "当前流程已经结束,不支持修改"); |
| | | } |
| | | |
| | | //扦样信息 |
| | | curData.setSampleTime(data.getSampleTime()); |
| | | curData.setSampleType(data.getSampleType()); |
| | | curData.setSampleUser(data.getSampleUser()); |
| | | |
| | | String msg = inoutService.updateSampleData(curData); |
| | | //扦样时间和扦样人 |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @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)); |
| | | } |
| | | // 如果是已化验,则将流程状态置空,如果是未化验,则流程状态不处理,仍是CHECK状态 |
| | | 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(), |
| | | "当前流程已经结束,不支持修改"); |
| | | } |
| | | curData.setCheckStatus(data.getCheckStatus()); |
| | | |
| | | //更新下一流程状态 |
| | | if (InoutConstant.PROGRESS_CHECK.equals(curData.getProgress())) { |
| | | curData = updateInBasicInfo(curData, null); |
| | | // 若化验结果不合格,判断配置后续流程 |
| | | if (InoutConstant.STATUS_UNPASS.equals(curData.getCheckStatus())) { |
| | | curData = checkNoPass(curData); |
| | | } |
| | | } |
| | | |
| | | data.setCheckStatus(curData.getCheckStatus()); |
| | | //化验人、化验时间 |
| | | 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); |
| | | } |
| | | //TODO 更新化验项信息 |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功"); |
| | | } catch (Exception e) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), |
| | | "后台异常:" + e.getMessage(), null); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |