| | |
| | | return data; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新质检信息 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | private CheckUpdateResult updateCheckItems(InoutData data) { |
| | | CheckUpdateResult result = new CheckUpdateResult(); |
| | | if (null == data.getCheckItems()) |
| | | return result; |
| | | if (null == data.getCheckItems()) return result; |
| | | |
| | | try { |
| | | // 更新检验项数据 |
| | | result = checkStandardManager.updateCheckItems(data.getCheckId(), |
| | | data.getCompanyId(), data.getCheckItems()); |
| | | result = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems()); |
| | | |
| | | // 将化验数据存入缓存中 |
| | | inoutService.setCheckCache(data); |
| | |
| | | |
| | | // 更新数据 |
| | | inoutService.updateData(data); |
| | | // this.autoCheckByUpdate(data, record); |
| | | return null; |
| | | } |
| | | |
| | |
| | | if (StringUtils.isEmpty(data.getDepotId())) { |
| | | return "请填写仓库信息!"; |
| | | } |
| | | // if (StringUtils.isEmpty(data.getCustomerId())) { |
| | | // return "请填写往来单位信息!"; |
| | | // } |
| | | if (StringUtils.isEmpty(data.getFoodYear())) { |
| | | return "请填写粮食年份信息!"; |
| | | } |
| | |
| | | |
| | | public void initLpr(InoutConf conf) { |
| | | inoutDeviceManager.initLpr(conf); |
| | | } |
| | | |
| | | /** |
| | | * 获取出入库设备配置信息 |
| | | * |
| | | * @param companyId |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | | public List<InoutConf> getListInoutConf(String companyId, String deptId) { |
| | | return inoutManagerService.getCacheInoutConf(companyId, deptId); |
| | | } |
| | | |
| | | /** |
| | | * 操作道闸设备 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public PageResponse<List<CheckItemData>> gateCtrl(InoutGateDto param) { |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "", null); |
| | | } |
| | | |
| | | /** |
| | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data); |
| | | } |
| | | |
| | | public PageResponse<InoutData> submitWeightIn(InoutData data) throws Exception { |
| | | //获取系统参数配置 |
| | | InoutSysConf inoutSysConf = inoutManagerService.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); |
| | | |
| | | if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) { |
| | | data.setEmptyWeightTime(new Date()); |
| | | data.setEmptyWeightUser(ContextUtil.getLoginUserCName()); |
| | | data.setProgress(nextProgress); |
| | | |
| | | } |
| | | if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(nextProgress)) { |
| | | data.setFullWeightTime(new Date()); |
| | | data.setFullWeightUser(ContextUtil.getLoginUserCName()); |
| | | data.setProgress(nextProgress); |
| | | } |
| | | |
| | | |
| | | //如果下一个数据状态=流程结束 |
| | | if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) { |
| | | data.setCompleteTime(DateUtils.addMinutes(new Date(), 2)); |
| | | data.setCompleteUser(ContextUtil.getLoginUserCName()); |
| | | data.setProgress(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 = inoutManagerService.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); |
| | | |
| | | if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) { |
| | | data.setEmptyWeightTime(new Date()); |
| | | data.setEmptyWeightUser(ContextUtil.getLoginUserCName()); |
| | | data.setProgress(nextProgress); |
| | | |
| | | } |
| | | if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(nextProgress)) { |
| | | data.setFullWeightTime(new Date()); |
| | | data.setFullWeightUser(ContextUtil.getLoginUserCName()); |
| | | data.setProgress(nextProgress); |
| | | } |
| | | |
| | | |
| | | //如果下一个数据状态=流程结束 |
| | | if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) { |
| | | data.setCompleteTime(DateUtils.addMinutes(new Date(), 2)); |
| | | data.setCompleteUser(ContextUtil.getLoginUserCName()); |
| | | data.setProgress(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); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据条件获取扦样数据 |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data){ |
| | | public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data) { |
| | | |
| | | try { |
| | | // 获取业务数据信息 |
| | |
| | | } |
| | | |
| | | //扦样时间和扦样人 |
| | | if(StringUtils.isEmpty(data.getSampleUser())){ |
| | | if (StringUtils.isEmpty(data.getSampleUser())) { |
| | | data.setSampleUser(ContextUtil.getLoginUserCName()); |
| | | } |
| | | if(null == data.getSampleTime()){ |
| | | if (null == data.getSampleTime()) { |
| | | data.setSampleTime(new Date()); |
| | | } |
| | | String msg = inoutService.updateSampleData(data); |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public PageResponse<InoutCheckData> updateCheckData(InoutCheckData data){ |
| | | public PageResponse<InoutCheckData> updateCheckData(InoutCheckData data) { |
| | | try { |
| | | |
| | | // 获取业务数据信息 |
| | |
| | | |
| | | data.setCheckStatus(curData.getCheckStatus()); |
| | | //化验人、化验时间 |
| | | if(StringUtils.isEmpty(data.getCheckUser())){ |
| | | if (StringUtils.isEmpty(data.getCheckUser())) { |
| | | data.setCheckUser(ContextUtil.getLoginUserCName()); |
| | | } |
| | | if(null == data.getCheckTime()){ |
| | | if (null == data.getCheckTime()) { |
| | | data.setCheckTime(new Date()); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |