| | |
| | | package com.fzzy.sys.controller.inout; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fzzy.common.dto.BaseParam; |
| | | import com.fzzy.igds.constant.Constant; |
| | | import com.fzzy.igds.domain.Depot; |
| | | import com.fzzy.igds.domain.InoutConf; |
| | | 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.domain.*; |
| | | import com.fzzy.igds.utils.ContextUtil; |
| | | import com.fzzy.igds.utils.DateUtil; |
| | | import com.fzzy.sys.manager.common.CommonManager; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.ui.ModelMap; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Date; |
| | |
| | | private CommonManager commonManager; |
| | | |
| | | /** |
| | | * 出入库快速登记 |
| | | * |
| | | * 登记,出入库共用 |
| | | * @param httpRequest |
| | | * @param sort 配套号 |
| | | * @param type 业务类型:IN-入库,OUT-出库 |
| | | * @param sort 配套号 |
| | | * @param type 业务类型:IN-入库,OUT-出库 |
| | | * @param view |
| | | * @return |
| | | */ |
| | | @RequestMapping("/register") |
| | | public String register(HttpServletRequest httpRequest, |
| | | @RequestParam(value = "sort", required = false) String sort, |
| | | @RequestParam(value = "type", required = false) String type, |
| | | ModelMap view) { |
| | | @RequestParam(value = "sort", required = false) String sort, |
| | | @RequestParam(value = "type", required = false) String type, |
| | | ModelMap view) { |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | view.put(Constant.MODEL_KEY_LOGIN_USER, user); |
| | | |
| | | String deptId = ContextUtil.subDeptId(user); |
| | | view.put("deptId", deptId); |
| | | |
| | |
| | | sort = inoutManager.getInoutWeightByClient(httpRequest); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(type)) { |
| | | if (StringUtils.isBlank(type)) { |
| | | //默认入库 |
| | | type = Constant.TYPE_IN; |
| | | } |
| | | view.put("type", type); |
| | | |
| | | //称重是否可编辑标签 |
| | | String weightEditTag = inoutManager.getWeightEditTag(user.getCompanyId(), deptId); |
| | | view.put("weightEditTag", weightEditTag); |
| | | // 类型列表 |
| | | List<SysDictData> listInoutType = commonManager.getInoutType(); |
| | | view.put("listInoutType", listInoutType); |
| | | |
| | | //出入库流程 |
| | | String inoutProgress = inoutManager.getInoutProgressConf(user.getCompanyId(), ContextUtil.subDeptId(user), type); |
| | | view.put("inoutProgress", inoutProgress); |
| | | |
| | | // 当前流程节点 |
| | | view.put("progress", Constant.PROGRESS_REGISTER); |
| | | |
| | | // 获取出入库配置信息 |
| | | List<InoutConf> listInoutConf = inoutManager.getListInoutConf(user.getCompanyId(), deptId); |
| | | |
| | | //根据出入库设备信息筛选地磅配置信息,所有地磅,支持用户手动选择 |
| | | List<InoutConf> listWeight = inoutManager.getInoutConf(listInoutConf, Constant.CONF_TYPE_30); |
| | | view.put("listWeight", listWeight); |
| | | // 车牌识别参数封装 |
| | | InoutConf conf = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_10, Constant.PROGRESS_REGISTER, 1); |
| | | view.put("lprDto", conf); |
| | | |
| | | // 获取当前地磅 |
| | | InoutConf weightDto = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_30); |
| | | view.put("weightDto", weightDto); |
| | | |
| | | // 过程摄像头1 |
| | | InoutConf conf = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_60, Constant.PROGRESS_WEIGHT_TAG, 1); |
| | | view.put("snapDto1", conf); |
| | | |
| | | // 过程摄像头2 |
| | | conf = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_60, Constant.PROGRESS_WEIGHT_TAG, 2); |
| | | view.put("snapDto2", conf); |
| | | |
| | | // 过程摄像头3 |
| | | conf = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_60, Constant.PROGRESS_WEIGHT_TAG, 3); |
| | | view.put("snapDto3", conf); |
| | | |
| | | return prefix + "/inout-register"; |
| | | return prefix + "/register"; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @RequestMapping("/check") |
| | | public String check(HttpServletRequest httpRequest, ModelMap view) { |
| | | public String check(ModelMap view) { |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | view.put(Constant.MODEL_KEY_LOGIN_USER, user); |
| | | |
| | | String deptId = ContextUtil.subDeptId(user); |
| | | |
| | | view.put("type", Constant.TYPE_IN); |
| | | view.put("deptId", deptId); |
| | | view.put("type", Constant.TYPE_IN); |
| | | |
| | | // 仓库列表做下拉框使用 |
| | | List<Depot> listDepot = commonManager.listDepotByDeptId(deptId); |
| | |
| | | // 当前流程节点 |
| | | view.put("progress", Constant.PROGRESS_CHECK); |
| | | |
| | | // 粮食品种下拉框 |
| | | List<SysDictData> listFoodVariety = commonManager.getDicTrigger( |
| | | Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId()); |
| | | view.put("listFoodVariety", listFoodVariety); |
| | | // 类型列表 |
| | | List<SysDictData> listInoutType = commonManager.getInoutType(); |
| | | view.put("listInoutType", listInoutType); |
| | | |
| | | // 粮食性质下拉框 |
| | | List<SysDictData> listFoodType = commonManager.getDicTrigger(Constant.TRIGGER_PARENT_FOOD_TYPE, user.getCompanyId()); |
| | | view.put("listFoodType", listFoodType); |
| | | // 粮食品种下拉框 |
| | | List<SysDictData> listFoodVariety = commonManager.getDicTrigger(Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId()); |
| | | view.put("listFoodVariety", listFoodVariety); |
| | | |
| | | // 粮食等级下拉框 |
| | | List<SysDictData> listFoodLevel = commonManager.getDicTrigger(Constant.TRIGGER_PARENT_FOOD_LEVEL, user.getCompanyId()); |
| | |
| | | view.put("endTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd")); |
| | | view.put("startTime", DateFormatUtils.format(DateUtil.getNewByDay(null, -30), "yyyy-MM-dd")); |
| | | |
| | | return prefix + "/inout-check"; |
| | | return prefix + "/check"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 入库称重操作,包括空车称重和满车称重,共用一个页面 |
| | |
| | | public String weight(HttpServletRequest httpRequest, |
| | | @RequestParam(value = "sort", required = false) String sort, |
| | | @RequestParam(value = "type", required = false) String type, |
| | | @RequestParam(value = "viewTag", required = false) String viewTag, |
| | | ModelMap view) { |
| | | |
| | | if (StringUtils.isEmpty(viewTag)) { |
| | | viewTag = "1"; |
| | | } |
| | | //如果没有指定地磅,从用户上一个选择中获取 |
| | | if (StringUtils.isEmpty(sort)) { |
| | | sort = "1"; |
| | |
| | | |
| | | SysUser user = ContextUtil.getLoginUser(); |
| | | view.put(Constant.MODEL_KEY_LOGIN_USER, user); |
| | | |
| | | String deptId = ContextUtil.subDeptId(user); |
| | | view.put("type", type); |
| | | view.put("deptId", deptId); |
| | | |
| | | // 仓库列表做下拉框使用 |
| | | List<Depot> listDepot = commonManager.listDepotByDeptId(deptId); |
| | | view.put(Constant.MODEL_KEY_DEPOT_LIST, listDepot); |
| | | //称重是否可编辑标签 |
| | | String weightEditTag = inoutManager.getWeightEditTag(user.getCompanyId(), deptId); |
| | | view.put("weightEditTag", weightEditTag); |
| | | |
| | | // 当前流程标签 |
| | | view.put("progress", Constant.PROGRESS_WEIGHT_TAG); |
| | | |
| | | //入库流程配置 |
| | | String inoutProgress = inoutManager.getInoutProgressConf(user.getCompanyId(), deptId, Constant.TYPE_IN); |
| | | String inoutProgress = inoutManager.getInoutProgressConf(user.getCompanyId(), deptId, type); |
| | | view.put("inoutProgress", inoutProgress); |
| | | |
| | | //称重是否可编辑标签 |
| | | String weightEditTag = inoutManager.getWeightEditTag(user.getCompanyId(), deptId); |
| | | view.put("weightEditTag", weightEditTag); |
| | | // 类型 |
| | | List<SysDictData> listInoutType = commonManager.getInoutType(); |
| | | view.put("listInoutType", listInoutType); |
| | | |
| | | // 仓库列表做下拉框使用 |
| | | List<Depot> listDepot = commonManager.listDepotByDeptId(deptId); |
| | | view.put(Constant.MODEL_KEY_DEPOT_LIST, listDepot); |
| | | |
| | | // 粮食品种下拉框 |
| | | List<SysDictData> listFoodVariety = commonManager.getDicTrigger(Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId()); |
| | |
| | | conf = inoutManager.getInoutConf(listInoutConf, sort, Constant.CONF_TYPE_60, Constant.PROGRESS_WEIGHT_TAG, 3); |
| | | view.put("snapDto3", conf); |
| | | |
| | | return prefix + "/inout-weight"; |
| | | //默认查询时间 |
| | | view.put("endTime", DateFormatUtils.format(new Date(), "yyyy-MM-dd")); |
| | | view.put("startTime", DateFormatUtils.format(DateUtil.getNewByDay(null, -30), "yyyy-MM-dd")); |
| | | |
| | | |
| | | String viewStr = prefix + "/weight"; |
| | | if ("1".equals(viewTag)) { |
| | | viewStr = prefix + "/weight"; |
| | | } |
| | | if ("2".equals(viewTag)) { |
| | | viewStr = prefix + "/weight2"; |
| | | } |
| | | return viewStr; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分页获取流程未完成的数据 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @RequestMapping("/page-inout-data") |
| | | @ResponseBody |
| | | public PageResponse<Page<InoutRecord>> pageInoutData(@RequestBody InoutParam param) { |
| | | return inoutManager.pageInoutData(param); |
| | | } |
| | | |
| | | /** |
| | | * 获取待称重的数据 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @RequestMapping("/list-weight-data") |
| | | @ResponseBody |
| | | public PageResponse<List<InoutRecord>> listWeightData(@RequestBody InoutParam param) { |
| | | return inoutManager.listWeightData(param); |
| | | } |
| | | |
| | | /** |
| | | * 出入库数据查询,根据条件查询数据,出入库数据信息 |
| | | * |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @RequestMapping("/inout-query") |
| | | @ResponseBody |
| | | public PageResponse<InoutRecord> inoutQuery(@RequestBody InoutParam param) { |
| | | if (null == param.getCompanyId()) param.setCompanyId(ContextUtil.getCompanyId()); |
| | | return inoutManager.inoutQuery(param); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 出入库登记提交 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @RequestMapping("/submit-register") |
| | | @ResponseBody |
| | | public PageResponse<InoutRecord> submitRegister(@RequestBody InoutRecord data) { |
| | | |
| | | return inoutManager.submitRegister(data); |
| | | } |
| | | |
| | | /** |
| | | * 出入库化验信息提交 |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @RequestMapping("/submit-check") |
| | | @ResponseBody |
| | | public PageResponse<InoutRecord> submitCheck(@RequestBody InoutRecord data) { |
| | | |
| | | return inoutManager.submitCheck(data); |
| | | } |
| | | |
| | | /** |
| | | * 出入库称重环节提交 |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @RequestMapping("/submit-weight") |
| | | @ResponseBody |
| | | public PageResponse<InoutRecord> submitWeight(@RequestBody InoutRecord data) { |
| | | |
| | | return inoutManager.submitWeight(data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 出入库称重环节提交,请注意:值仓挑提交的数据非出入库流水完整信息,不能直接调用update方法 |
| | | * |
| | | * @param data |
| | | * @return |
| | | */ |
| | | @RequestMapping("/submit-handle") |
| | | @Transactional |
| | | @ResponseBody |
| | | public PageResponse<InoutRecord> submitHandle(@RequestBody InoutRecord data) { |
| | | |
| | | log.debug("-------------submitHandle------------------"); |
| | | return inoutManager.submitHandle(data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取行政区域 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/page-dicArea") |
| | | @ResponseBody |
| | | public PageResponse<Page<DicArea>> pageDicArea(@RequestBody IgdsBaseParam param) { |
| | | |
| | | return inoutManager.pageDicArea(param); |
| | | } |
| | | |
| | | /** |
| | | * 入库通知单-获取没有完成的通知单列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/list-notice-in") |
| | | @ResponseBody |
| | | public PageResponse<List<InoutNoticeIn>> listNoticeIn(@RequestBody NoticeParam param) { |
| | | return inoutManager.listNoticeIn(param); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 出库通知单-获取没有完成的通知单列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/list-notice-out") |
| | | @ResponseBody |
| | | public PageResponse<List<InoutNoticeOut>> listNoticeOut(@RequestBody NoticeParam param) { |
| | | return inoutManager.listNoticeOut(param); |
| | | } |
| | | } |