Commit 57e4c84559bd9fc7fe2bd9319e9e19fb855eb988
1 parent
848b672b
报表:库存分类报表
Showing
7 changed files
with
267 additions
and
7 deletions
ant-design-vue-jeecg/src/views/system/report/ReportInventoryClassificationList.vue
0 → 100644
1 | +<template> | |
2 | + <a-card :bordered="false"> | |
3 | + <!-- 查询区域 --> | |
4 | + <div class="table-page-search-wrapper"> | |
5 | + <a-form layout="inline" @keyup.enter.native="searchQuery"> | |
6 | + <a-row :gutter="24"> | |
7 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
8 | + <a-form-item label="物料类别"> | |
9 | + <a-select | |
10 | + show-search | |
11 | + placeholder="请选择物料类别" | |
12 | + option-filter-prop="children" | |
13 | + v-model="queryParam.materialTypeCode"> | |
14 | + <a-select-option v-for="item in materialTypeList" :key="item.code" :value="item.code"> | |
15 | + {{ item.code }} {{ item.name }} | |
16 | + </a-select-option> | |
17 | + </a-select> | |
18 | + </a-form-item> | |
19 | + </a-col> | |
20 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
21 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
22 | + <a-button id="search" type="primary" @click="searchQuery" icon="search">查询</a-button> | |
23 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
24 | + </span> | |
25 | + </a-col> | |
26 | + </a-row> | |
27 | + </a-form> | |
28 | + </div> | |
29 | + <!-- 查询区域-END --> | |
30 | + <!-- table区域-begin --> | |
31 | + <div> | |
32 | + <a-table | |
33 | + ref="table" | |
34 | + size="middle" | |
35 | + :scroll="{x:true}" | |
36 | + bordered | |
37 | + rowKey="id" | |
38 | + :columns="columns" | |
39 | + :dataSource="dataSource" | |
40 | + :pagination="ipagination" | |
41 | + :loading="loading" | |
42 | + class="j-table-force-nowrap" | |
43 | + @change="handleTableChange"> | |
44 | + | |
45 | + <span slot="zoneCode" slot-scope="zoneCode"> | |
46 | + <a-tag :key="zoneCode" color="blue"> | |
47 | + {{ solutionZoneCode(zoneCode) }} | |
48 | + </a-tag> | |
49 | + </span> | |
50 | + <template slot="htmlSlot" slot-scope="text"> | |
51 | + <div v-html="text"></div> | |
52 | + </template> | |
53 | + </a-table> | |
54 | + </div> | |
55 | + </a-card> | |
56 | +</template> | |
57 | + | |
58 | +<script> | |
59 | + | |
60 | +import '@/assets/less/TableExpand.less' | |
61 | +import {mixinDevice} from '@/utils/mixin' | |
62 | +import {JeecgListMixin} from '@/mixins/JeecgListMixin' | |
63 | +import {getMaterialTypeList, getZoneList} from '@/api/api' | |
64 | + | |
65 | +export default { | |
66 | + name: 'ReportInventoryClassificationList', | |
67 | + mixins: [JeecgListMixin, mixinDevice], | |
68 | + components: {}, | |
69 | + data() { | |
70 | + return { | |
71 | + description: '库存分类报表页面', | |
72 | + zoneList: [], | |
73 | + zoneOptions: [], | |
74 | + materialTypeList: [], | |
75 | + firstLoad: 0, | |
76 | + // 表头 | |
77 | + columns: [ | |
78 | + { | |
79 | + title: '#', | |
80 | + dataIndex: '', | |
81 | + key: 'rowIndex', | |
82 | + width: 60, | |
83 | + align: 'center', | |
84 | + customRender: function (t, r, index) { | |
85 | + return parseInt(index) + 1 | |
86 | + } | |
87 | + }, | |
88 | + { | |
89 | + title: '库存分类编码', | |
90 | + align: "center", | |
91 | + dataIndex: 'materialTypeCode' | |
92 | + }, | |
93 | + { | |
94 | + title: '库存分类名称', | |
95 | + align: "center", | |
96 | + dataIndex: 'materialTypeName' | |
97 | + }, | |
98 | + { | |
99 | + title: '库存数量', | |
100 | + align: "center", | |
101 | + dataIndex: 'qty' | |
102 | + } | |
103 | + ], | |
104 | + url: { | |
105 | + list: "/report/listInventoryClassification", | |
106 | + }, | |
107 | + } | |
108 | + }, | |
109 | + created() { | |
110 | + this.loadFrom(); | |
111 | + }, | |
112 | + mounted() { | |
113 | + if (this.firstLoad === 0) { | |
114 | + this.firstLoad = 1; | |
115 | + return; | |
116 | + } | |
117 | + //页面没加载完,此时methods里的方法找不到,使用定时器模拟点击 | |
118 | + let timeSearch = setInterval(() => { | |
119 | + let eleSearch = document.getElementById("search"); | |
120 | + if (eleSearch != null) { | |
121 | + //调用成功,清除定时器 | |
122 | + clearInterval(timeSearch) | |
123 | + eleSearch.click(); | |
124 | + } | |
125 | + }, 200) | |
126 | + }, | |
127 | + computed: { | |
128 | + importExcelUrl: function () { | |
129 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
130 | + }, | |
131 | + }, | |
132 | + methods: { | |
133 | + loadFrom() { | |
134 | + getMaterialTypeList().then((res) => { | |
135 | + if (res.success) { | |
136 | + this.materialTypeList = res.result | |
137 | + } | |
138 | + }); | |
139 | + getZoneList().then((res) => { | |
140 | + if (res.success) { | |
141 | + this.zoneList = res.result | |
142 | + //延迟半秒执行,避免组件未加载完,数据已经加载完 | |
143 | + setTimeout(() => { | |
144 | + //slice可以在数组的任何位置进行删除/添加操作 | |
145 | + this.zoneOptions.splice(0, 1); | |
146 | + for (const element of res.result) { | |
147 | + this.zoneOptions.push({value: element.code, text: element.name}) | |
148 | + } | |
149 | + }, 500) | |
150 | + } | |
151 | + }); | |
152 | + }, | |
153 | + solutionZoneCode(value) { | |
154 | + let actions = [] | |
155 | + Object.keys(this.zoneList).some(key => { | |
156 | + if (this.zoneList[key].code === '' + value) { | |
157 | + actions.push(this.zoneList[key].name) | |
158 | + return true | |
159 | + } | |
160 | + }) | |
161 | + return actions.join('') | |
162 | + } | |
163 | + } | |
164 | +} | |
165 | +</script> | |
166 | +<style scoped> | |
167 | +@import '~@assets/less/common.less'; | |
168 | +</style> | |
0 | 169 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java
... | ... | @@ -4,6 +4,7 @@ import java.util.List; |
4 | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
5 | 5 | import org.apache.ibatis.annotations.Param; |
6 | 6 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
7 | +import org.jeecg.modules.wms.report.dto.ReportInventoryClassificationDto; | |
7 | 8 | |
8 | 9 | /** |
9 | 10 | * @Description: 库存详情 |
... | ... | @@ -13,8 +14,15 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
13 | 14 | */ |
14 | 15 | public interface InventoryDetailMapper extends BaseMapper<InventoryDetail> { |
15 | 16 | |
16 | - public boolean deleteByMainId(@Param("mainId") String mainId); | |
17 | + boolean deleteByMainId(@Param("mainId") String mainId); | |
17 | 18 | |
18 | - public List<InventoryDetail> selectByMainId(@Param("mainId") String mainId); | |
19 | + List<InventoryDetail> selectByMainId(@Param("mainId") String mainId); | |
19 | 20 | |
21 | + /** | |
22 | + * 库存分类报表查询 | |
23 | + * | |
24 | + * @param materialTypeCode 物料类别编码 | |
25 | + * @return 库存分类报表信息 | |
26 | + */ | |
27 | + List<ReportInventoryClassificationDto> selectReportClassification(@Param("materialTypeCode") String materialTypeCode); | |
20 | 28 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.xml
... | ... | @@ -4,13 +4,29 @@ |
4 | 4 | |
5 | 5 | <delete id="deleteByMainId" parameterType="java.lang.String"> |
6 | 6 | DELETE |
7 | - FROM inventory_detail | |
8 | - WHERE inventory_header_id = #{mainId} | |
7 | + FROM inventory_detail | |
8 | + WHERE inventory_header_id = #{mainId} | |
9 | 9 | </delete> |
10 | 10 | |
11 | 11 | <select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail"> |
12 | 12 | SELECT * |
13 | - FROM inventory_detail | |
14 | - WHERE inventory_header_id = #{mainId} | |
13 | + FROM inventory_detail | |
14 | + WHERE inventory_header_id = #{mainId} | |
15 | + </select> | |
16 | + | |
17 | + <select id="selectReportClassification" | |
18 | + resultType="org.jeecg.modules.wms.report.dto.ReportInventoryClassificationDto"> | |
19 | + SELECT | |
20 | + material_type.code as materialTypeCode, | |
21 | + material_type.name as materialTypeName, | |
22 | + SUM(inventory_detail.qty) as qty | |
23 | + FROM | |
24 | + inventory_detail | |
25 | + LEFT JOIN material ON material.`code` = inventory_detail.material_code | |
26 | + LEFT JOIN material_type ON material.type = material_type.code | |
27 | + <if test="materialTypeCode != null and materialTypeCode != ''"> | |
28 | + WHERE material.type = #{materialTypeCode} | |
29 | + </if> | |
30 | + GROUP BY type | |
15 | 31 | </select> |
16 | 32 | </mapper> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java
... | ... | @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.inventory.inventoryHeader.service; |
2 | 2 | |
3 | 3 | import java.math.BigDecimal; |
4 | 4 | import java.util.List; |
5 | +import java.util.Map; | |
5 | 6 | |
6 | 7 | import org.jeecg.common.api.vo.Result; |
7 | 8 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
... | ... | @@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
10 | 11 | import com.baomidou.mybatisplus.core.metadata.IPage; |
11 | 12 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
12 | 13 | import com.baomidou.mybatisplus.extension.service.IService; |
14 | +import org.jeecg.modules.wms.report.dto.ReportInventoryClassificationDto; | |
13 | 15 | |
14 | 16 | /** |
15 | 17 | * @Description: 库存详情 |
... | ... | @@ -19,7 +21,7 @@ import com.baomidou.mybatisplus.extension.service.IService; |
19 | 21 | */ |
20 | 22 | public interface IInventoryDetailService extends IService<InventoryDetail> { |
21 | 23 | |
22 | - public List<InventoryDetail> selectByMainId(String mainId); | |
24 | + List<InventoryDetail> selectByMainId(String mainId); | |
23 | 25 | |
24 | 26 | List<InventoryDetail> getInventoryDetailListByInventoryHeaderId(Integer inventoryHeaderId); |
25 | 27 | |
... | ... | @@ -130,4 +132,12 @@ public interface IInventoryDetailService extends IService<InventoryDetail> { |
130 | 132 | * @return |
131 | 133 | */ |
132 | 134 | Result reduceInventoryDetail(InventoryDetail inventoryDetail, BigDecimal qty); |
135 | + | |
136 | + /** | |
137 | + * 库存分类报表查询 | |
138 | + * | |
139 | + * @param materialTypeCode 物料类别编码 | |
140 | + * @return 库存分类报表信息 | |
141 | + */ | |
142 | + List<ReportInventoryClassificationDto> getInventoryClassifyReport(String materialTypeCode); | |
133 | 143 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
... | ... | @@ -22,6 +22,7 @@ import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
22 | 22 | import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; |
23 | 23 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
24 | 24 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; |
25 | +import org.jeecg.modules.wms.report.dto.ReportInventoryClassificationDto; | |
25 | 26 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
26 | 27 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
27 | 28 | import org.jeecg.utils.StringUtils; |
... | ... | @@ -488,4 +489,9 @@ public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMappe |
488 | 489 | } |
489 | 490 | return Result.OK("调整库存,托盘:" + containerCode + "调整库存成功"); |
490 | 491 | } |
492 | + | |
493 | + @Override | |
494 | + public List<ReportInventoryClassificationDto> getInventoryClassifyReport(String materialTypeCode) { | |
495 | + return super.baseMapper.selectReportClassification(materialTypeCode); | |
496 | + } | |
491 | 497 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java
... | ... | @@ -13,6 +13,9 @@ import javax.annotation.Resource; |
13 | 13 | import javax.servlet.http.HttpServletRequest; |
14 | 14 | |
15 | 15 | import cn.hutool.core.util.ObjectUtil; |
16 | +import cn.hutool.core.util.StrUtil; | |
17 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
18 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
16 | 19 | import org.jeecg.common.api.vo.Result; |
17 | 20 | import org.jeecg.common.system.base.controller.JeecgController; |
18 | 21 | import org.jeecg.common.system.query.QueryGenerator; |
... | ... | @@ -20,9 +23,14 @@ import org.jeecg.modules.wms.config.location.entity.Location; |
20 | 23 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
21 | 24 | import org.jeecg.modules.wms.config.material.entity.Material; |
22 | 25 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
26 | +import org.jeecg.modules.wms.config.materialType.entity.MaterialType; | |
27 | +import org.jeecg.modules.wms.config.materialType.service.IMaterialTypeService; | |
23 | 28 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
29 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
30 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
24 | 31 | import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; |
25 | 32 | import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; |
33 | +import org.jeecg.modules.wms.report.dto.ReportInventoryClassificationDto; | |
26 | 34 | import org.jeecg.utils.HuahengJwtUtil; |
27 | 35 | import org.jeecg.utils.StringUtils; |
28 | 36 | import org.jeecg.utils.constant.QuantityConstant; |
... | ... | @@ -54,7 +62,11 @@ public class ReportController extends JeecgController<InventoryTransaction, IInv |
54 | 62 | @Resource |
55 | 63 | private IMaterialService materialService; |
56 | 64 | @Resource |
65 | + private IMaterialTypeService materialTypeService; | |
66 | + @Resource | |
57 | 67 | private ILocationService locationService; |
68 | + @Resource | |
69 | + private IInventoryDetailService inventoryDetailService; | |
58 | 70 | |
59 | 71 | /** |
60 | 72 | * 分页列表查询 |
... | ... | @@ -192,4 +204,16 @@ public class ReportController extends JeecgController<InventoryTransaction, IInv |
192 | 204 | page.setRecords(inventoryTransactionReportList); |
193 | 205 | return Result.OK(page); |
194 | 206 | } |
207 | + | |
208 | + /** | |
209 | + * 库存分类报表列表查询 | |
210 | + */ | |
211 | + @GetMapping(value = "/listInventoryClassification") | |
212 | + public Result listInventoryClassification(String materialTypeCode, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | |
213 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | |
214 | + List<ReportInventoryClassificationDto> inventoryClassifyReportList = inventoryDetailService.getInventoryClassifyReport(materialTypeCode); | |
215 | + Page<ReportInventoryClassificationDto> page = new Page<>(pageNo, pageSize); | |
216 | + page.setRecords(inventoryClassifyReportList); | |
217 | + return Result.OK(page); | |
218 | + } | |
195 | 219 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/dto/ReportInventoryClassificationDto.java
0 → 100644
1 | +package org.jeecg.modules.wms.report.dto; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +import java.io.Serializable; | |
6 | +import java.math.BigDecimal; | |
7 | + | |
8 | +/** | |
9 | + * 库存分类报表Dto类 | |
10 | + */ | |
11 | +@Data | |
12 | +public class ReportInventoryClassificationDto implements Serializable { | |
13 | + | |
14 | + /** | |
15 | + * 物料分类编码 | |
16 | + */ | |
17 | + private String materialTypeCode; | |
18 | + | |
19 | + /** | |
20 | + * 物料分类名称 | |
21 | + */ | |
22 | + private String materialTypeName; | |
23 | + | |
24 | + /** | |
25 | + * 总数量 | |
26 | + */ | |
27 | + private BigDecimal qty; | |
28 | +} | |
... | ... |