| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.common.web.BaseController; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | 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.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | @RequestMapping("/report") |
| | | public class ReportQueryController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | |
| | |
| | | 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<>(); |
| | |
| | | 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); |
| | | } |
| | | |
| | | /** |
| | | * 日出库汇总 |
| | | */ |
| | | @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); |
| | | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkInAll(new ViewWorkInBean()); |
| | | @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)); |
| | | } |
| | | |
| | |
| | | @ManagerAuth(memo = "日出库明细统计导出") |
| | | public R viewWorkOutExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<ViewWorkInBean> list = reportQueryMapper.getViewWorkOutAll(new ViewWorkInBean()); |
| | | @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)); |
| | | } |
| | | |