自动化立体仓库 - WMS系统
zhang
2025-05-11 a2887a248fdf3d67175529e9e687d8feef965466
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.zy.asrs.controller;
 
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.WorkChartAxis;
import com.zy.asrs.mapper.ReportQueryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.text.SimpleDateFormat;
import java.util.*;
 
/**
 * Created by vincent on 2020-05-23
 */
@RestController
@RequestMapping("/console")
public class ConsoleController {
 
    @Autowired
    private ReportQueryMapper reportQueryMapper;
 
    @PostMapping("loc/pie/charts")
    public R dsa(){
        Map<String,Object> map=new HashMap<String, Object>();
        List<ChartBean>  list = new ArrayList<ChartBean>();
 
        LocChartPie locUseRate = reportQueryMapper.getLocUseRate();
        if(locUseRate!=null) {
//            ChartBean fqty = new ChartBean();
//            fqty.setName("在库库位");
//            fqty.setY(locUseRate.getFqty());
//            list.add(fqty);
 
            ChartBean fqty1 = new ChartBean();
            fqty1.setName("单品在库"+locUseRate.getFqty1());
            fqty1.setY(locUseRate.getFqty1());
            list.add(fqty1);
 
            ChartBean fqty2 = new ChartBean();
            fqty2.setName("高频在库"+locUseRate.getFqty2());
            fqty2.setY(locUseRate.getFqty2());
            list.add(fqty2);
 
            ChartBean fqty3 = new ChartBean();
            fqty3.setName("低频在库"+locUseRate.getFqty3());
            fqty3.setY(locUseRate.getFqty3());
            list.add(fqty3);
 
//            ChartBean oqty = new ChartBean();
//            oqty.setName("空库位");
//            oqty.setY(locUseRate.getOqty());
//            list.add(oqty);
 
            ChartBean oqty1 = new ChartBean();
            oqty1.setName("单品空库位"+locUseRate.getOqty1());
            oqty1.setY(locUseRate.getOqty1());
            list.add(oqty1);
 
            ChartBean oqty2 = new ChartBean();
            oqty2.setName("高频空库位"+locUseRate.getOqty2());
            oqty2.setY(locUseRate.getOqty2());
            list.add(oqty2);
 
            ChartBean oqty3 = new ChartBean();
            oqty3.setName("低频空库位"+locUseRate.getOqty3());
            oqty3.setY(locUseRate.getOqty3());
            list.add(oqty3);
 
            ChartBean uqty = new ChartBean();
            uqty.setName("使用库位");
            uqty.setY(locUseRate.getUqty());
            list.add(uqty);
 
            ChartBean xqty = new ChartBean();
            xqty.setName("禁用库位");
            xqty.setY(locUseRate.getXqty());
            list.add(xqty);
        }
        map.put("rows",list);
        return R.ok(map);
    }
 
    @PostMapping("locIo/line/charts")
    public R locIoLineCharts(){
        Map<String,Object> map=new HashMap<String, Object>();
        List<AxisBean> list = new ArrayList<AxisBean>();
 
        List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis();
 
        if(listChart!=null) {
            ArrayList<Integer> data1 = new ArrayList<Integer>();
            ArrayList<Integer> data2 = new ArrayList<Integer>();
 
            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DATE, -12);
            for(int i=0;i<12;i++) {
                boolean flag = true;
                calendar.add(Calendar.DATE, 1);
                String str = sf.format(calendar.getTime());
                for(WorkChartAxis workChart : listChart) {
                    if(str.equals(workChart.getYmd())) {
                        data1.add(workChart.getInqty());
                        data2.add(workChart.getOutqty());
                        flag = false;
                        break;
                    }
                }
                if(flag) {
                    data1.add(0);
                    data2.add(0);
                }
            }
            AxisBean inqty = new AxisBean();
            inqty.setName("入库数量");
            Integer[] array1 = new Integer[data1.size()];
            inqty.setData(data1.toArray(array1));
            list.add(inqty);
            AxisBean outqty = new AxisBean();
            outqty.setName("出库数量");
            Integer[] array2 = new Integer[data2.size()];
            outqty.setData(data2.toArray(array2));
            list.add(outqty);
        }
        map.put("rows",list);
        return R.ok(map);
    }
 
 
 
 
}