|  |  |  | 
|---|
|  |  |  | package com.zy.asrs.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.plugins.Page; | 
|---|
|  |  |  | import com.core.annotations.ManagerAuth; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.common.DateUtils; | 
|---|
|  |  |  | import com.core.common.R; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.mapper.ReportQueryMapper; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 日志统计控制器层 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @author admin | 
|---|
|  |  |  | * @date 2018年11月23日 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping("/report") | 
|---|
|  |  |  | public class ReportQueryController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ReportQueryMapper reportQueryMapper; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private LocDetlService locDetlService; | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | List<ViewStockUseBean> list= reportQueryMapper.queryViewStockUseList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewStockUseCount(bean); | 
|---|
|  |  |  | Page<ViewStockUseBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------库位使用统计-------------------------------------- | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | List<ViewStockUseBean> list = reportQueryMapper.queryViewStockUseList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewStockUseCount(bean); | 
|---|
|  |  |  | Page<ViewStockUseBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 导出 | 
|---|
|  |  |  | @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)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 导出 | 
|---|
|  |  |  | @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)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------库存滞留统计-------------------------------------- | 
|---|
|  |  |  | @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.setLoc_no(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ViewStayTimeBean> list = reportQueryMapper.queryViewStayTimeList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewStayTimeCount(bean); | 
|---|
|  |  |  | Page<ViewStayTimeBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------库存滞留统计-------------------------------------- | 
|---|
|  |  |  | @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.setLoc_no(locNo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ViewStayTimeBean> list = reportQueryMapper.queryViewStayTimeList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewStayTimeCount(bean); | 
|---|
|  |  |  | Page<ViewStayTimeBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 导出 | 
|---|
|  |  |  | @RequestMapping(value = "/viewStayTimeExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "库存滞留统计导出") | 
|---|
|  |  |  | public R viewStayTimeExport(@RequestBody JSONObject param){ | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | List<ViewStayTimeBean> list = reportQueryMapper.getViewStayTimeAll(new ViewStayTimeBean()); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 导出 | 
|---|
|  |  |  | @RequestMapping(value = "/viewStayTimeExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "库存滞留统计导出") | 
|---|
|  |  |  | public R viewStayTimeExport(@RequestBody JSONObject param) { | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | List<ViewStayTimeBean> list = reportQueryMapper.getViewStayTimeAll(new ViewStayTimeBean()); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //-----------------库存MAP图-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewLocMapList/rows.action") | 
|---|
|  |  |  | public R queryViewLocMapRows(){ | 
|---|
|  |  |  | return R.ok().add(reportQueryMapper.getViewLocRowTotal()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //-----------------库存MAP图-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewLocMapList/rows.action") | 
|---|
|  |  |  | public R queryViewLocMapRows() { | 
|---|
|  |  |  | return R.ok().add(reportQueryMapper.getViewLocRowTotal()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping("/viewLocMapList.action") | 
|---|
|  |  |  | public R queryViewLocMapListByPages(@RequestParam(defaultValue = "1")Integer row){ | 
|---|
|  |  |  | // 获取排级数据 | 
|---|
|  |  |  | // 表格标题:列 ===>> 升序 | 
|---|
|  |  |  | List<String> bays = reportQueryMapper.getViewLocBayCount(row); | 
|---|
|  |  |  | // !表格第一列放层级数 | 
|---|
|  |  |  | bays.add(0, ""); | 
|---|
|  |  |  | // 表格行:层 ====>> 倒序 | 
|---|
|  |  |  | List<String> levs = reportQueryMapper.getViewLocLevCount(row); | 
|---|
|  |  |  | List<Map<String, Object>> body = new ArrayList<>(); | 
|---|
|  |  |  | for (String lev : levs){ | 
|---|
|  |  |  | // 获取层级数据 | 
|---|
|  |  |  | List<ViewLocMapDto> dtos = reportQueryMapper.getViewLocBays(row, Integer.parseInt(lev)); | 
|---|
|  |  |  | // !表格第一列放层级数 | 
|---|
|  |  |  | dtos.add(0, new ViewLocMapDto(null ,null, lev)); | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("loc", dtos); | 
|---|
|  |  |  | body.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String, Object> result = new HashMap<>(); | 
|---|
|  |  |  | result.put("title", bays); | 
|---|
|  |  |  | result.put("body", body); | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @RequestMapping("/viewLocMapList.action") | 
|---|
|  |  |  | public R queryViewLocMapListByPages(@RequestParam(defaultValue = "1") Integer row) { | 
|---|
|  |  |  | // 获取排级数据 | 
|---|
|  |  |  | // 表格标题:列 ===>> 升序 | 
|---|
|  |  |  | List<String> bays = reportQueryMapper.getViewLocBayCount(row); | 
|---|
|  |  |  | // !表格第一列放层级数 | 
|---|
|  |  |  | bays.add(0, ""); | 
|---|
|  |  |  | // 表格行:层 ====>> 倒序 | 
|---|
|  |  |  | List<String> levs = reportQueryMapper.getViewLocLevCount(row); | 
|---|
|  |  |  | List<Map<String, Object>> body = new ArrayList<>(); | 
|---|
|  |  |  | for (String lev : levs) { | 
|---|
|  |  |  | // 获取层级数据 | 
|---|
|  |  |  | List<ViewLocMapDto> dtos = reportQueryMapper.getViewLocBays(row, Integer.parseInt(lev)); | 
|---|
|  |  |  | // !表格第一列放层级数 | 
|---|
|  |  |  | dtos.add(0, new ViewLocMapDto(null, null, lev)); | 
|---|
|  |  |  | Map<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | map.put("loc", dtos); | 
|---|
|  |  |  | body.add(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String, Object> result = new HashMap<>(); | 
|---|
|  |  |  | result.put("title", bays); | 
|---|
|  |  |  | result.put("body", body); | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------站点日入出库次数统计-------------------------------------- | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewInOutCount(bean); | 
|---|
|  |  |  | Page<ViewInOutBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------站点日入出库次数统计-------------------------------------- | 
|---|
|  |  |  | @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); | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("modi_time"))) { | 
|---|
|  |  |  | String[] dates = param.get("modi_time").toString().split(RANGE_TIME_LINK); | 
|---|
|  |  |  | bean.setBegin_date(dates[0]); | 
|---|
|  |  |  | bean.setEnd_date(dates[1]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int count = 0; | 
|---|
|  |  |  | List<ViewInOutBean> list = new ArrayList<>(); | 
|---|
|  |  |  | if (param.get("type") == null || param.get("type").equals(1)) { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListDay(bean); | 
|---|
|  |  |  | count = reportQueryMapper.getViewInOutCountDay(bean); | 
|---|
|  |  |  | } else if (param.get("type").equals("2")) { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListMonth(bean); | 
|---|
|  |  |  | count = reportQueryMapper.getViewInOutCountMonth(bean); | 
|---|
|  |  |  | } else if (param.get("type").equals("3")) { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListYear(bean); | 
|---|
|  |  |  | count = reportQueryMapper.getViewInOutCountYear(bean); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListDay(bean); | 
|---|
|  |  |  | count = reportQueryMapper.getViewInOutCountDay(bean); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //      List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); | 
|---|
|  |  |  | Page<ViewInOutBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //excel导出 | 
|---|
|  |  |  | @RequestMapping("/viewInOutExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "站点日入出库次数统计导出") | 
|---|
|  |  |  | public R viewInOutExport(@RequestBody JSONObject param){ | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | List<ViewInOutBean> list = reportQueryMapper.getViewInOutAll(new ViewInOutBean()); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @RequestMapping("/viewInOutList/count") | 
|---|
|  |  |  | public R getAllCount() { | 
|---|
|  |  |  | ViewInOutBean bean = new ViewInOutBean(); | 
|---|
|  |  |  | bean.setPageSize(99999); | 
|---|
|  |  |  | bean.setPageNumber(1); | 
|---|
|  |  |  | List<ViewInOutBean> list = new ArrayList<>(); | 
|---|
|  |  |  | Map<String, Double> map = new HashMap<>(); | 
|---|
|  |  |  | Double in = 0.0; | 
|---|
|  |  |  | Double out = 0.0; | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListDay(bean); | 
|---|
|  |  |  | for (ViewInOutBean bean1 : list) { | 
|---|
|  |  |  | in += bean1.getSto_qty().doubleValue(); | 
|---|
|  |  |  | out += bean1.getRet_qty().doubleValue(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | map.put("in", in); | 
|---|
|  |  |  | map.put("out", out); | 
|---|
|  |  |  | return R.ok(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------日入库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkInList.action") | 
|---|
|  |  |  | public Map<String,Object> viewWorkInList(ViewWorkInBean bean){ | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewWorkInCount(bean); | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取库存总数 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/viewInOutList/date/count") | 
|---|
|  |  |  | public R getCount(@RequestBody Map<String, String> param) { | 
|---|
|  |  |  | ViewInOutBean bean = new ViewInOutBean(); | 
|---|
|  |  |  | bean.setPageSize(99999); | 
|---|
|  |  |  | bean.setPageNumber(1); | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("modi_time"))) { | 
|---|
|  |  |  | String[] dates = param.get("modi_time").toString().split(RANGE_TIME_LINK); | 
|---|
|  |  |  | bean.setBegin_date(dates[0]); | 
|---|
|  |  |  | bean.setEnd_date(dates[1]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Map<String, Double> map = new HashMap<>(); | 
|---|
|  |  |  | Double in = 0.0; | 
|---|
|  |  |  | Double out = 0.0; | 
|---|
|  |  |  | List<ViewInOutBean> list = new ArrayList<>(); | 
|---|
|  |  |  | if (param.get("type") == null || param.get("type").equals(1)) { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListDay(bean); | 
|---|
|  |  |  | } else if (param.get("type").equals("2")) { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListMonth(bean); | 
|---|
|  |  |  | } else if (param.get("type").equals("3")) { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListYear(bean); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | list = reportQueryMapper.queryViewInOutListDay(bean); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 日入库汇总查询 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/viewWorkCountInList.action") | 
|---|
|  |  |  | public R viewWorkCountInList(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | String startTime = "1970.1.2"; | 
|---|
|  |  |  | String endTime = "2099.1.2"; | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("query_date"))) { | 
|---|
|  |  |  | String  queryDate = (String) param.get("query_date"); | 
|---|
|  |  |  | String[] split = queryDate.split(" - "); | 
|---|
|  |  |  | startTime= split[0].split(" ")[0].replace("-","."); | 
|---|
|  |  |  | endTime = split[1].split(" ")[0].replace("-","."); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountIn(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime,endTime); | 
|---|
|  |  |  | Integer total = reportQueryMapper.selectWorkCountInTotal((String) param.get("matnr"), startTime,endTime); | 
|---|
|  |  |  | Page<ViewWorkCountInView> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(allCountIn); | 
|---|
|  |  |  | page.setTotal(total); | 
|---|
|  |  |  | Integer sum = reportQueryMapper.selectWorkCountInSum((String) param.get("matnr"), startTime,endTime); | 
|---|
|  |  |  | HashMap<String, Object> result = new HashMap<>(); | 
|---|
|  |  |  | result.put("page",page); | 
|---|
|  |  |  | result.put("sum",sum); | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | for (ViewInOutBean bean1 : list) { | 
|---|
|  |  |  | in += bean1.getSto_qty().doubleValue(); | 
|---|
|  |  |  | out += bean1.getRet_qty().doubleValue(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | map.put("in", in); | 
|---|
|  |  |  | map.put("out", out); | 
|---|
|  |  |  | return R.ok(map); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 日出库汇总 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/viewWorkCountOutList.action") | 
|---|
|  |  |  | public R viewWorkCountOutList(@RequestParam(defaultValue = "1")Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10")Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param){ | 
|---|
|  |  |  | String startTime = "1970.1.2"; | 
|---|
|  |  |  | String endTime = "2099.1.2"; | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("query_date"))) { | 
|---|
|  |  |  | String  queryDate = (String) param.get("query_date"); | 
|---|
|  |  |  | String[] split = queryDate.split(" - "); | 
|---|
|  |  |  | startTime= split[0].split(" ")[0].replace("-","."); | 
|---|
|  |  |  | endTime = split[1].split(" ")[0].replace("-","."); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountOut(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime,endTime); | 
|---|
|  |  |  | Integer total = reportQueryMapper.selectWorkCountOutTotal((String) param.get("matnr"), startTime,endTime); | 
|---|
|  |  |  | Page<ViewWorkCountInView> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(allCountIn); | 
|---|
|  |  |  | page.setTotal(total); | 
|---|
|  |  |  | Integer sum = reportQueryMapper.selectWorkCountOutSum((String) param.get("matnr"), startTime,endTime); | 
|---|
|  |  |  | HashMap<String, Object> result = new HashMap<>(); | 
|---|
|  |  |  | result.put("page",page); | 
|---|
|  |  |  | result.put("sum",sum); | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //excel导出 | 
|---|
|  |  |  | @RequestMapping("/viewInOutExport.action") | 
|---|
|  |  |  | @ManagerAuth(memo = "站点日入出库次数统计导出") | 
|---|
|  |  |  | public R viewInOutExport(@RequestBody JSONObject param) { | 
|---|
|  |  |  | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); | 
|---|
|  |  |  | List<ViewInOutBean> list = reportQueryMapper.getViewInOutAll(new ViewInOutBean()); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //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.setQuery_date(bean.getQuery_date()); | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkInAll(bean); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //------------------日入库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkInList.action") | 
|---|
|  |  |  | public Map<String, Object> viewWorkInList(ViewWorkInBean bean) { | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewWorkInCount(bean); | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------日出库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkOutList.action") | 
|---|
|  |  |  | public R viewWorkOutList(ViewWorkInBean bean){ | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewWorkOutCount(bean); | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 日入库汇总查询 | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/viewWorkCountInList.action") | 
|---|
|  |  |  | public R viewWorkCountInList(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | String startTime = "1970.1.2"; | 
|---|
|  |  |  | String endTime = "2099.1.2"; | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("query_date"))) { | 
|---|
|  |  |  | String queryDate = (String) param.get("query_date"); | 
|---|
|  |  |  | String[] split = queryDate.split(" - "); | 
|---|
|  |  |  | startTime = split[0].split(" ")[0].replace("-", "."); | 
|---|
|  |  |  | endTime = split[1].split(" ")[0].replace("-", "."); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountIn(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime, endTime); | 
|---|
|  |  |  | Integer total = reportQueryMapper.selectWorkCountInTotal((String) param.get("matnr"), startTime, endTime); | 
|---|
|  |  |  | Page<ViewWorkCountInView> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(allCountIn); | 
|---|
|  |  |  | page.setTotal(total); | 
|---|
|  |  |  | Integer sum = reportQueryMapper.selectWorkCountInSum((String) param.get("matnr"), startTime, endTime); | 
|---|
|  |  |  | HashMap<String, Object> result = new HashMap<>(); | 
|---|
|  |  |  | result.put("page", page); | 
|---|
|  |  |  | result.put("sum", sum); | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //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.setQuery_date(bean.getQuery_date()); | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkOutAll(bean); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 日出库汇总 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @RequestMapping("/viewWorkCountOutList.action") | 
|---|
|  |  |  | public R viewWorkCountOutList(@RequestParam(defaultValue = "1") Integer curr, | 
|---|
|  |  |  | @RequestParam(defaultValue = "10") Integer limit, | 
|---|
|  |  |  | @RequestParam Map<String, Object> param) { | 
|---|
|  |  |  | String startTime = "1970.1.2"; | 
|---|
|  |  |  | String endTime = "2099.1.2"; | 
|---|
|  |  |  | if (!Cools.isEmpty(param.get("query_date"))) { | 
|---|
|  |  |  | String queryDate = (String) param.get("query_date"); | 
|---|
|  |  |  | String[] split = queryDate.split(" - "); | 
|---|
|  |  |  | startTime = split[0].split(" ")[0].replace("-", "."); | 
|---|
|  |  |  | endTime = split[1].split(" ")[0].replace("-", "."); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountOut(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime, endTime); | 
|---|
|  |  |  | Integer total = reportQueryMapper.selectWorkCountOutTotal((String) param.get("matnr"), startTime, endTime); | 
|---|
|  |  |  | Page<ViewWorkCountInView> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(allCountIn); | 
|---|
|  |  |  | page.setTotal(total); | 
|---|
|  |  |  | Integer sum = reportQueryMapper.selectWorkCountOutSum((String) param.get("matnr"), startTime, endTime); | 
|---|
|  |  |  | HashMap<String, Object> result = new HashMap<>(); | 
|---|
|  |  |  | result.put("page", page); | 
|---|
|  |  |  | result.put("sum", sum); | 
|---|
|  |  |  | return R.ok(result); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //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.setQuery_date(bean.getQuery_date()); | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkInAll(bean); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //------------------日出库明细统计-------------------------------------- | 
|---|
|  |  |  | @RequestMapping("/viewWorkOutList.action") | 
|---|
|  |  |  | public R viewWorkOutList(ViewWorkInBean bean) { | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkOutList(bean); | 
|---|
|  |  |  | int count = reportQueryMapper.getViewWorkOutCount(bean); | 
|---|
|  |  |  | Page<ViewWorkInBean> page = new Page<>(); | 
|---|
|  |  |  | page.setRecords(list); | 
|---|
|  |  |  | page.setTotal(count); | 
|---|
|  |  |  | return R.ok(page); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //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.setQuery_date(bean.getQuery_date()); | 
|---|
|  |  |  | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkOutAll(bean); | 
|---|
|  |  |  | return R.ok(exportSupport(list, fields)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { | 
|---|
|  |  |  | for (Map.Entry<String, Object> entry : map.entrySet()) { | 
|---|
|  |  |  | String val = String.valueOf(entry.getValue()); | 
|---|
|  |  |  | if (val.contains(RANGE_TIME_LINK)) { | 
|---|
|  |  |  | String[] dates = val.split(RANGE_TIME_LINK); | 
|---|
|  |  |  | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); | 
|---|
|  |  |  | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | wrapper.like(entry.getKey(), val); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|