| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.constant.RespCodeEnum; |
| | | import com.fzzy.igds.data.IgdsBaseParam; |
| | | import com.fzzy.igds.data.InoutParam; |
| | | import com.fzzy.igds.data.NoticeParam; |
| | | import com.fzzy.igds.data.PageResponse; |
| | | import com.fzzy.igds.data.*; |
| | | import com.fzzy.igds.domain.*; |
| | | import com.fzzy.igds.service.DicAreaService; |
| | | import com.fzzy.igds.service.InoutConfService; |
| | | import com.fzzy.igds.service.InoutNoticeService; |
| | | import com.fzzy.igds.service.InoutRecordService; |
| | | import com.fzzy.igds.service.*; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.fzzy.igds.utils.SystemUtil; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | |
| | | private RedisCache redisCache; |
| | | @Resource |
| | | private InoutConfService inoutConfService; |
| | | @Resource |
| | | private FileService fileService; |
| | | @Resource |
| | | private InoutRecordService inoutRecordService; |
| | | @Resource |
| | |
| | | |
| | | /** |
| | | * 根据配置获取出入库的配置参数 |
| | | * |
| | | * @param listInoutConf |
| | | * @param type |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * 根据配置获取出入库的配置参数 |
| | | * |
| | | * @param listInoutConf |
| | | * @param sort |
| | | * @param type |
| | |
| | | } |
| | | |
| | | /** |
| | | * 出入库注册数据提交,出入库登记使用同一个方法 |
| | | * 出入库注册数据提交,出入库登记使用同一个方法,包含称重时直接登记 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public PageResponse<InoutRecord> submitRegister(InoutRecord data) { |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | public PageResponse<InoutData> submitRegister(InoutData data) { |
| | | if (StringUtils.isEmpty(data.getCompanyId())) { |
| | | data.setCompanyId(user.getCompanyId()); |
| | | data.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | if (StringUtils.isEmpty(data.getDeptId())) { |
| | | data.setDeptId(ContextUtil.subDeptId(user)); |
| | | data.setDeptId(ContextUtil.subDeptId(null)); |
| | | } |
| | | |
| | | int num = inoutRecordService.checkExist(data.getCompanyId(), data.getPlateNum()); |
| | |
| | | data.setUserName(data.getUserName().trim()); |
| | | } |
| | | //登记人及登记时间 |
| | | data.setRegisterUser(user.getUserName()); |
| | | data.setRegisterUser(ContextUtil.getLoginUserName()); |
| | | data.setRegisterTime(new Date()); |
| | | |
| | | num = inoutRecordService.addInoutRecord(data); |
| | |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "登记失败!", data); |
| | | } |
| | | |
| | | //TODO 附件处理 |
| | | // List<FileData> files = data.getFiles(); |
| | | // if (null != files && files.size() > 0) { |
| | | // // 执行附件信息 |
| | | // fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); |
| | | // } |
| | | //附件处理 |
| | | fileService.saveInoutFiles(data.getFiles(), data.getId(), curProgress, "INOUT"); |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "登记成功!", data); |
| | | } |
| | | |
| | | /** |
| | | * 化验信息提交 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public PageResponse<InoutRecord> submitCheck(InoutRecord data) { |
| | | public PageResponse<InoutData> submitCheck(InoutData data) { |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | if (StringUtils.isEmpty(data.getCompanyId())) { |
| | | data.setCompanyId(user.getCompanyId()); |
| | |
| | | |
| | | /** |
| | | * 称重提交,包含称重登记提交及单独称重提交 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public PageResponse<InoutRecord> submitWeight(InoutRecord data) { |
| | | public PageResponse<InoutData> submitWeight(InoutData data) { |
| | | if (Constant.PROGRESS_WEIGHT_EMPTY.equals(data.getProgress())) { |
| | | data.setEmptyWeightTime(new Date()); |
| | | data.setEmptyWeightUser(ContextUtil.getLoginUserName()); |
| | | } |
| | | if (Constant.PROGRESS_WEIGHT_FULL.equals(data.getProgress())) { |
| | | data.setFullWeightTime(new Date()); |
| | | data.setFullWeightUser(ContextUtil.getLoginUserName()); |
| | | } |
| | | if (StringUtils.isBlank(data.getId())) { |
| | | //表示称重时直接登记 |
| | | return submitRegister(data); |
| | | } |
| | | |
| | | // 获取系统参数配置 |
| | | //获取系统参数配置 |
| | | InoutSysConf inoutSysConf = inoutConfService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); |
| | | if (null == inoutSysConf) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "提示:当前系统中流程配置异常,请联系管理员", data); |
| | |
| | | String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf); |
| | | data.setProgress(nextProgress); |
| | | |
| | | int num; |
| | | if(StringUtils.isBlank(data.getId())){ |
| | | data.setRegisterTime(new Date()); |
| | | data.setRegisterUser(ContextUtil.getLoginUserName()); |
| | | |
| | | //设置初次提交时称重时间信息 |
| | | if(data.getFullWeight() > 0){ |
| | | data.setFullWeightUser(ContextUtil.getLoginUserName()); |
| | | data.setFullWeightTime(new Date()); |
| | | } |
| | | if(data.getEmptyWeight() > 0){ |
| | | data.setEmptyWeightUser(ContextUtil.getLoginUserName()); |
| | | data.setEmptyWeightTime(new Date()); |
| | | } |
| | | //称重登记 |
| | | num = inoutRecordService.addInoutRecord(data); |
| | | }else { |
| | | if (Constant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) { |
| | | data.setEmptyWeightTime(new Date()); |
| | | data.setEmptyWeightUser(ContextUtil.getLoginUserName()); |
| | | } |
| | | if (Constant.PROGRESS_WEIGHT_FULL.equals(curProgress)) { |
| | | data.setFullWeightTime(new Date()); |
| | | data.setFullWeightUser(ContextUtil.getLoginUserName()); |
| | | } |
| | | //称重更新 |
| | | num = inoutRecordService.updateInoutRecord(data); |
| | | if(Constant.PROGRESS_RECORD.equals(nextProgress)){ |
| | | //流程结束时,设置完成时间和完成人 |
| | | data.setCompleteTime(new Date()); |
| | | data.setCompleteUser(ContextUtil.getLoginUserName()); |
| | | } |
| | | //称重数据更新 |
| | | int num = inoutRecordService.updateInoutRecord(data); |
| | | |
| | | if (num == 0) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "提交失败!", data); |
| | | } |
| | | |
| | | //TODO 附件处理 |
| | | // List<FileData> files = data.getFiles(); |
| | | // if (null != files && files.size() > 0) { |
| | | // // 执行附件信息 |
| | | // fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); |
| | | // } |
| | | //附件处理 |
| | | fileService.saveInoutFiles(data.getFiles(), data.getId(), curProgress, "INOUT"); |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data); |
| | | } |
| | | |
| | | /** |
| | | * 值仓信息提交 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | public PageResponse<InoutRecord> submitHandle(InoutRecord data) { |
| | | public PageResponse<InoutData> submitHandle(InoutData data) { |
| | | |
| | | // 获取系统参数配置 |
| | | InoutSysConf inoutSysConf = inoutConfService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId()); |
| | |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "提交失败!", data); |
| | | } |
| | | |
| | | //TODO 附件处理 |
| | | // List<FileData> files = data.getFiles(); |
| | | // if (null != files && files.size() > 0) { |
| | | // // 执行附件信息 |
| | | // fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), curProgress); |
| | | // } |
| | | //附件处理 |
| | | fileService.saveInoutFiles(data.getFiles(), data.getId(), curProgress, "INOUT"); |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "提交成功", data); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 分页查询数据 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | if (StringUtils.isEmpty(param.getDeptId())) { |
| | | param.setDeptId(ContextUtil.subDeptId(null)); |
| | | } |
| | | |
| | | param.setProgressTag(Constant.PROGRESS_RECORD); |
| | | |
| | | Page<InoutRecord> corePage = new Page<>(param.getPage(), param.getLimit()); |
| | | inoutRecordService.listPageInout(corePage, param); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 分页查询数据 |
| | | * 查询待称重的数据 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询待值仓的数据 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public PageResponse<List<InoutRecord>> listHandleData(InoutParam param) { |
| | | if (StringUtils.isEmpty(param.getCompanyId())) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | if (StringUtils.isEmpty(param.getDeptId())) { |
| | | param.setDeptId(ContextUtil.subDeptId(null)); |
| | | } |
| | | |
| | | List<InoutRecord> inoutRecords = inoutRecordService.listInout(param); |
| | | |
| | | if (null == inoutRecords || inoutRecords.isEmpty()) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), "获取到数据信息为空"); |
| | | } |
| | | |
| | | return new PageResponse<>(RespCodeEnum.CODE_0000, inoutRecords); |
| | | } |
| | | |
| | | /** |
| | | * 查询数据 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | public PageResponse<InoutRecord> inoutQuery(InoutParam param) { |
| | | if (StringUtils.isEmpty(param.getId())) { |
| | | |
| | | if (StringUtils.isEmpty(param.getId()) && StringUtils.isEmpty(param.getPlateNum())) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "查询参数不完整,查询失败!"); |
| | | } |
| | | if (StringUtils.isEmpty(param.getCompanyId())) { |
| | | param.setCompanyId(ContextUtil.getCompanyId()); |
| | | } |
| | | if (StringUtils.isEmpty(param.getDeptId())) { |
| | | param.setDeptId(ContextUtil.subDeptId(null)); |
| | | } |
| | | |
| | | InoutRecord result = inoutRecordService.selectById(param.getId()); |
| | | if(Constant.PROGRESS_WEIGHT_EMPTY.equals(param.getProgress()) || Constant.PROGRESS_WEIGHT_FULL.equals(param.getProgress())){ |
| | | //设置查询待称重的 |
| | | param.setProgress(null); |
| | | //设置称重流程标记 |
| | | param.setWeightTag("WEIGHT"); |
| | | } |
| | | |
| | | InoutRecord result = inoutRecordService.selectOne(param); |
| | | if (null == result) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(), |
| | | "系统未查询到执行中的单据信息", null); |
| | |
| | | |
| | | /** |
| | | * 分页获取区划信息 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | param.setCompanyId(user.getCompanyId()); |
| | | } |
| | | param.setDeptId(ContextUtil.subDeptId(user)); |
| | | |
| | | List<InoutNoticeIn> list = inoutNoticeService.getNoticeIn(param.getCompanyId(), param.getDeptId(),Constant.COMPLETE_STATUS_NONE); |
| | | param.setCompleteStatus(Constant.COMPLETE_STATUS_NONE); |
| | | List<InoutNoticeIn> list = inoutNoticeService.getNoticeIn(param); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "查询结果为空!"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | |
| | | param.setCompanyId(user.getCompanyId()); |
| | | } |
| | | param.setDeptId(ContextUtil.subDeptId(user)); |
| | | |
| | | List<InoutNoticeOut> list = inoutNoticeService.getNoticeOut(param.getCompanyId(), param.getDeptId(),Constant.COMPLETE_STATUS_NONE); |
| | | param.setCompleteStatus(Constant.COMPLETE_STATUS_NONE); |
| | | List<InoutNoticeOut> list = inoutNoticeService.getNoticeOut(param); |
| | | |
| | | if (null == list || list.isEmpty()) { |
| | | return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "查询结果为空!"); |