Commit 416dc07317a72da5e29946fdbef7b5bea22bd519
1 parent
11db90fe
首页移植完成
Showing
6 changed files
with
705 additions
and
30 deletions
jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js
@@ -44,6 +44,8 @@ const queryParentName = (params)=>getAction("/sys/sysDepart/queryParentName",p | @@ -44,6 +44,8 @@ const queryParentName = (params)=>getAction("/sys/sysDepart/queryParentName",p | ||
44 | const searchByKeywords = (params)=>getAction("/sys/sysDepart/searchBy",params); | 44 | const searchByKeywords = (params)=>getAction("/sys/sysDepart/searchBy",params); |
45 | const deleteByDepartId = (params)=>deleteAction("/sys/sysDepart/delete",params); | 45 | const deleteByDepartId = (params)=>deleteAction("/sys/sysDepart/delete",params); |
46 | 46 | ||
47 | + | ||
48 | + | ||
47 | //二级部门管理 | 49 | //二级部门管理 |
48 | const queryDepartPermission = (params)=>getAction("/sys/permission/queryDepartPermission",params); | 50 | const queryDepartPermission = (params)=>getAction("/sys/permission/queryDepartPermission",params); |
49 | const saveDepartPermission = (params)=>postAction("/sys/permission/saveDepartPermission",params); | 51 | const saveDepartPermission = (params)=>postAction("/sys/permission/saveDepartPermission",params); |
@@ -171,7 +173,12 @@ export const combination = (params)=>postAction('/shipment/shipmentCombination/c | @@ -171,7 +173,12 @@ export const combination = (params)=>postAction('/shipment/shipmentCombination/c | ||
171 | export const backErpReceipt = (params)=>postAction('/receipt/receiptHeader/backErpReceipt', params); | 173 | export const backErpReceipt = (params)=>postAction('/receipt/receiptHeader/backErpReceipt', params); |
172 | //回传出库单 | 174 | //回传出库单 |
173 | export const backErpShipment = (params)=>postAction('/shipment/shipmentHeader/backErpShipment', params); | 175 | export const backErpShipment = (params)=>postAction('/shipment/shipmentHeader/backErpShipment', params); |
174 | - | 176 | +//首页取值 |
177 | +export const deliveringAmount = (params)=>postAction("/sys/home/deliveringAmount",params); | ||
178 | +export const inventoryUtilization = (params)=>postAction("/sys/home/inventoryUtilization",params); | ||
179 | +export const inventoryStatus = (params)=>postAction("/sys/home/inventoryStatus",params); | ||
180 | +export const inventoryOverview = (params)=>postAction("/sys/home/inventoryOverview",params); | ||
181 | +export const getCommonData = (params)=>postAction("/sys/home/getCommonData",params); | ||
175 | // 中转HTTP请求 | 182 | // 中转HTTP请求 |
176 | export const transitRESTful = { | 183 | export const transitRESTful = { |
177 | get: (url, parameter) => getAction(getTransitURL(url), parameter), | 184 | get: (url, parameter) => getAction(getTransitURL(url), parameter), |
jeecg-boot-master/ant-design-vue-jeecg/src/views/dashboard/Analysis.vue
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <index-chart v-if="indexStyle==1"></index-chart> | ||
4 | - <index-bdc v-if="indexStyle==2"></index-bdc> | ||
5 | - <index-task v-if="indexStyle==3"></index-task> | ||
6 | - <div style="width: 100%;text-align: right;margin-top: 20px"> | ||
7 | - 请选择首页样式: | ||
8 | - <a-radio-group v-model="indexStyle"> | ||
9 | - <a-radio :value="1">统计图表</a-radio> | ||
10 | - <a-radio :value="2">统计图表2</a-radio> | ||
11 | - <a-radio :value="3">任务表格</a-radio> | ||
12 | - </a-radio-group> | ||
13 | - </div> | 3 | + <a-row :gutter="24"> |
4 | + | ||
5 | + <div class="col-sm-2" style="padding:5px;"> | ||
6 | + <a class="menuItem" href="/wms/inventory/inventoryTransaction"> | ||
7 | + | ||
8 | + <div class="total_box ys01"> | ||
9 | + <h1>{{s1}}</h1> | ||
10 | + <p>今日库存交易量</p> | ||
11 | + </div> | ||
12 | + </a> | ||
13 | + </div> | ||
14 | + <div class="col-sm-2" style="padding:5px;"> | ||
15 | + <a class="menuItem" href="/wms/receipt/receiptHeader/900/0"> | ||
16 | + <div class="total_box ys02"> | ||
17 | + <h1>{{s2}}</h1> | ||
18 | + <p>今日入库量</p> | ||
19 | + </div> | ||
20 | + </a> | ||
21 | + </div> | ||
22 | + <div class="col-sm-2" style="padding:5px;"> | ||
23 | + <a class="menuItem" href="/wms/shipment/shipmentHeader"> | ||
24 | + <div class="total_box ys03"> | ||
25 | + <h1>{{s3}}</h1> | ||
26 | + <p>今日出库量</p> | ||
27 | + </div> | ||
28 | + </a> | ||
29 | + </div> | ||
30 | + <div class="col-sm-2" style="padding:5px;"> | ||
31 | + <a class="menuItem" href="/wms/inventory/inventoryHeader"> | ||
32 | + <div class="total_box ys04"> | ||
33 | + <h1>{{s4}}</h1> | ||
34 | + <p>库存总量</p> | ||
35 | + </div> | ||
36 | + </a> | ||
37 | + </div> | ||
38 | + <div class="col-sm-2" style="padding:5px;"> | ||
39 | + <a class="menuItem" href="/wms/inventory/inventoryMaterialSummary"> | ||
40 | + <div class="total_box ys05"> | ||
41 | + <h1>{{s5}}</h1> | ||
42 | + <p>库内物料品数</p> | ||
43 | + </div> | ||
44 | + </a> | ||
45 | + </div> | ||
46 | + <div class="col-sm-2" style="padding:5px;"> | ||
47 | + <a class="menuItem" href="/wms/task/taskHeader?InternalTaskType=100"> | ||
48 | + <div class="total_box ys06"> | ||
49 | + <h1>{{s6}}</h1> | ||
50 | + <p>待执行任务数</p> | ||
51 | + </div> | ||
52 | + </a> | ||
53 | + </div> | ||
54 | + | ||
55 | + </a-row> | ||
56 | + | ||
57 | + | ||
58 | + <a-row :gutter="24"> | ||
59 | + <a-col :span="12"> | ||
60 | + <a-card :loading="loading" :bordered="false" title="历史每日收发货量" :style="{ marginTop: '24px' }"> | ||
61 | + <a-row> | ||
62 | + <a-col :span="19"> | ||
63 | + <div id="chart1" class="flot-chart1"> | ||
64 | + 这里放图表 | ||
65 | + </div> | ||
66 | + </a-col> | ||
67 | + </a-row> | ||
68 | + <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid> | ||
69 | + </a-card> | ||
70 | + </a-col> | ||
71 | + <a-col :span="12"> | ||
72 | + <a-card :loading="loading" :bordered="false" title="库位利用率" :style="{ marginTop: '24px' }"> | ||
73 | + <a-row> | ||
74 | + <a-col :span="19"> | ||
75 | + <div id="chart2" class="flot-chart1"> | ||
76 | + 这里放图表 | ||
77 | + </div> | ||
78 | + </a-col> | ||
79 | + </a-row> | ||
80 | + <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid> | ||
81 | + </a-card> | ||
82 | + </a-col> | ||
83 | + </a-row> | ||
84 | + | ||
85 | + | ||
86 | + <a-row :gutter="24"> | ||
87 | + <a-col :span="12"> | ||
88 | + <a-card :loading="loading" :bordered="false" title="在线库存状态" :style="{ marginTop: '24px' }"> | ||
89 | + <a-row> | ||
90 | + <a-col :span="19"> | ||
91 | + <div id="chart3" class="flot-chart1"> | ||
92 | + 这里放图表 | ||
93 | + </div> | ||
94 | + </a-col> | ||
95 | + </a-row> | ||
96 | + <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid> | ||
97 | + </a-card> | ||
98 | + </a-col> | ||
99 | + <a-col :span="12"> | ||
100 | + <a-card :loading="loading" :bordered="false" title="库存概况" :style="{ marginTop: '24px' }"> | ||
101 | + <a-row> | ||
102 | + <a-col :span="19"> | ||
103 | + <div id="chart4" class="flot-chart1"> | ||
104 | + 这里放图表 | ||
105 | + </div> | ||
106 | + </a-col> | ||
107 | + </a-row> | ||
108 | + <line-chart-multid :fields="visitFields" :dataSource="visitInfo"></line-chart-multid> | ||
109 | + </a-card> | ||
110 | + </a-col> | ||
111 | + </a-row> | ||
112 | + | ||
113 | + | ||
14 | </div> | 114 | </div> |
15 | </template> | 115 | </template> |
16 | 116 | ||
17 | -<script> | ||
18 | - import IndexChart from './IndexChart' | ||
19 | - import IndexTask from "./IndexTask" | ||
20 | - import IndexBdc from './IndexBdc' | ||
21 | - | 117 | +<script language = "javascript" type = "text/javascript"> |
118 | + import {inventoryOverview,deliveringAmount,inventoryUtilization,inventoryStatus,getCommonData} from '@/api/api' | ||
22 | export default { | 119 | export default { |
23 | - name: "Analysis", | ||
24 | - components: { | ||
25 | - IndexChart, | ||
26 | - IndexTask, | ||
27 | - IndexBdc | ||
28 | - }, | ||
29 | - data() { | ||
30 | - return { | ||
31 | - indexStyle:1 | 120 | + name: 'Echartdemo', |
121 | + data(){ | ||
122 | + return{ | ||
123 | + msg: 'EChart demo', | ||
124 | + s1:"0", | ||
125 | + s2:"0", | ||
126 | + s3:"0", | ||
127 | + s4:"0", | ||
128 | + s5:"0", | ||
129 | + s6:"0" | ||
32 | } | 130 | } |
33 | }, | 131 | }, |
34 | - created() { | ||
35 | - | 132 | + mounted(){ |
133 | + this.drawLine(); | ||
36 | }, | 134 | }, |
37 | methods: { | 135 | methods: { |
136 | + drawLine(){ | ||
137 | + let chart1 = this.$echarts.init(document.getElementById('chart1')) | ||
138 | + let chart2 = this.$echarts.init(document.getElementById('chart2')) | ||
139 | + let chart3 = this.$echarts.init(document.getElementById('chart3')) | ||
140 | + let chart4 = this.$echarts.init(document.getElementById('chart4')) | ||
141 | + | ||
142 | + | ||
143 | + debugger; | ||
144 | + deliveringAmount().then((res) => { | ||
145 | + if (res.success) { | ||
146 | + chart1.setOption(JSON.parse(res.message)); | ||
147 | + } | ||
148 | + }) | ||
149 | + inventoryUtilization().then((res) => { | ||
150 | + if (res.success) { | ||
151 | + chart2.setOption(JSON.parse(res.message)); | ||
152 | + } | ||
153 | + }) | ||
154 | + inventoryStatus().then((res) => { | ||
155 | + if (res.success) { | ||
156 | + chart3.setOption(JSON.parse(res.message)); | ||
157 | + } | ||
158 | + }) | ||
159 | + inventoryOverview().then((res) => { | ||
160 | + if (res.success) { | ||
161 | + chart4.setOption(JSON.parse(res.message)); | ||
162 | + } | ||
163 | + }) | ||
164 | + getCommonData().then((res) => { | ||
165 | + if (res.success) { | ||
166 | + this.s1=res.result.bllCount | ||
167 | + this.s2=res.result.receiptTotal | ||
168 | + this.s3=res.result.shipmentTotal | ||
169 | + this.s4=res.result.inventoryTotal | ||
170 | + this.s5=res.result.materialCount | ||
171 | + this.s6=res.result.taskUncompletedTotal | ||
172 | + } | ||
173 | + }) | ||
174 | + | ||
175 | + } | ||
176 | + } | ||
177 | + } | ||
178 | +</script> | ||
38 | 179 | ||
180 | +<style scoped> | ||
181 | + @media (min-width: 768px) { | ||
182 | + .col-sm-2 { | ||
183 | + float: left | ||
39 | } | 184 | } |
185 | + .col-sm-2 { | ||
186 | + width: 16.66666667% | ||
187 | + } | ||
188 | + | ||
189 | + } | ||
190 | + .panel-heading h1, .panel-heading h2 { | ||
191 | + margin-bottom: 5px | ||
192 | + } | ||
193 | + | ||
194 | + .ibox-content h1, .ibox-content h2, .ibox-content h3, .ibox-content h4, .ibox-content h5, .ibox-title h1, .ibox-title h2, .ibox-title h3, .ibox-title h4, .ibox-title h5 { | ||
195 | + margin-top: 5px | ||
196 | + } | ||
197 | + | ||
198 | + h1 { | ||
199 | + font-size: 30px; | ||
200 | + color:#fff; | ||
201 | + } | ||
202 | + | ||
203 | + .total_box{ | ||
204 | + text-align:center; | ||
205 | + color:#fff; | ||
206 | + padding:8px 0 10px 0; | ||
207 | + } | ||
208 | + .total_box:hover{ | ||
209 | + opacity:0.8; | ||
210 | + } | ||
211 | + .ys01{ | ||
212 | + background:#1ab394; | ||
213 | + } | ||
214 | + .ys02{ | ||
215 | + background:#23c6c8; | ||
216 | + } | ||
217 | + .ys03{ | ||
218 | + background:#1c84c6; | ||
219 | + } | ||
220 | + .ys04{ | ||
221 | + background:#8d95c5; | ||
222 | + } | ||
223 | + .ys05{ | ||
224 | + background:#e59aa6; | ||
225 | + } | ||
226 | + .ys06{ | ||
227 | + background:#f8ac59; | ||
228 | + } | ||
229 | + .flot-chart1{ | ||
230 | + height:290px; | ||
40 | } | 231 | } |
41 | -</script> | ||
42 | \ No newline at end of file | 232 | \ No newline at end of file |
233 | +</style> | ||
43 | \ No newline at end of file | 234 | \ No newline at end of file |
jeecg-boot-master/ant-design-vue-jeecg/src/views/dashboard/Analysisbak.vue
0 → 100644
1 | +<template> | ||
2 | +<!-- 原首页文件备份--> | ||
3 | + <div> | ||
4 | + <index-chart v-if="indexStyle==1"></index-chart> | ||
5 | + <index-bdc v-if="indexStyle==2"></index-bdc> | ||
6 | + <index-task v-if="indexStyle==3"></index-task> | ||
7 | + <div style="width: 100%;text-align: right;margin-top: 20px"> | ||
8 | + 请选择首页样式: | ||
9 | + <a-radio-group v-model="indexStyle"> | ||
10 | + <a-radio :value="1">统计图表</a-radio> | ||
11 | + <a-radio :value="2">统计图表2</a-radio> | ||
12 | + <a-radio :value="3">任务表格</a-radio> | ||
13 | + </a-radio-group> | ||
14 | + </div> | ||
15 | + </div> | ||
16 | +</template> | ||
17 | + | ||
18 | +<script> | ||
19 | + import IndexChart from './IndexChart' | ||
20 | + import IndexTask from "./IndexTask" | ||
21 | + import IndexBdc from './IndexBdc' | ||
22 | + | ||
23 | + export default { | ||
24 | + name: "Analysis", | ||
25 | + components: { | ||
26 | + IndexChart, | ||
27 | + IndexTask, | ||
28 | + IndexBdc | ||
29 | + }, | ||
30 | + data() { | ||
31 | + return { | ||
32 | + indexStyle:1 | ||
33 | + } | ||
34 | + }, | ||
35 | + created() { | ||
36 | + | ||
37 | + }, | ||
38 | + methods: { | ||
39 | + | ||
40 | + } | ||
41 | + } | ||
42 | +</script> | ||
0 | \ No newline at end of file | 43 | \ No newline at end of file |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/pom.xml
@@ -34,6 +34,11 @@ | @@ -34,6 +34,11 @@ | ||
34 | <groupId>org.jeecgframework.boot</groupId> | 34 | <groupId>org.jeecgframework.boot</groupId> |
35 | <artifactId>jeecg-system-local-api</artifactId> | 35 | <artifactId>jeecg-system-local-api</artifactId> |
36 | </dependency> | 36 | </dependency> |
37 | + <dependency> | ||
38 | + <groupId>com.github.abel533</groupId> | ||
39 | + <artifactId>ECharts</artifactId> | ||
40 | + <version>3.0.0.5</version> | ||
41 | + </dependency> | ||
37 | <!-- jeewx api --> | 42 | <!-- jeewx api --> |
38 | <dependency> | 43 | <dependency> |
39 | <groupId>org.jeecgframework</groupId> | 44 | <groupId>org.jeecgframework</groupId> |
@@ -79,4 +84,4 @@ | @@ -79,4 +84,4 @@ | ||
79 | </plugin> | 84 | </plugin> |
80 | </plugins> | 85 | </plugins> |
81 | </build> | 86 | </build> |
82 | -</project> | ||
83 | \ No newline at end of file | 87 | \ No newline at end of file |
88 | +</project> |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/home/controller/HomePageViewController.java
0 → 100644
1 | +package org.jeecg.modules.wms.home.controller; | ||
2 | + | ||
3 | +import cn.hutool.core.util.ArrayUtil; | ||
4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
5 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
6 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
7 | +import lombok.extern.slf4j.Slf4j; | ||
8 | +import org.jeecg.common.api.vo.Result; | ||
9 | +import org.jeecg.modules.system.entity.SysDictItem; | ||
10 | +import org.jeecg.modules.system.service.impl.SysDictItemServiceImpl; | ||
11 | +import org.jeecg.modules.wms.config.location.entity.Location; | ||
12 | +import org.jeecg.modules.wms.config.location.service.impl.LocationServiceImpl; | ||
13 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | ||
14 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | ||
15 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryDetailServiceImpl; | ||
16 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryHeaderServiceImpl; | ||
17 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
18 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.impl.ReceiptHeaderServiceImpl; | ||
19 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
20 | +import com.github.abel533.echarts.Option; | ||
21 | +import com.github.abel533.echarts.axis.Axis; | ||
22 | +import com.github.abel533.echarts.axis.CategoryAxis; | ||
23 | +import com.github.abel533.echarts.axis.ValueAxis; | ||
24 | +import com.github.abel533.echarts.code.*; | ||
25 | +import com.github.abel533.echarts.json.GsonUtil; | ||
26 | +import com.github.abel533.echarts.series.Line; | ||
27 | +import com.github.abel533.echarts.series.Pie; | ||
28 | +import com.github.abel533.echarts.style.itemstyle.Normal; | ||
29 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.impl.ShipmentHeaderServiceImpl; | ||
30 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; | ||
31 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | ||
32 | +import org.jeecg.modules.wms.task.taskHeader.service.impl.TaskDetailServiceImpl; | ||
33 | +import org.jeecg.modules.wms.task.taskHeader.service.impl.TaskHeaderServiceImpl; | ||
34 | +import org.jeecg.utils.StringUtils; | ||
35 | +import org.jeecg.modules.wms.home.support.ChartData; | ||
36 | +import org.jeecg.utils.constant.QuantityConstant; | ||
37 | +import org.jeecg.utils.support.Convert; | ||
38 | +import org.springframework.web.bind.annotation.*; | ||
39 | + | ||
40 | +import javax.annotation.Resource; | ||
41 | +import java.math.BigDecimal; | ||
42 | +import java.text.SimpleDateFormat; | ||
43 | +import java.util.*; | ||
44 | +import java.util.stream.Collectors; | ||
45 | + | ||
46 | +/** | ||
47 | + * @Description: 首页视图 | ||
48 | + * @Author lty | ||
49 | + * @Date 2023/1/9 | ||
50 | + */ | ||
51 | +@RestController | ||
52 | +@RequestMapping("/sys/home") | ||
53 | +@Slf4j | ||
54 | +public class HomePageViewController { | ||
55 | + | ||
56 | + | ||
57 | + @Resource | ||
58 | + ShipmentHeaderServiceImpl shipmentHeaderServiceImpl; | ||
59 | + @Resource | ||
60 | + ReceiptHeaderServiceImpl receiptHeaderServiceImpl; | ||
61 | + @Resource | ||
62 | + SysDictItemServiceImpl sysDictItemServiceImpl; | ||
63 | + @Resource | ||
64 | + LocationServiceImpl locationServiceImpl; | ||
65 | + @Resource | ||
66 | + InventoryDetailServiceImpl inventoryDetailServiceImpl; | ||
67 | + @Resource | ||
68 | + InventoryHeaderServiceImpl inventoryHeaderServiceImpl; | ||
69 | + @Resource | ||
70 | + TaskDetailServiceImpl taskDetailServiceImpl; | ||
71 | + @Resource | ||
72 | + TaskHeaderServiceImpl taskHeaderService; | ||
73 | + | ||
74 | + | ||
75 | + /** | ||
76 | + * 库存概况 | ||
77 | + * @return | ||
78 | + */ | ||
79 | + @RequestMapping(value = "/deliveringAmount", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
80 | + public Result<String> deliveringAmount() { | ||
81 | + //查询出库单的7天出库量 | ||
82 | + LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
83 | + shipmentHeaderLambdaQueryWrapper | ||
84 | + .select(ShipmentHeader::getCreateTime,ShipmentHeader::getTotalQty); | ||
85 | + List<ShipmentHeader> shipmentHeaders = shipmentHeaderServiceImpl.list(shipmentHeaderLambdaQueryWrapper); | ||
86 | + LinkedHashMap<String, String> list = new LinkedHashMap<>(); | ||
87 | + | ||
88 | + for (int i=6;i>=0;i--) | ||
89 | + { | ||
90 | + List<ShipmentHeader> shipmentHeadersCop = shipmentHeaders; | ||
91 | + String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() -(1000 * 60 * 60 * 24)*i).toString(); | ||
92 | + List<ShipmentHeader> collect = shipmentHeadersCop.stream().filter(shipmentHeader -> new SimpleDateFormat("yyyy-MM-dd").format(shipmentHeader.getCreateTime()).toString().contains(today)).collect(Collectors.toList()); | ||
93 | + list.put(today, String.valueOf(collect.size())); | ||
94 | + } | ||
95 | + | ||
96 | + | ||
97 | + //查询入库单的7天入库量 | ||
98 | + LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
99 | + receiptHeaderLambdaQueryWrapper | ||
100 | + .select(ReceiptHeader::getCreateTime,ReceiptHeader::getTotalqty); | ||
101 | + List<ReceiptHeader> receiptHeaders = receiptHeaderServiceImpl.list(receiptHeaderLambdaQueryWrapper); | ||
102 | + LinkedHashMap<String, String> list2 = new LinkedHashMap<>(); | ||
103 | + for (int i=6;i>=0;i--) | ||
104 | + { | ||
105 | + List<ReceiptHeader> receiptHeadersCop = receiptHeaders; | ||
106 | + String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() -(1000 * 60 * 60 * 24)*i).toString(); | ||
107 | + List<ReceiptHeader> collect = receiptHeadersCop.stream().filter(ReceiptHeader -> new SimpleDateFormat("yyyy-MM-dd").format(ReceiptHeader.getCreateTime()).toString().contains(today)).collect(Collectors.toList()); | ||
108 | + list2.put(today, String.valueOf(collect.size())); | ||
109 | + } | ||
110 | + | ||
111 | + Option option = new Option(); | ||
112 | + option.tooltip().trigger(Trigger.axis).axisPointer().type(PointerType.cross); | ||
113 | + option.grid().setLeft("3%"); | ||
114 | + option.grid().setRight("4%"); | ||
115 | + option.grid().setBottom("3%"); | ||
116 | + List<Object> content = new ArrayList<>(); | ||
117 | + content.add("#c23531"); | ||
118 | + content.add("#2f4554"); | ||
119 | + option.setColor(content); | ||
120 | + option.grid().containLabel(true); | ||
121 | + option.legend().data().add("收货量"); | ||
122 | + option.legend().data().add("发货量"); | ||
123 | + Map<Object, Object> map = new HashMap<>(); | ||
124 | + Axis axis = new CategoryAxis() ; | ||
125 | + axis.boundaryGap(false); | ||
126 | + Line line = new Line(); | ||
127 | + line.setName("发货量"); | ||
128 | + for (String key : list.keySet()) { | ||
129 | + Object o1 = key; | ||
130 | + Object o2 = list.get(key); | ||
131 | + axis.data().add(o1); | ||
132 | + line.data().add(o2); | ||
133 | + } | ||
134 | + | ||
135 | + Line line2 = new Line(); | ||
136 | + line2.setName("收货量"); | ||
137 | + for (String key : list2.keySet()) { | ||
138 | + Object o1 = key; | ||
139 | + Object o2 = list2.get(key); | ||
140 | + line2.data().add(o2); | ||
141 | + } | ||
142 | + | ||
143 | + | ||
144 | + option.setxAxis(Arrays.asList(axis)); | ||
145 | + ValueAxis yAxis = new ValueAxis(); | ||
146 | + option.setyAxis(Arrays.asList(yAxis)); | ||
147 | + option.series(line,line2); | ||
148 | + String format = GsonUtil.format(option); | ||
149 | + return Result.ok(GsonUtil.format(option)); | ||
150 | + } | ||
151 | + | ||
152 | + | ||
153 | + /** | ||
154 | + * 库位利用率 | ||
155 | + * @return | ||
156 | + */ | ||
157 | + @RequestMapping(value = "/inventoryUtilization", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
158 | + public Result<String> inventoryUtilization() { | ||
159 | + | ||
160 | + //查询所有容器 select限制字段速度更快 | ||
161 | + LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
162 | + locationLambdaQueryWrapper.select(Location::getContainerCode); | ||
163 | + List<Location> locations = locationServiceImpl.list(locationLambdaQueryWrapper); | ||
164 | + | ||
165 | + //先存储总数 | ||
166 | + int inStock=locations.size(); | ||
167 | + | ||
168 | + //删除为空的数量 | ||
169 | + locations.removeIf(location -> StringUtils.isEmpty(location.getContainerCode())); | ||
170 | + | ||
171 | + //有货数量 总数-无货数量 | ||
172 | + inStock=inStock-locations.size(); | ||
173 | + | ||
174 | + Option option = new Option(); | ||
175 | +// option.title("库存状态分布").title().x("center"); | ||
176 | + option.tooltip(Trigger.item).tooltip().formatter("{a} <br/>{b} : {c} ({d}%)"); | ||
177 | + option.legend().setOrient(Orient.vertical); | ||
178 | + option.legend().setRight(10); | ||
179 | + option.legend().setTop(20); | ||
180 | + option.legend().setBottom(20); | ||
181 | + option.legend().setData(new ArrayList<String>()); | ||
182 | + List<Object> content = new ArrayList<>(); | ||
183 | + content.add("#c23531"); | ||
184 | + content.add("#2f4554"); | ||
185 | + option.setColor(content); | ||
186 | + Pie pie = new Pie(); | ||
187 | + pie.setName("货位状态"); | ||
188 | + pie.setType(SeriesType.pie); | ||
189 | + pie.setRadius("55%"); | ||
190 | + pie.setCenter(new String[]{"40%","50%"}); | ||
191 | + Normal normal = new Normal(); | ||
192 | + normal.setFormatter("{b} \n {c} ({d}%)"); | ||
193 | + normal.setBarBorderColor("#eee"); | ||
194 | + normal.setBorderWidth(1); | ||
195 | + normal.setBorderRadius(4); | ||
196 | + pie.label().normal(normal); | ||
197 | + pie.itemStyle().emphasis().setShadowBlur(10); | ||
198 | + pie.itemStyle().emphasis().setShadowOffsetX(0); | ||
199 | + pie.itemStyle().emphasis().setShadowColor("rgba(0, 0, 0, 0.4)"); | ||
200 | + | ||
201 | + option.legend().data().add("有货"); | ||
202 | + pie.data().add(new ChartData("有货", Convert.toDouble(inStock))); | ||
203 | + | ||
204 | + option.legend().data().add("无货"); | ||
205 | + pie.data().add(new ChartData("无货", Convert.toDouble(locations.size()))); | ||
206 | + | ||
207 | + option.series(pie); | ||
208 | + String format = GsonUtil.format(option); | ||
209 | + return Result.ok(GsonUtil.format(option)); | ||
210 | + } | ||
211 | + | ||
212 | + | ||
213 | + /** | ||
214 | + * 在线库存状态 | ||
215 | + * @return | ||
216 | + */ | ||
217 | + @RequestMapping(value = "/inventoryStatus", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
218 | + public Result<String> inventoryStatus() { | ||
219 | + Option option = new Option(); | ||
220 | + option.tooltip(Trigger.item).tooltip().formatter("{a} <br/>{b} : {c} ({d}%)"); | ||
221 | + option.legend().setOrient(Orient.vertical); | ||
222 | + option.legend().setRight(10); | ||
223 | + option.legend().setTop(20); | ||
224 | + option.legend().setBottom(10); | ||
225 | + option.legend().setData(new ArrayList<String>()); | ||
226 | + List<Object> content = new ArrayList<>(); | ||
227 | + content.add("#c23531"); | ||
228 | + content.add("#2f4554"); | ||
229 | + option.setColor(content); | ||
230 | + | ||
231 | + Pie pie = new Pie(); | ||
232 | + pie.setName("库存状态"); | ||
233 | + pie.setType(SeriesType.pie); | ||
234 | + pie.setRadius("70%"); | ||
235 | + pie.setCenter(new String[]{"40%","50%"}); | ||
236 | + Normal normal = new Normal(); | ||
237 | + normal.setFormatter("{b} \n {c} ({d}%)"); | ||
238 | + normal.setBarBorderColor("#eee"); | ||
239 | + normal.setBorderWidth(1); | ||
240 | + normal.setBorderRadius(4); | ||
241 | + pie.label().normal(normal); | ||
242 | + pie.itemStyle().emphasis().setShadowBlur(10); | ||
243 | + pie.itemStyle().emphasis().setShadowOffsetX(0); | ||
244 | + pie.itemStyle().emphasis().setShadowColor("rgba(0, 0, 0, 0.4)"); | ||
245 | + | ||
246 | + | ||
247 | + QueryWrapper<InventoryDetail> queryWrapper = new QueryWrapper<>(); | ||
248 | + queryWrapper.select("inventory_status ,SUM(qty) qty") | ||
249 | + .eq("warehouse_code", "CS0001").groupBy("inventory_status"); | ||
250 | + List<InventoryDetail> inventoryDetails = inventoryDetailServiceImpl.list(queryWrapper); | ||
251 | + | ||
252 | + | ||
253 | + LambdaQueryWrapper<SysDictItem> sysDictItemLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
254 | + sysDictItemLambdaQueryWrapper.select(SysDictItem::getItemText,SysDictItem::getItemValue); | ||
255 | + List<SysDictItem> sysDictItems = sysDictItemServiceImpl.list(sysDictItemLambdaQueryWrapper); | ||
256 | + List<String> collect = sysDictItems.stream().map(SysDictItem::getItemValue).collect(Collectors.toList()); | ||
257 | + Object[] objects = collect.toArray(); | ||
258 | + | ||
259 | + | ||
260 | + for(InventoryDetail inventoryDetail : inventoryDetails){ | ||
261 | + int i = ArrayUtil.indexOf(objects, inventoryDetail.getInventoryStatus()); | ||
262 | + ChartData chartData = new ChartData(); | ||
263 | + option.legend().getData().add(sysDictItems.get(i).getItemText()); | ||
264 | + chartData.setName(sysDictItems.get(i).getItemText()); | ||
265 | + chartData.setValue(Convert.toDouble(inventoryDetail.getQty())); | ||
266 | + pie.data().add(chartData); | ||
267 | + } | ||
268 | + option.series().add(pie); | ||
269 | + String format = GsonUtil.format(option); | ||
270 | + return Result.ok(GsonUtil.format(option)); | ||
271 | + } | ||
272 | + | ||
273 | + | ||
274 | + /** | ||
275 | + * 库存概况 | ||
276 | + * @return | ||
277 | + */ | ||
278 | + @RequestMapping(value = "/inventoryOverview", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
279 | + public Result<String> inventoryOverview() { | ||
280 | + | ||
281 | + QueryWrapper<InventoryDetail> queryWrapper = new QueryWrapper<>(); | ||
282 | + queryWrapper.select("material_name, sum(qty) AS qty") | ||
283 | + .eq("warehouse_code", "CS0001").groupBy("material_name"); | ||
284 | + List<InventoryDetail> inventoryDetails = inventoryDetailServiceImpl.list(queryWrapper); | ||
285 | + Option option = new Option(); | ||
286 | + option.tooltip(Trigger.item).tooltip().formatter("{a} <br/>{b} : {c} ({d}%)"); | ||
287 | + option.legend().setOrient(Orient.vertical); | ||
288 | + option.legend().setRight(10); | ||
289 | + option.legend().setTop(10); | ||
290 | + option.legend().setBottom(10); | ||
291 | + option.legend().setData(new ArrayList<String>()); | ||
292 | + option.legend().setType(LegendType.scroll); | ||
293 | + List<Object> content = new ArrayList<>(); | ||
294 | + content.add("#c23531"); | ||
295 | + content.add("#2f4554"); | ||
296 | + option.setColor(content); | ||
297 | + Pie pie = new Pie(); | ||
298 | + pie.setName("库存"); | ||
299 | + pie.setType(SeriesType.pie); | ||
300 | + pie.setRadius("55%"); | ||
301 | + pie.setCenter(new String[]{"40%","50%"}); | ||
302 | + pie.itemStyle().emphasis().setShadowBlur(10); | ||
303 | + pie.itemStyle().emphasis().setShadowOffsetX(0); | ||
304 | + pie.itemStyle().emphasis().setShadowColor("rgba(0, 0, 0, 0.4)"); | ||
305 | + Normal normal = new Normal(); | ||
306 | + normal.setFormatter("{b} \n {c} ({d}%)"); | ||
307 | + normal.setBarBorderColor("#eee"); | ||
308 | + normal.setBorderWidth(1); | ||
309 | + normal.setBorderRadius(4); | ||
310 | + pie.label().normal(normal); | ||
311 | + | ||
312 | + int i = 0; | ||
313 | + Map<String, Boolean> map = new HashMap<>(); | ||
314 | + for(InventoryDetail inventory: inventoryDetails){ | ||
315 | + Object o1 = inventory.getMaterialName(); | ||
316 | + Object o2 = inventory.getQty(); | ||
317 | + option.legend().data().add(o1); | ||
318 | + pie.data().add(new ChartData(o1.toString(), Convert.toDouble(o2))); | ||
319 | + if(i<6){ | ||
320 | + map.put(o1.toString(),true); | ||
321 | + }else{ | ||
322 | + map.put(o1.toString(),false); | ||
323 | + } | ||
324 | + i++; | ||
325 | + } | ||
326 | + option.series(pie); | ||
327 | + option.legend().setSelected(map); | ||
328 | + String format = GsonUtil.format(option); | ||
329 | + return Result.ok(GsonUtil.format(option)); | ||
330 | + | ||
331 | + } | ||
332 | + | ||
333 | + | ||
334 | + | ||
335 | + /** | ||
336 | + * 整体数量概况 | ||
337 | + * @return | ||
338 | + */ | ||
339 | + @RequestMapping(value = "/getCommonData", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
340 | + public Result getCommonData() { | ||
341 | + | ||
342 | + //昨天日期 | ||
343 | + String today = new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis() - 1000 * 60 * 60 * 24).toString(); | ||
344 | + Map<String, Object> map = new HashMap<>(); | ||
345 | + | ||
346 | + //今天入库量 | ||
347 | + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
348 | + taskDetailLambdaQueryWrapper.select(TaskDetail::getTaskType,TaskDetail::getQty).gt(TaskDetail::getCreateTime,today); | ||
349 | + List<TaskDetail> taskDetails = taskDetailServiceImpl.list(taskDetailLambdaQueryWrapper); | ||
350 | + BigDecimal receiptQty = BigDecimal.ZERO; | ||
351 | + BigDecimal shipmentQty = BigDecimal.ZERO; | ||
352 | + | ||
353 | + for(TaskDetail taskDetail : taskDetails) | ||
354 | + { | ||
355 | + if (taskDetail.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLERECEIPT)) | ||
356 | + { | ||
357 | + receiptQty=receiptQty.add(taskDetail.getQty()); | ||
358 | + }else if (taskDetail.getTaskType().equals(QuantityConstant.TASK_TYPE_WHOLESHIPMENT)) | ||
359 | + { | ||
360 | + shipmentQty=shipmentQty.add(taskDetail.getQty()); | ||
361 | + } | ||
362 | + | ||
363 | + } | ||
364 | + map.put("receiptTotal",receiptQty); | ||
365 | + map.put("shipmentTotal",shipmentQty); | ||
366 | + //今日交易量 | ||
367 | + map.put("bllCount",receiptQty.add(shipmentQty)); | ||
368 | + | ||
369 | + | ||
370 | + //库存总数 | ||
371 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
372 | + inventoryHeaderLambdaQueryWrapper.select(InventoryHeader::getTotalQty); | ||
373 | + List<InventoryHeader> inventoryHeaders = inventoryHeaderServiceImpl.list(inventoryHeaderLambdaQueryWrapper); | ||
374 | + BigDecimal inventoryQty = BigDecimal.ZERO; | ||
375 | + for(InventoryHeader inventoryHeader : inventoryHeaders) | ||
376 | + { | ||
377 | + inventoryQty=inventoryQty.add(inventoryHeader.getTotalQty()); | ||
378 | + } | ||
379 | + map.put("inventoryTotal",inventoryQty); | ||
380 | + | ||
381 | + | ||
382 | + //库内品数 | ||
383 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
384 | + inventoryDetailLambdaQueryWrapper.select(InventoryDetail::getId).groupBy(InventoryDetail::getInventoryStatus); | ||
385 | + List<InventoryDetail> inventoryDetails = inventoryDetailServiceImpl.list(inventoryDetailLambdaQueryWrapper); | ||
386 | + map.put("materialCount",inventoryDetails.size()); | ||
387 | + | ||
388 | + //待执行任务数 | ||
389 | + LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
390 | + taskHeaderLambdaQueryWrapper.ge(TaskHeader::getStatus,QuantityConstant.TASK_STATUS_RELEASE) | ||
391 | + .lt(TaskHeader::getStatus,QuantityConstant.TASK_STATUS_COMPLETED); | ||
392 | + List<TaskHeader> taskHeaders = taskHeaderService.list(taskHeaderLambdaQueryWrapper); | ||
393 | + map.put("taskUncompletedTotal",taskHeaders.size()); | ||
394 | + | ||
395 | + return Result.ok(map); | ||
396 | + } | ||
397 | + | ||
398 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/home/support/ChartData.java
0 → 100644
1 | +package org.jeecg.modules.wms.home.support; | ||
2 | + | ||
3 | +public class ChartData { | ||
4 | + | ||
5 | + public ChartData(String name, Double value){ | ||
6 | + this.name = name; | ||
7 | + this.value = value; | ||
8 | + } | ||
9 | + | ||
10 | + public ChartData() { | ||
11 | + | ||
12 | + } | ||
13 | + | ||
14 | + private String name; | ||
15 | + private Double value; | ||
16 | + | ||
17 | + public String getName() { | ||
18 | + return name; | ||
19 | + } | ||
20 | + | ||
21 | + public void setName(String name) { | ||
22 | + this.name = name; | ||
23 | + } | ||
24 | + | ||
25 | + public Double getValue() { | ||
26 | + return value; | ||
27 | + } | ||
28 | + | ||
29 | + public void setValue(Double value) { | ||
30 | + this.value = value; | ||
31 | + } | ||
32 | +} |