| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.AxisBean; |
| | | import com.zy.asrs.entity.ChartBean; |
| | | import com.zy.asrs.entity.LocChartPie; |
| | | import com.zy.asrs.entity.WorkCubeTotalAxis; |
| | | import com.zy.asrs.entity.WorkChartAxis; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.core.common.R; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | @Autowired |
| | | private ReportQueryMapper reportQueryMapper; |
| | | |
| | | @PostMapping("/pie") |
| | | public R pieStats(){ |
| | | // ViewStockUseBean bean = new ViewStockUseBean(); |
| | | // bean.setPageSize(65535); |
| | | // bean.setPageNumber(1); |
| | | // List<ViewStockUseBean> list= reportQueryMapper.queryViewStockUseList(bean); |
| | | // PieChartsVo pieVo = new PieChartsVo(); |
| | | // for (ViewStockUseBean one: list){ |
| | | // // 总库位 |
| | | // pieVo.setTotalQty(pieVo.getTotalQty() + one.getTotal_qty()); |
| | | // // 在库 |
| | | // pieVo.setFullQty(pieVo.getFullQty() + one.getFull_qty()); |
| | | // // 空闲 |
| | | // pieVo.setNullQty(pieVo.getNullQty() + one.getNull_qty()); |
| | | // // 禁用 |
| | | // pieVo.setForbidQty(pieVo.getForbidQty() + one.getForbid_qty()); |
| | | // // 使用 = 总 - 在库 - 空闲 - 禁用 |
| | | // pieVo.setOccQty(pieVo.getOccQty()+(one.getTotal_qty()-one.getFull_qty()-one.getNull_qty()-one.getForbid_qty())); |
| | | // } |
| | | // pieVo.complete(); |
| | | // System.out.println(JSON.toJSONString(pieVo)); |
| | | // return R.ok(pieVo); |
| | | String s = "{\"forbidDes\":\"禁用库位0.1%\",\"forbidQty\":2,\"fullDes\":\"在库库位44.4%\",\"fullQty\":1061,\"nullDes\":\"空库位47.2%\",\"nullQty\":1128,\"occDes\":\"使用库位8.4%\",\"occQty\":201,\"totalDes\":\"\",\"totalQty\":2392}\n"; |
| | | return R.ok(JSON.parse(s)); |
| | | } |
| | | |
| | | @PostMapping("loc/pie/charts") |
| | | public R dsa(){ |
| | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis(); |
| | | |
| | | if(listChart!=null) { |
| | | ArrayList<Integer> data1 = new ArrayList<Integer>(); |
| | | ArrayList<Integer> data2 = new ArrayList<Integer>(); |
| | | ArrayList<Number> data1 = new ArrayList<Number>(); |
| | | ArrayList<Number> data2 = new ArrayList<Number>(); |
| | | |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | |
| | | } |
| | | } |
| | | AxisBean inqty = new AxisBean(); |
| | | inqty.setName("入库数量"); |
| | | Integer[] array1 = new Integer[data1.size()]; |
| | | inqty.setName("入库托盘数"); |
| | | Number[] array1 = new Number[data1.size()]; |
| | | inqty.setData(data1.toArray(array1)); |
| | | list.add(inqty); |
| | | AxisBean outqty = new AxisBean(); |
| | | outqty.setName("出库数量"); |
| | | Integer[] array2 = new Integer[data2.size()]; |
| | | outqty.setName("出库托盘数"); |
| | | Number[] array2 = new Number[data2.size()]; |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | |
| | | AxisBean cube5 = new AxisBean(); |
| | | cube5.setName("5状态体积"); |
| | | AxisBean cube15 = new AxisBean(); |
| | | cube15.setName("15状态体积"); |
| | | List<WorkCubeTotalAxis> workCubeTotalAxes = reportQueryMapper.getCubeTotal(); |
| | | Map<String, WorkCubeTotalAxis> cubeMap = new HashMap<String, WorkCubeTotalAxis>(); |
| | | if (workCubeTotalAxes != null) { |
| | | for (WorkCubeTotalAxis w : workCubeTotalAxes) { |
| | | if (w.getYmd() != null) { |
| | | cubeMap.put(w.getYmd(), w); |
| | | } |
| | | } |
| | | } |
| | | ArrayList<Number> data4 = new ArrayList<Number>(); |
| | | ArrayList<Number> data5 = new ArrayList<Number>(); |
| | | SimpleDateFormat sfCube = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendarCube = Calendar.getInstance(); |
| | | calendarCube.add(Calendar.DATE, -12); |
| | | for (int i = 0; i < 12; i++) { |
| | | calendarCube.add(Calendar.DATE, 1); |
| | | String str = sfCube.format(calendarCube.getTime()); |
| | | WorkCubeTotalAxis cubeAxis = cubeMap.get(str); |
| | | data4.add(cubeAxis == null || cubeAxis.getCube5Total() == null ? 0 : cubeAxis.getCube5Total()); |
| | | data5.add(cubeAxis == null || cubeAxis.getCube15Total() == null ? 0 : cubeAxis.getCube15Total()); |
| | | } |
| | | Number[] array4 = new Number[data4.size()]; |
| | | cube5.setData(data4.toArray(array4)); |
| | | list.add(cube5); |
| | | Number[] array5 = new Number[data5.size()]; |
| | | cube15.setData(data5.toArray(array5)); |
| | | list.add(cube15); |
| | | } |
| | | map.put("rows",list); |
| | | return R.ok(map); |