Commit 0c1e195b5d2a56109253a2dd8dc03ab9de8ea1bf
1 parent
9376c806
增加物料热度报表
Showing
3 changed files
with
525 additions
and
91 deletions
ant-design-vue-jeecg/src/views/system/report/ReportInventoryTransactionList.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-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | + <a-form-item label="物料名称"> | |
14 | + <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input> | |
15 | + </a-form-item> | |
16 | + </a-col> | |
17 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
18 | + <a-form-item label="物料规格"> | |
19 | + <a-input placeholder="请输入物料规格" v-model="queryParam.materialSpec"></a-input> | |
20 | + </a-form-item> | |
21 | + </a-col> | |
22 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
23 | + <a-form-item label="物料单位"> | |
24 | + <a-input placeholder="请输入物料单位" v-model="queryParam.materialUnit"></a-input> | |
25 | + </a-form-item> | |
26 | + </a-col> | |
27 | + <a-col :xl="12" :lg="14" :md="16" :sm="24"> | |
28 | + <a-form-item label="创建日期"> | |
29 | + <j-date :show-date="true" date-format="YYYY-MM-DD" placeholder="请选择开始时间" | |
30 | + class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> | |
31 | + <span class="query-group-split-cust"></span> | |
32 | + <j-date :show-date="true" date-format="YYYY-MM-DD" placeholder="请选择结束时间" | |
33 | + class="query-group-cust" v-model="queryParam.createTime_end"></j-date> | |
34 | + </a-form-item> | |
35 | + </a-col> | |
36 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
37 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
38 | + <a-button id="search" type="primary" @click="searchQuery" icon="search">查询</a-button> | |
39 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
40 | +<!-- <a @click="handleToggleSearch" style="margin-left: 8px">--> | |
41 | +<!-- {{ toggleSearchStatus ? '收起' : '展开' }}--> | |
42 | +<!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>--> | |
43 | +<!-- </a>--> | |
44 | + </span> | |
45 | + </a-col> | |
46 | + </a-row> | |
47 | + </a-form> | |
48 | + </div> | |
49 | + <!-- 查询区域-END --> | |
50 | + | |
51 | +<!-- <!– 操作按钮区域 –>--> | |
52 | +<!-- <div class="table-operator">--> | |
53 | +<!-- <a-button v-has="'inventoryTransaction:export'" type="primary" icon="download"--> | |
54 | +<!-- @click="handleExportXls('库存交易记录')">导出--> | |
55 | +<!-- </a-button>--> | |
56 | +<!-- <a-upload v-has="'inventoryTransaction:import'" name="file" :showUploadList="false" :multiple="false"--> | |
57 | +<!-- :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">--> | |
58 | +<!-- <a-button type="primary" icon="import">导入</a-button>--> | |
59 | +<!-- </a-upload>--> | |
60 | +<!-- <j-super-query :fieldList="superFieldList" v-has="'inventoryTransaction:superQuery'"--> | |
61 | +<!-- @handleSuperQuery="handleSuperQuery"/>--> | |
62 | +<!-- </div>--> | |
63 | + | |
64 | + <!-- table区域-begin --> | |
65 | + <div> | |
66 | + <a-table | |
67 | + ref="table" | |
68 | + size="middle" | |
69 | + :scroll="{x:true}" | |
70 | + bordered | |
71 | + rowKey="id" | |
72 | + :columns="columns" | |
73 | + :dataSource="dataSource" | |
74 | + :pagination="ipagination" | |
75 | + :loading="loading" | |
76 | + class="j-table-force-nowrap" | |
77 | + @change="handleTableChange"> | |
78 | + | |
79 | + <span slot="inventoryStatus_dictText" slot-scope="inventoryStatus_dictText"> | |
80 | + <a-tag :key="inventoryStatus_dictText" :color="getStatusColor(inventoryStatus_dictText)"> | |
81 | + {{ inventoryStatus_dictText }} | |
82 | + </a-tag> | |
83 | + </span> | |
84 | + | |
85 | + <span slot="companyCode" slot-scope="companyCode"> | |
86 | + <a-tag :key="companyCode" color=blue> | |
87 | + {{ solutionCompany(companyCode) }} | |
88 | + </a-tag> | |
89 | + </span> | |
90 | + | |
91 | + <span slot="zoneCode" slot-scope="zoneCode"> | |
92 | + <a-tag :key="zoneCode" color="blue"> | |
93 | + {{ solutionZoneCode(zoneCode) }} | |
94 | + </a-tag> | |
95 | + </span> | |
96 | + <template slot="htmlSlot" slot-scope="text"> | |
97 | + <div v-html="text"></div> | |
98 | + </template> | |
99 | + <template slot="imgSlot" slot-scope="text"> | |
100 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
101 | + <img v-else :src="getImgView(text)" height="25px" alt="" | |
102 | + style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
103 | + </template> | |
104 | + <template slot="fileSlot" slot-scope="text"> | |
105 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
106 | + <a-button | |
107 | + v-else | |
108 | + :ghost="true" | |
109 | + type="primary" | |
110 | + icon="download" | |
111 | + size="small" | |
112 | + @click="downloadFile(text)"> | |
113 | + 下载 | |
114 | + </a-button> | |
115 | + </template> | |
116 | + <span slot="action" slot-scope="text, record"> | |
117 | + <a v-has="'inventoryTransaction:edit'" @click="handleEdit(record)">编辑<a-divider type="vertical"/></a> | |
118 | + <a-dropdown> | |
119 | + <a class="ant-dropdown-link">更多 <a-icon type="down"/></a> | |
120 | + <a-menu slot="overlay"> | |
121 | + <a-menu-item> | |
122 | + <a @click="handleDetail(record)">详情</a> | |
123 | + </a-menu-item> | |
124 | + <a-menu-item v-has="'inventoryTransaction:delete'"> | |
125 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
126 | + <a>删除</a> | |
127 | + </a-popconfirm> | |
128 | + </a-menu-item> | |
129 | + </a-menu> | |
130 | + </a-dropdown> | |
131 | + </span> | |
132 | + </a-table> | |
133 | + </div> | |
134 | + | |
135 | + <inventory-transaction-modal ref="modalForm" @ok="modalFormOk"></inventory-transaction-modal> | |
136 | + </a-card> | |
137 | +</template> | |
138 | + | |
139 | +<script> | |
140 | + | |
141 | +import '@/assets/less/TableExpand.less' | |
142 | +import {mixinDevice} from '@/utils/mixin' | |
143 | +import {JeecgListMixin} from '@/mixins/JeecgListMixin' | |
144 | +import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |
145 | +import {getCompanyList, getZoneList} from '@/api/api' | |
146 | + | |
147 | +export default { | |
148 | + name: 'InventoryTransactionList', | |
149 | + mixins: [JeecgListMixin, mixinDevice], | |
150 | + components: { | |
151 | + | |
152 | + }, | |
153 | + data() { | |
154 | + return { | |
155 | + description: '库存交易记录管理页面', | |
156 | + companyList: [], | |
157 | + zoneList: [], | |
158 | + zoneOptions: [], | |
159 | + firstLoad:0, | |
160 | + // 表头 | |
161 | + columns: [ | |
162 | + { | |
163 | + title: '物料编码', | |
164 | + align: "center", | |
165 | + dataIndex: 'materialCode' | |
166 | + }, | |
167 | + { | |
168 | + title: '物料名称', | |
169 | + align: "center", | |
170 | + dataIndex: 'materialName' | |
171 | + }, | |
172 | + { | |
173 | + title: '物料规格', | |
174 | + align: "center", | |
175 | + dataIndex: 'materialSpec' | |
176 | + }, | |
177 | + { | |
178 | + title: '物料单位', | |
179 | + align: "center", | |
180 | + dataIndex: 'materialUnit' | |
181 | + }, | |
182 | + { | |
183 | + title: '出入库总数', | |
184 | + align: "center", | |
185 | + dataIndex: 'qty' | |
186 | + }, | |
187 | + { | |
188 | + title: '入库数量', | |
189 | + align: "center", | |
190 | + dataIndex: 'receiptQty' | |
191 | + }, | |
192 | + { | |
193 | + title: '出库数量', | |
194 | + align: "center", | |
195 | + dataIndex: 'shipmentQty' | |
196 | + }, | |
197 | + // { | |
198 | + // title: '本托盘库存数量', | |
199 | + // align: "center", | |
200 | + // dataIndex: 'containerInventoryQty' | |
201 | + // }, | |
202 | + // { | |
203 | + // title: '库存总数', | |
204 | + // align: "center", | |
205 | + // dataIndex: 'inventoryQty' | |
206 | + // }, | |
207 | + // { | |
208 | + // title: '操作', | |
209 | + // dataIndex: 'action', | |
210 | + // align: "center", | |
211 | + // fixed: "right", | |
212 | + // width: 147, | |
213 | + // scopedSlots: {customRender: 'action'} | |
214 | + // } | |
215 | + ], | |
216 | + url: { | |
217 | + list: "/report/inventoryTransaction/list", | |
218 | + }, | |
219 | + dictOptions: {}, | |
220 | + superFieldList: [], | |
221 | + } | |
222 | + }, | |
223 | + created() { | |
224 | + this.getSuperFieldList(); | |
225 | + this.loadFrom(); | |
226 | + }, | |
227 | + mounted() { | |
228 | + if(this.firstLoad == 0) { | |
229 | + this.firstLoad = 1; | |
230 | + return; | |
231 | + } | |
232 | + //页面没加载完,此时methods里的方法找不到,使用定时器模拟点击 | |
233 | + let timeSearch=setInterval(()=>{ | |
234 | + let eleSearch= document.getElementById("search"); | |
235 | + if (eleSearch!=null){ | |
236 | + //调用成功,清除定时器 | |
237 | + clearInterval(timeSearch) | |
238 | + eleSearch.click(); | |
239 | + } | |
240 | + },200) | |
241 | + }, | |
242 | + computed: { | |
243 | + importExcelUrl: function () { | |
244 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
245 | + }, | |
246 | + }, | |
247 | + methods: { | |
248 | + getStatusColor(status) { | |
249 | + const colors = { | |
250 | + '良品': 'green', | |
251 | + '报废品': 'purple', | |
252 | + '待确认 ': 'grey', | |
253 | + '次品': 'red', | |
254 | + default: 'blue' | |
255 | + }; | |
256 | + return colors[status] || colors.default; | |
257 | + }, | |
258 | + initDictConfig() { | |
259 | + }, | |
260 | + loadFrom() { | |
261 | + getZoneList().then((res) => { | |
262 | + if (res.success) { | |
263 | + this.zoneList = res.result | |
264 | + //延迟半秒执行,避免组件未加载完,数据已经加载完 | |
265 | + setTimeout(() => { | |
266 | + //slice可以在数组的任何位置进行删除/添加操作 | |
267 | + this.zoneOptions.splice(0, 1); | |
268 | + for (let i = 0; i < res.result.length; i++) { | |
269 | + this.zoneOptions.push({value: res.result[i].code, text: res.result[i].name}) | |
270 | + } | |
271 | + }, 500) | |
272 | + } | |
273 | + }); | |
274 | + getCompanyList().then((res) => { | |
275 | + if (res.success) { | |
276 | + this.companyList = res.result | |
277 | + } | |
278 | + }); | |
279 | + }, | |
280 | + solutionZoneCode(value) { | |
281 | + var actions = [] | |
282 | + Object.keys(this.zoneList).some(key => { | |
283 | + if (this.zoneList[key].code === '' + value) { | |
284 | + actions.push(this.zoneList[key].name) | |
285 | + return true | |
286 | + } | |
287 | + }) | |
288 | + return actions.join('') | |
289 | + }, | |
290 | + solutionCompany(value) { | |
291 | + var actions = [] | |
292 | + Object.keys(this.companyList).some((key) => { | |
293 | + if (this.companyList[key].code == ('' + value)) { | |
294 | + actions.push(this.companyList[key].name) | |
295 | + return true | |
296 | + } | |
297 | + }) | |
298 | + return actions.join('') | |
299 | + }, | |
300 | + getSuperFieldList() { | |
301 | + let fieldList = []; | |
302 | + fieldList.push({type: 'string', value: 'companyCode', text: '货主', dictCode: ''}) | |
303 | + fieldList.push({type: 'string', value: 'containerCode', text: '容器编码', dictCode: ''}) | |
304 | + fieldList.push({type: 'string', value: 'locationCode', text: '库位编码', dictCode: ''}) | |
305 | + fieldList.push({type: 'int', value: 'type', text: '交易类型', dictCode: 'inventory_transaction_type'}) | |
306 | + fieldList.push({type: 'string', value: 'materialCode', text: '物料编码', dictCode: ''}) | |
307 | + fieldList.push({type: 'string', value: 'materialName', text: '物料名称', dictCode: ''}) | |
308 | + fieldList.push({type: 'string', value: 'materialSpec', text: '物料规格', dictCode: ''}) | |
309 | + fieldList.push({type: 'string', value: 'materialUnit', text: '物料单位', dictCode: ''}) | |
310 | + fieldList.push({type: 'string', value: 'inventoryStatus', text: '库存状态', dictCode: 'inventory_status'}) | |
311 | + fieldList.push({type: 'BigDecimal', value: 'qty', text: '数量', dictCode: ''}) | |
312 | + fieldList.push({type: 'string', value: 'batch', text: '批次', dictCode: ''}) | |
313 | + fieldList.push({type: 'string', value: 'createBy', text: '创建人', dictCode: ''}) | |
314 | + fieldList.push({type: 'datetime', value: 'createTime', text: '创建日期'}) | |
315 | + fieldList.push({type: 'string', value: 'updateBy', text: '更新人', dictCode: ''}) | |
316 | + fieldList.push({type: 'datetime', value: 'updateTime', text: '更新日期'}) | |
317 | + this.superFieldList = fieldList | |
318 | + } | |
319 | + } | |
320 | +} | |
321 | +</script> | |
322 | +<style scoped> | |
323 | +@import '~@assets/less/common.less'; | |
324 | +</style> | |
0 | 325 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/views/system/task/AllTaskHeaderList.vue
... | ... | @@ -161,7 +161,6 @@ |
161 | 161 | <a-divider type="vertical"/></a> |
162 | 162 | <a v-if="record.isDoubleIn == 1 && record.exceptionState == 1" v-has="'taskHeader:executeTask'" @click="handleDoubleInTask(record)"><a-button type="danger">修复重入数据</a-button> |
163 | 163 | <a-divider type="vertical"/></a> |
164 | - <!-- <a v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" @click="cancelTask(record)" >取消</a>--> | |
165 | 164 | <a-popconfirm v-if="record.status <= 10" v-has="'taskHeader:cancelTask'" title="确定取消任务吗?" @confirm="() => cancelTask(record)"> |
166 | 165 | <a-button type="danger">取消</a-button> |
167 | 166 | </a-popconfirm> |
... | ... | @@ -233,23 +232,23 @@ export default { |
233 | 232 | align: "center", |
234 | 233 | dataIndex: 'taskType_dictText', |
235 | 234 | scopedSlots: {customRender: 'taskType_dictText'}, |
236 | - filterMultiple: false, | |
237 | - filters: [ | |
238 | - {text: '整盘入库', value: '100'}, | |
239 | - {text: '补充入库', value: '200'}, | |
240 | - {text: '空容器入库', value: '500'}, | |
241 | - {text: '空托盘组入库', value: '1100'}, | |
242 | - {text: '整盘出库', value: '300'}, | |
243 | - {text: '分拣出库', value: '400'}, | |
244 | - {text: '空容器出库', value: '600'}, | |
245 | - {text: '空托盘组出库', value: '1200'}, | |
246 | - {text: '移库', value: '800'}, | |
247 | - {text: '换站', value: '1000'}, | |
248 | - {text: '空托盘组换站', value: '1300'}, | |
249 | - {text: '盘点', value: '700'}, | |
250 | - {text: '质检', value: '1400'}, | |
251 | - {text: '出库查看', value: '900'}, | |
252 | - ] | |
235 | + // filterMultiple: false, | |
236 | + // filters: [ | |
237 | + // {text: '整盘入库', value: '100'}, | |
238 | + // {text: '补充入库', value: '200'}, | |
239 | + // {text: '空容器入库', value: '500'}, | |
240 | + // {text: '空托盘组入库', value: '1100'}, | |
241 | + // {text: '整盘出库', value: '300'}, | |
242 | + // {text: '分拣出库', value: '400'}, | |
243 | + // {text: '空容器出库', value: '600'}, | |
244 | + // {text: '空托盘组出库', value: '1200'}, | |
245 | + // {text: '移库', value: '800'}, | |
246 | + // {text: '换站', value: '1000'}, | |
247 | + // {text: '空托盘组换站', value: '1300'}, | |
248 | + // {text: '盘点', value: '700'}, | |
249 | + // {text: '质检', value: '1400'}, | |
250 | + // {text: '出库查看', value: '900'}, | |
251 | + // ] | |
253 | 252 | }, |
254 | 253 | { |
255 | 254 | title: '容器编码', |
... | ... | @@ -341,14 +340,14 @@ export default { |
341 | 340 | align: "center", |
342 | 341 | dataIndex: 'completeTime' |
343 | 342 | }, |
344 | - // { | |
345 | - // title: '操作', | |
346 | - // dataIndex: 'action', | |
347 | - // align: "center", | |
348 | - // fixed: "right", | |
349 | - // width: 147, | |
350 | - // scopedSlots: {customRender: 'action'}, | |
351 | - // } | |
343 | + { | |
344 | + title: '操作', | |
345 | + dataIndex: 'action', | |
346 | + align: "center", | |
347 | + fixed: "right", | |
348 | + width: 147, | |
349 | + scopedSlots: {customRender: 'action'}, | |
350 | + } | |
352 | 351 | ], |
353 | 352 | url: { |
354 | 353 | list: "/task/taskHeader/list", |
... | ... | @@ -522,71 +521,71 @@ export default { |
522 | 521 | }) |
523 | 522 | return actions.join('') |
524 | 523 | }, |
525 | - // cancelTask(record) { | |
526 | - // this.loading = true; | |
527 | - // this.model = Object.assign({}, record); | |
528 | - // cancelTask(this.model.id).then((res) => { | |
529 | - // this.loading = false; | |
530 | - // if (res.success) { | |
531 | - // this.$message.success(res.message); | |
532 | - // } else { | |
533 | - // this.$message.error(res.message); | |
534 | - // } | |
535 | - // this.searchQuery(); | |
536 | - // }); | |
537 | - // }, | |
538 | - // executeTask(record) { | |
539 | - // this.loading = true; | |
540 | - // this.model = Object.assign({}, record); | |
541 | - // execute(this.model).then((res) => { | |
542 | - // this.loading = false; | |
543 | - // if (res.success) { | |
544 | - // this.$message.success(res.message); | |
545 | - // } else { | |
546 | - // this.$message.error(res.message); | |
547 | - // } | |
548 | - // this.searchQuery(); | |
549 | - // }); | |
550 | - // }, | |
551 | - // handleEmptyOutTask(record) { | |
552 | - // this.loading = true; | |
553 | - // this.model = Object.assign({}, record); | |
554 | - // handleEmptyOut(this.model.id).then((res) => { | |
555 | - // this.loading = false; | |
556 | - // if (res.success) { | |
557 | - // this.$message.success(res.message); | |
558 | - // } else { | |
559 | - // this.$message.error(res.message); | |
560 | - // } | |
561 | - // this.searchQuery(); | |
562 | - // }); | |
563 | - // }, | |
564 | - // handlePickupErrorTask(record) { | |
565 | - // this.loading = true; | |
566 | - // this.model = Object.assign({}, record); | |
567 | - // handlePickupError(this.model.id).then((res) => { | |
568 | - // this.loading = false; | |
569 | - // if (res.success) { | |
570 | - // this.$message.success(res.message); | |
571 | - // } else { | |
572 | - // this.$message.error(res.message); | |
573 | - // } | |
574 | - // this.searchQuery(); | |
575 | - // }); | |
576 | - // }, | |
577 | - // handleDoubleInTask(record) { | |
578 | - // this.loading = true; | |
579 | - // this.model = Object.assign({}, record); | |
580 | - // handleDoubleIn(this.model.id).then((res) => { | |
581 | - // this.loading = false; | |
582 | - // if (res.success) { | |
583 | - // this.$message.success(res.message); | |
584 | - // } else { | |
585 | - // this.$message.error(res.message); | |
586 | - // } | |
587 | - // this.searchQuery(); | |
588 | - // }); | |
589 | - // }, | |
524 | + cancelTask(record) { | |
525 | + this.loading = true; | |
526 | + this.model = Object.assign({}, record); | |
527 | + cancelTask(this.model.id).then((res) => { | |
528 | + this.loading = false; | |
529 | + if (res.success) { | |
530 | + this.$message.success(res.message); | |
531 | + } else { | |
532 | + this.$message.error(res.message); | |
533 | + } | |
534 | + this.searchQuery(); | |
535 | + }); | |
536 | + }, | |
537 | + executeTask(record) { | |
538 | + this.loading = true; | |
539 | + this.model = Object.assign({}, record); | |
540 | + execute(this.model).then((res) => { | |
541 | + this.loading = false; | |
542 | + if (res.success) { | |
543 | + this.$message.success(res.message); | |
544 | + } else { | |
545 | + this.$message.error(res.message); | |
546 | + } | |
547 | + this.searchQuery(); | |
548 | + }); | |
549 | + }, | |
550 | + handleEmptyOutTask(record) { | |
551 | + this.loading = true; | |
552 | + this.model = Object.assign({}, record); | |
553 | + handleEmptyOut(this.model.id).then((res) => { | |
554 | + this.loading = false; | |
555 | + if (res.success) { | |
556 | + this.$message.success(res.message); | |
557 | + } else { | |
558 | + this.$message.error(res.message); | |
559 | + } | |
560 | + this.searchQuery(); | |
561 | + }); | |
562 | + }, | |
563 | + handlePickupErrorTask(record) { | |
564 | + this.loading = true; | |
565 | + this.model = Object.assign({}, record); | |
566 | + handlePickupError(this.model.id).then((res) => { | |
567 | + this.loading = false; | |
568 | + if (res.success) { | |
569 | + this.$message.success(res.message); | |
570 | + } else { | |
571 | + this.$message.error(res.message); | |
572 | + } | |
573 | + this.searchQuery(); | |
574 | + }); | |
575 | + }, | |
576 | + handleDoubleInTask(record) { | |
577 | + this.loading = true; | |
578 | + this.model = Object.assign({}, record); | |
579 | + handleDoubleIn(this.model.id).then((res) => { | |
580 | + this.loading = false; | |
581 | + if (res.success) { | |
582 | + this.$message.success(res.message); | |
583 | + } else { | |
584 | + this.$message.error(res.message); | |
585 | + } | |
586 | + this.searchQuery(); | |
587 | + }); | |
588 | + }, | |
590 | 589 | getSuperFieldList() { |
591 | 590 | let fieldList = []; |
592 | 591 | fieldList.push({type: 'int', value: 'taskType', text: '任务类型', dictCode: 'task_type'}) |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/report/controller/ReportController.java
0 → 100644
1 | +package org.jeecg.modules.wms.report.controller; | |
2 | + | |
3 | +import java.math.BigDecimal; | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | +import java.util.stream.Collectors; | |
8 | + | |
9 | +import javax.annotation.Resource; | |
10 | +import javax.servlet.http.HttpServletRequest; | |
11 | + | |
12 | +import org.jeecg.common.api.vo.Result; | |
13 | +import org.jeecg.common.system.base.controller.JeecgController; | |
14 | +import org.jeecg.common.system.query.QueryGenerator; | |
15 | +import org.jeecg.modules.wms.config.material.entity.Material; | |
16 | +import org.jeecg.modules.wms.config.material.service.IMaterialService; | |
17 | +import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; | |
18 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
19 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; | |
20 | +import org.jeecg.utils.HuahengJwtUtil; | |
21 | +import org.jeecg.utils.StringUtils; | |
22 | +import org.jeecg.utils.constant.QuantityConstant; | |
23 | +import org.springframework.beans.factory.annotation.Autowired; | |
24 | +import org.springframework.web.bind.annotation.GetMapping; | |
25 | +import org.springframework.web.bind.annotation.RequestMapping; | |
26 | +import org.springframework.web.bind.annotation.RequestParam; | |
27 | +import org.springframework.web.bind.annotation.RestController; | |
28 | + | |
29 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
30 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
31 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
32 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
33 | + | |
34 | +import io.swagger.annotations.Api; | |
35 | +import io.swagger.annotations.ApiOperation; | |
36 | +import lombok.extern.slf4j.Slf4j; | |
37 | + | |
38 | +/** | |
39 | + * @author 游杰 | |
40 | + */ | |
41 | +@Api(tags = "报表记录") | |
42 | +@RestController | |
43 | +@RequestMapping("/report/inventoryTransaction") | |
44 | +@Slf4j | |
45 | +public class ReportController extends JeecgController<InventoryTransaction, IInventoryTransactionService> { | |
46 | + @Autowired | |
47 | + private IInventoryTransactionService inventoryTransactionService; | |
48 | + | |
49 | + @Resource | |
50 | + private HuahengJwtUtil huahengJwtUtil; | |
51 | + | |
52 | + @Resource | |
53 | + private IParameterConfigurationService parameterConfigurationService; | |
54 | + @Resource | |
55 | + private IMaterialService materialService; | |
56 | + | |
57 | + /** | |
58 | + * 分页列表查询 | |
59 | + * @param inventoryTransaction | |
60 | + * @param pageNo | |
61 | + * @param pageSize | |
62 | + * @param req | |
63 | + * @return | |
64 | + */ | |
65 | + // @AutoLog(value = "库存交易记录-分页列表查询") | |
66 | + @ApiOperation(value = "库存交易记录-分页列表查询", notes = "库存交易记录-分页列表查询") | |
67 | + @GetMapping(value = "/list") | |
68 | + public Result queryPageList(InventoryTransaction inventoryTransaction, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | |
69 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | |
70 | + QueryWrapper<InventoryTransaction> queryWrapper = QueryGenerator.initQueryWrapper(inventoryTransaction, req.getParameterMap()); | |
71 | + List<InventoryTransaction> inventoryTransactionList = inventoryTransactionService.list(queryWrapper); | |
72 | + if (CollectionUtils.isEmpty(inventoryTransactionList)) { | |
73 | + return Result.error("没有找到库存热度记录"); | |
74 | + } | |
75 | + List<String> materialCodeList = inventoryTransactionList.stream().map(InventoryTransaction::getMaterialCode).distinct().collect(Collectors.toList()); | |
76 | + Map<Integer, List<InventoryTransaction>> inventoryTransactionMap = | |
77 | + inventoryTransactionList.stream().collect(Collectors.groupingBy(InventoryTransaction::getType)); | |
78 | + List<InventoryTransaction> receiptInventoryTransactionList = inventoryTransactionMap.get(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); | |
79 | + List<InventoryTransaction> shipmentInventoryTransactionList = inventoryTransactionMap.get(QuantityConstant.INVENTORY_TRANSACTION_SHIPMENT); | |
80 | + List<InventoryTransaction> inventoryTransactionList1 = new ArrayList<>(); | |
81 | + for (String materialCode : materialCodeList) { | |
82 | + BigDecimal receiptQty = BigDecimal.ZERO; | |
83 | + BigDecimal shipmentQty = BigDecimal.ZERO; | |
84 | + if (StringUtils.isNotEmpty(receiptInventoryTransactionList)) { | |
85 | + receiptQty = receiptInventoryTransactionList.stream().filter(o -> materialCode.equals(o.getMaterialCode())).map(InventoryTransaction::getQty) | |
86 | + .reduce(BigDecimal.ZERO, BigDecimal::add); | |
87 | + } | |
88 | + if (StringUtils.isNotEmpty(shipmentInventoryTransactionList)) { | |
89 | + shipmentQty = shipmentInventoryTransactionList.stream().filter(o -> materialCode.equals(o.getMaterialCode())).map(InventoryTransaction::getQty) | |
90 | + .reduce(BigDecimal.ZERO, BigDecimal::add); | |
91 | + } | |
92 | + BigDecimal totalQty = receiptQty.add(shipmentQty); | |
93 | + InventoryTransaction inventoryTransaction1 = new InventoryTransaction(); | |
94 | + inventoryTransaction1.setReceiptQty(receiptQty); | |
95 | + inventoryTransaction1.setShipmentQty(shipmentQty); | |
96 | + inventoryTransaction1.setMaterialCode(materialCode); | |
97 | + inventoryTransaction1.setQty(totalQty); | |
98 | + Material material = materialService.getMaterialByCode(materialCode); | |
99 | + if (material != null) { | |
100 | + inventoryTransaction1.setMaterialName(material.getName()); | |
101 | + inventoryTransaction1.setMaterialUnit(material.getUnit()); | |
102 | + inventoryTransaction1.setMaterialSpec(material.getSpec()); | |
103 | + } | |
104 | + inventoryTransactionList1.add(inventoryTransaction1); | |
105 | + } | |
106 | + Page<InventoryTransaction> page = new Page<InventoryTransaction>(pageNo, pageSize); | |
107 | + IPage<InventoryTransaction> pageList = inventoryTransactionService.page(page, queryWrapper); | |
108 | + return Result.OK(inventoryTransactionList1); | |
109 | + } | |
110 | + | |
111 | +} | |
... | ... |