|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.wms.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.zy.asrs.common.web.BaseController; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.ViewStockUseBean; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.entity.ViewWorkInBean; | 
|---|
|  |  |  | import com.zy.asrs.common.wms.mapper.ReportQueryMapper; | 
|---|
|  |  |  | import com.zy.asrs.framework.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.asrs.framework.common.R; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | 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.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 日志统计控制器层 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author admin | 
|---|
|  |  |  | * @date 2018年11月23日 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/report") | 
|---|
|  |  |  | public class ReportQueryController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ReportQueryMapper reportQueryMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ReportQueryMapper reportQueryMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------库位使用统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewStockUseList.action") | 
|---|
|  |  |  | public R queryViewStockUseListByPages(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | ViewStockUseBean bean = new ViewStockUseBean(); | 
|---|
|  |  |  | bean.setPageSize(limit); | 
|---|
|  |  |  | bean.setPageNumber(curr); | 
|---|
|  |  |  | //------------------库位使用统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewStockUseList.action") | 
|---|
|  |  |  | public R queryViewStockUseListByPages(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | ViewStockUseBean bean = new ViewStockUseBean(); | 
|---|
|  |  |  | bean.setPageSize(limit); | 
|---|
|  |  |  | bean.setPageNumber(curr); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Page<ViewStockUseBean> page = new Page<>(curr, limit); | 
|---|
|  |  |  | IPage<ViewStockUseBean> list = reportQueryMapper.queryViewStockUseList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Page<ViewStockUseBean> page = new Page<>(curr, limit); | 
|---|
|  |  |  | IPage<ViewStockUseBean> list = reportQueryMapper.queryViewStockUseList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------库存滞留统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewStayTimeList.action") | 
|---|
|  |  |  | public Map<String,Object> queryViewStayTimeListByPages(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | ViewStayTimeBean bean = new ViewStayTimeBean(); | 
|---|
|  |  |  | bean.setPageSize(limit); | 
|---|
|  |  |  | bean.setPageNumber(curr); | 
|---|
|  |  |  | String locNo = String.valueOf(param.get("loc_no")); | 
|---|
|  |  |  | if (!Cools.isEmpty(locNo) && !locNo.equals("null")) { | 
|---|
|  |  |  | bean.setLocNo(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 导出 | 
|---|
|  |  |  | @RequestMapping(value = "/viewStockUseExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "库位使用统计导出") | 
|---|
|  |  |  | public R viewStockUseExport(@RequestBody JSONObject param) { | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | List<ViewStockUseBean> list = reportQueryMapper.getViewStockUseAll(new ViewStockUseBean()); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Page<ViewStayTimeBean> page = new Page<>(curr, limit); | 
|---|
|  |  |  | IPage<ViewStayTimeBean> list = reportQueryMapper.queryViewStayTimeList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------库存滞留统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewStayTimeList.action") | 
|---|
|  |  |  | public Map<String, Object> queryViewStayTimeListByPages(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | ViewStayTimeBean bean = new ViewStayTimeBean(); | 
|---|
|  |  |  | bean.setPageSize(limit); | 
|---|
|  |  |  | bean.setPageNumber(curr); | 
|---|
|  |  |  | String locNo = String.valueOf(param.get("locNo")); | 
|---|
|  |  |  | if (!Cools.isEmpty(locNo) && !locNo.equals("null")) { | 
|---|
|  |  |  | bean.setLocNo(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("zpallet"))) { | 
|---|
|  |  |  | bean.setZpallet(String.valueOf(param.get("zpallet"))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Page<ViewStayTimeBean> page = new Page<>(curr, limit); | 
|---|
|  |  |  | IPage<ViewStayTimeBean> list = reportQueryMapper.queryViewStayTimeList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------站点日入出库次数统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewInOutList.action") | 
|---|
|  |  |  | public Map<String,Object> viewInOutList(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | ViewInOutBean bean = new ViewInOutBean(); | 
|---|
|  |  |  | bean.setPageSize(limit); | 
|---|
|  |  |  | bean.setPageNumber(curr); | 
|---|
|  |  |  | Page<ViewInOutBean> page = new Page<>(curr, limit); | 
|---|
|  |  |  | IPage<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 导出 | 
|---|
|  |  |  | @RequestMapping(value = "/viewStayTimeExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "库存滞留统计导出") | 
|---|
|  |  |  | public R viewStayTimeExport(@RequestBody JSONObject param) { | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | Map map = param.getObject("exportData", Map.class); | 
|---|
|  |  |  | List<ViewStayTimeBean> list = reportQueryMapper.getViewStayTimeAll(map); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------日入库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkInList.action") | 
|---|
|  |  |  | public Map<String,Object> viewWorkInList(ViewWorkInBean bean){ | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(1, 99999); | 
|---|
|  |  |  | IPage<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------站点日入出库次数统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewInOutList.action") | 
|---|
|  |  |  | public Map<String, Object> viewInOutList(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | ViewInOutBean bean = new ViewInOutBean(); | 
|---|
|  |  |  | bean.setPageSize(limit); | 
|---|
|  |  |  | bean.setPageNumber(curr); | 
|---|
|  |  |  | Page<ViewInOutBean> page = new Page<>(curr, limit); | 
|---|
|  |  |  | IPage<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------日出库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkOutList.action") | 
|---|
|  |  |  | public R viewWorkOutList(ViewWorkInBean bean){ | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(1, 99999); | 
|---|
|  |  |  | IPage<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------日入库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkInList.action") | 
|---|
|  |  |  | public Map<String, Object> viewWorkInList(ViewWorkInBean bean) { | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(bean.getPageNumber(), bean.getPageSize()); | 
|---|
|  |  |  | IPage<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //excel导出 | 
|---|
|  |  |  | @RequestMapping("/viewWorkInExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "日入库明细统计导出") | 
|---|
|  |  |  | public R viewWorkInExport(@RequestBody JSONObject param) { | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | @SuppressWarnings("unchecked") | 
|---|
|  |  |  | ViewWorkInBean bean = Cools.conver((Map<? extends String, ?>) param.get("exportData"), ViewWorkInBean.class); | 
|---|
|  |  |  | bean.setQueryDate(bean.getQueryDate()); | 
|---|
|  |  |  | Map map = JSON.parseObject(JSON.toJSONString(bean), Map.class); | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkInAll(map); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------日出库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkOutList.action") | 
|---|
|  |  |  | public R viewWorkOutList(ViewWorkInBean bean) { | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(bean.getPageNumber(), bean.getPageSize()); | 
|---|
|  |  |  | IPage<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(page, bean); | 
|---|
|  |  |  | return R.ok(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //excel导出 | 
|---|
|  |  |  | @RequestMapping("/viewWorkOutExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "日出库明细统计导出") | 
|---|
|  |  |  | public R viewWorkOutExport(@RequestBody JSONObject param) { | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | @SuppressWarnings("unchecked") | 
|---|
|  |  |  | ViewWorkInBean bean = Cools.conver((Map<? extends String, ?>) param.get("exportData"), ViewWorkInBean.class); | 
|---|
|  |  |  | bean.setQueryDate(bean.getQueryDate()); | 
|---|
|  |  |  | Map map = JSON.parseObject(JSON.toJSONString(bean), Map.class); | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkOutAll(map); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|