Commit 44f40ed465570a10e37e60fa59bcc455387af18e
1 parent
20f16757
库存物料汇总查询导出修复
Signed-off-by: TanYibin <5491541@qq.com>
Showing
5 changed files
with
445 additions
and
355 deletions
ant-design-vue-jeecg/src/views/system/inventory/InventoryMaterialSummaryList.vue
... | ... | @@ -5,6 +5,20 @@ |
5 | 5 | <a-form layout="inline" @keyup.enter.native="searchQuery"> |
6 | 6 | <a-row :gutter="24"> |
7 | 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.zoneCode" | |
14 | + > | |
15 | + <a-select-option v-for="item in zoneList" :key="item.name" :value="item.code"> | |
16 | + {{ item.name }} | |
17 | + </a-select-option> | |
18 | + </a-select> | |
19 | + </a-form-item> | |
20 | + </a-col> | |
21 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
8 | 22 | <a-form-item label="货主"> |
9 | 23 | <a-select |
10 | 24 | show-search |
... | ... | @@ -23,29 +37,31 @@ |
23 | 37 | <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input> |
24 | 38 | </a-form-item> |
25 | 39 | </a-col> |
26 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
27 | - <a-form-item label="物料名称"> | |
28 | - <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input> | |
29 | - </a-form-item> | |
30 | - </a-col> | |
31 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
32 | - <a-form-item label="物料规格"> | |
33 | - <a-input placeholder="请输入物料规格" v-model="queryParam.materialSpec"></a-input> | |
34 | - </a-form-item> | |
35 | - </a-col> | |
36 | - <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
37 | - <a-form-item label="物料单位"> | |
38 | - <a-input placeholder="请输入物料单位" v-model="queryParam.materialUnit"></a-input> | |
39 | - </a-form-item> | |
40 | - </a-col> | |
40 | + <template v-if="toggleSearchStatus"> | |
41 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
42 | + <a-form-item label="物料名称"> | |
43 | + <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input> | |
44 | + </a-form-item> | |
45 | + </a-col> | |
46 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
47 | + <a-form-item label="物料规格"> | |
48 | + <a-input placeholder="请输入物料规格" v-model="queryParam.materialSpec"></a-input> | |
49 | + </a-form-item> | |
50 | + </a-col> | |
51 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
52 | + <a-form-item label="物料单位"> | |
53 | + <a-input placeholder="请输入物料单位" v-model="queryParam.materialUnit"></a-input> | |
54 | + </a-form-item> | |
55 | + </a-col> | |
56 | + </template> | |
41 | 57 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
42 | 58 | <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
43 | 59 | <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
44 | 60 | <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> |
45 | - <!-- <a @click="handleToggleSearch" style="margin-left: 8px"> | |
61 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
46 | 62 | {{ toggleSearchStatus ? '收起' : '展开' }} |
47 | - <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
48 | - </a> --> | |
63 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'" /> | |
64 | + </a> | |
49 | 65 | </span> |
50 | 66 | </a-col> |
51 | 67 | </a-row> |
... | ... | @@ -55,73 +71,49 @@ |
55 | 71 | |
56 | 72 | <!-- 操作按钮区域 --> |
57 | 73 | <div class="table-operator"> |
58 | - <a-button v-has="'inventoryMaterialSummary:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
59 | - <a-button v-has="'inventoryMaterialSummary:export'" type="primary" icon="download" @click="handleExportXls('物料汇总主表')">导出</a-button> | |
60 | - <a-upload v-has="'inventoryMaterialSummary:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
61 | - <a-button type="primary" icon="import">导入</a-button> | |
62 | - </a-upload> | |
74 | + <!-- <a-button v-has="'inventoryMaterialSummary:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> --> | |
75 | + <a-button v-has="'inventoryMaterialSummary:export'" type="primary" icon="download" @click="handleExportXls('库存物料汇总')">导出</a-button> | |
63 | 76 | </div> |
64 | 77 | |
65 | 78 | <!-- table区域-begin --> |
66 | 79 | <div> |
67 | -<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">--> | |
68 | -<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项--> | |
69 | -<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>--> | |
70 | -<!-- </div>--> | |
80 | + <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">--> | |
81 | + <!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项--> | |
82 | + <!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>--> | |
83 | + <!-- </div>--> | |
71 | 84 | |
72 | 85 | <a-table |
73 | 86 | ref="table" |
74 | 87 | size="middle" |
75 | - :scroll="{x:true}" | |
88 | + :scroll="{ x: true }" | |
76 | 89 | bordered |
77 | - rowKey="id" | |
90 | + :rowKey="(record,index) => {return record.zoneCode + '_' + record.materialCode}" | |
78 | 91 | :columns="columns" |
79 | 92 | :dataSource="dataSource" |
80 | 93 | :pagination="ipagination" |
81 | 94 | :loading="loading" |
82 | 95 | :customRow="clickThenSelect" |
83 | - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" | |
96 | + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio' }" | |
84 | 97 | class="j-table-force-nowrap" |
85 | - @change="handleTableChange"> | |
86 | - | |
98 | + @change="handleTableChange" | |
99 | + > | |
87 | 100 | <span slot="companyCode" slot-scope="companyCode"> |
88 | - <a-tag :key="companyCode" color=blue> | |
101 | + <a-tag :key="companyCode" color="blue"> | |
89 | 102 | {{ solutionCompany(companyCode) }} |
90 | 103 | </a-tag> |
91 | 104 | </span> |
92 | 105 | |
93 | 106 | <span slot="zoneCode" slot-scope="zoneCode"> |
94 | - <a-tag :key="zoneCode" color=blue> | |
107 | + <a-tag :key="zoneCode" color="blue"> | |
95 | 108 | {{ solutionZoneCode(zoneCode) }} |
96 | 109 | </a-tag> |
97 | 110 | </span> |
98 | - | |
99 | - <template slot="htmlSlot" slot-scope="text"> | |
100 | - <div v-html="text"></div> | |
101 | - </template> | |
102 | - <template slot="imgSlot" slot-scope="text"> | |
103 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
104 | - <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
105 | - </template> | |
106 | - <template slot="fileSlot" slot-scope="text"> | |
107 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
108 | - <a-button | |
109 | - v-else | |
110 | - :ghost="true" | |
111 | - type="primary" | |
112 | - icon="download" | |
113 | - size="small" | |
114 | - @click="downloadFile(text)"> | |
115 | - 下载 | |
116 | - </a-button> | |
117 | - </template> | |
118 | - | |
119 | 111 | </a-table> |
120 | 112 | </div> |
121 | 113 | |
122 | 114 | <a-tabs defaultActiveKey="1"> |
123 | 115 | <a-tab-pane tab="库存详情" key="1"> |
124 | - <InventoryDetailSubTable :mainId="selectedMainId"/> | |
116 | + <InventoryDetailSubTable :mainId="selectedMainId" /> | |
125 | 117 | </a-tab-pane> |
126 | 118 | </a-tabs> |
127 | 119 | |
... | ... | @@ -130,169 +122,171 @@ |
130 | 122 | </template> |
131 | 123 | |
132 | 124 | <script> |
125 | +import '@/assets/less/TableExpand.less' | |
126 | +import { filterObj } from '@/utils/util' | |
127 | +import { mixinDevice } from '@/utils/mixin' | |
128 | +import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
129 | +import { getCompanyList, getZoneList, ajaxGetDictItems } from '@/api/api' | |
130 | +// import InventoryDetailList from './InventoryDetailList' | |
131 | +import InventoryDetailSubTable from './subTables/InventoryDetailSubTable' | |
133 | 132 | |
134 | - import '@/assets/less/TableExpand.less' | |
135 | - import { mixinDevice } from '@/utils/mixin' | |
136 | - import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
137 | - import { getCompanyList, getZoneList } from '@/api/api' | |
138 | - import InventoryDetailList from './InventoryDetailList' | |
139 | - import InventoryDetailSubTable from './subTables/InventoryDetailSubTable' | |
140 | - | |
141 | - export default { | |
142 | - name: 'InventoryMaterialSummaryList', | |
143 | - mixins:[JeecgListMixin, mixinDevice], | |
144 | - components: { | |
145 | - InventoryDetailSubTable, | |
146 | - InventoryDetailList | |
147 | - }, | |
148 | - data () { | |
149 | - return { | |
150 | - zoneList: [], | |
151 | - selectedMainId: '', | |
152 | - description: '物料汇总主表管理页面', | |
153 | - // 表头 | |
154 | - companyList: [], | |
155 | - columns: [ | |
156 | - // { | |
157 | - // title: '库存ID', | |
158 | - // align: "center", | |
159 | - // dataIndex: 'id' | |
160 | - // }, | |
161 | - // { | |
162 | - // title:'仓库', | |
163 | - // align:"center", | |
164 | - // dataIndex: 'warehouseCode' | |
165 | - // }, | |
166 | - { | |
167 | - title: '库区', | |
168 | - align: "center", | |
169 | - dataIndex: 'zoneCode', | |
170 | - key: 'zoneCode', | |
171 | - scopedSlots: {customRender: 'zoneCode'} | |
172 | - }, | |
173 | - { | |
174 | - title:'货主', | |
175 | - align:"center", | |
176 | - dataIndex: 'companyCode', | |
177 | - key: 'companyCode', | |
178 | - scopedSlots: {customRender: 'companyCode'} | |
179 | - }, | |
180 | - { | |
181 | - title:'物料编码', | |
182 | - align:"center", | |
183 | - dataIndex: 'materialCode' | |
184 | - }, | |
185 | - { | |
186 | - title:'物料名称', | |
187 | - align:"center", | |
188 | - dataIndex: 'materialName' | |
189 | - }, | |
190 | - { | |
191 | - title:'物料规格', | |
192 | - align:"center", | |
193 | - dataIndex: 'materialSpec' | |
194 | - }, | |
195 | - { | |
196 | - title:'物料单位', | |
197 | - align:"center", | |
198 | - dataIndex: 'materialUnit' | |
199 | - }, | |
200 | - { | |
201 | - title:'物料总数', | |
202 | - align:"center", | |
203 | - dataIndex: 'qty' | |
204 | - } | |
205 | - ], | |
206 | - url: { | |
207 | - list: "/InventoryMaterialSummary/inventoryMaterialSummary/list", | |
208 | - exportXlsUrl: "/InventoryMaterialSummary/inventoryMaterialSummary/exportXls", | |
209 | - importExcelUrl: "InventoryMaterialSummary/inventoryMaterialSummary/importExcel", | |
210 | - | |
133 | +export default { | |
134 | + name: 'InventoryMaterialSummaryList', | |
135 | + mixins: [JeecgListMixin, mixinDevice], | |
136 | + components: { | |
137 | + InventoryDetailSubTable | |
138 | + }, | |
139 | + data() { | |
140 | + return { | |
141 | + zoneList: [], | |
142 | + companyList: [], | |
143 | + selectedMainId: '', | |
144 | + description: '物料汇总主表管理页面', | |
145 | + // 表头 | |
146 | + columns: [ | |
147 | + { | |
148 | + title: '库区', | |
149 | + align: 'center', | |
150 | + dataIndex: 'zoneCode', | |
151 | + key: 'zoneCode', | |
152 | + scopedSlots: { customRender: 'zoneCode' } | |
153 | + }, | |
154 | + { | |
155 | + title: '货主', | |
156 | + align: 'center', | |
157 | + dataIndex: 'companyCode', | |
158 | + key: 'companyCode', | |
159 | + scopedSlots: { customRender: 'companyCode' } | |
160 | + }, | |
161 | + { | |
162 | + title: '物料编码', | |
163 | + align: 'center', | |
164 | + dataIndex: 'materialCode' | |
165 | + }, | |
166 | + { | |
167 | + title: '物料名称', | |
168 | + align: 'center', | |
169 | + dataIndex: 'materialName' | |
170 | + }, | |
171 | + { | |
172 | + title: '物料规格', | |
173 | + align: 'center', | |
174 | + dataIndex: 'materialSpec' | |
211 | 175 | }, |
212 | - dictOptions:{}, | |
213 | - superFieldList:[], | |
176 | + { | |
177 | + title: '物料单位', | |
178 | + align: 'center', | |
179 | + dataIndex: 'materialUnit' | |
180 | + }, | |
181 | + { | |
182 | + title: '物料总数', | |
183 | + align: 'center', | |
184 | + dataIndex: 'qty' | |
185 | + } | |
186 | + ], | |
187 | + url: { | |
188 | + list: '/InventoryMaterialSummary/inventoryMaterialSummary/list', | |
189 | + exportXlsUrl: '/InventoryMaterialSummary/inventoryMaterialSummary/exportXls', | |
190 | + importExcelUrl: 'InventoryMaterialSummary/inventoryMaterialSummary/importExcel' | |
191 | + }, | |
192 | + dictOptions: {}, | |
193 | + superFieldList: [] | |
194 | + } | |
195 | + }, | |
196 | + created() { | |
197 | + this.getSuperFieldList() | |
198 | + this.loadFrom() | |
199 | + }, | |
200 | + computed: { | |
201 | + importExcelUrl: function() { | |
202 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}` | |
203 | + } | |
204 | + }, | |
205 | + methods: { | |
206 | + getQueryParams() { | |
207 | + // 重写查询条件 | |
208 | + let sqp = {} | |
209 | + if (this.superQueryParams) { | |
210 | + sqp['superQueryParams'] = encodeURI(this.superQueryParams) | |
211 | + sqp['superQueryMatchType'] = this.superQueryMatchType | |
214 | 212 | } |
213 | + var param = Object.assign(sqp, this.queryParam, {}, this.filters) | |
214 | + param.field = this.getQueryField() | |
215 | + param.pageNo = this.ipagination.current | |
216 | + param.pageSize = this.ipagination.pageSize | |
217 | + return filterObj(param) | |
215 | 218 | }, |
216 | - created() { | |
217 | - this.getSuperFieldList(); | |
218 | - this.loadFrom(); | |
219 | + solutionZoneCode(value) { | |
220 | + var actions = [] | |
221 | + Object.keys(this.zoneList).some(key => { | |
222 | + if (this.zoneList[key].code === '' + value) { | |
223 | + actions.push(this.zoneList[key].name) | |
224 | + return true | |
225 | + } | |
226 | + }) | |
227 | + return actions.join('') | |
219 | 228 | }, |
220 | - computed: { | |
221 | - importExcelUrl: function(){ | |
222 | - return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
223 | - }, | |
229 | + solutionCompany(value) { | |
230 | + var actions = [] | |
231 | + Object.keys(this.companyList).some(key => { | |
232 | + if (this.companyList[key].code === '' + value) { | |
233 | + actions.push(this.companyList[key].name) | |
234 | + return true | |
235 | + } | |
236 | + }) | |
237 | + return actions.join('') | |
224 | 238 | }, |
225 | - methods: { | |
226 | - solutionZoneCode(value) { | |
227 | - var actions = [] | |
228 | - Object.keys(this.zoneList).some(key => { | |
229 | - if (this.zoneList[key].code == '' + value) { | |
230 | - actions.push(this.zoneList[key].name) | |
231 | - return true | |
232 | - } | |
233 | - }) | |
234 | - return actions.join('') | |
235 | - }, | |
236 | - loadFrom() { | |
237 | - getZoneList().then((res) => { | |
238 | - if (res.success) { | |
239 | - this.zoneList = res.result | |
240 | - } | |
241 | - }); | |
242 | - getCompanyList().then((res) => { | |
243 | - if (res.success) { | |
244 | - this.companyList = res.result | |
245 | - } | |
246 | - }); | |
247 | - }, | |
248 | - | |
249 | - clickThenSelect(record) { | |
250 | - return { | |
251 | - on: { | |
252 | - click: () => { | |
253 | - this.onSelectChange(record.id.toString().split(","), [record]); | |
254 | - } | |
255 | - } | |
239 | + loadFrom() { | |
240 | + getZoneList().then(res => { | |
241 | + if (res.success) { | |
242 | + this.zoneList = res.result | |
256 | 243 | } |
257 | - }, | |
258 | - onSelectChange(selectedRowKeys, selectionRows) { | |
259 | - this.selectedMainId = selectedRowKeys[0].toString(); | |
260 | - this.selectedRowKeys = selectedRowKeys; | |
261 | - this.selectionRows = selectionRows; | |
262 | - }, | |
263 | - onClearSelected() { | |
264 | - this.selectedMainId = '' | |
265 | - this.selectedRowKeys = []; | |
266 | - this.selectionRows = []; | |
267 | - }, | |
268 | - initDictConfig(){ | |
269 | - }, | |
270 | - solutionCompany(value) { | |
271 | - var actions = [] | |
272 | - Object.keys(this.companyList).some((key) => { | |
273 | - if (this.companyList[key].code == ('' + value)) { | |
274 | - actions.push(this.companyList[key].name) | |
275 | - return true | |
244 | + }) | |
245 | + ajaxGetDictItems('box_type').then(res => { | |
246 | + if (res.success) { | |
247 | + this.boxTypeList = res.result | |
248 | + } | |
249 | + }) | |
250 | + getCompanyList().then(res => { | |
251 | + if (res.success) { | |
252 | + this.companyList = res.result | |
253 | + } | |
254 | + }) | |
255 | + }, | |
256 | + clickThenSelect(record) { | |
257 | + return { | |
258 | + on: { | |
259 | + click: () => { | |
260 | + this.onSelectChange(record.materialCode.toString().split(','), [record]) | |
276 | 261 | } |
277 | - }) | |
278 | - return actions.join('') | |
279 | - }, | |
280 | - | |
281 | - getSuperFieldList(){ | |
282 | - let fieldList=[]; | |
283 | - fieldList.push({type:'string',value:'warehouseCode',text:'仓库',dictCode:''}) | |
284 | - fieldList.push({type:'string',value:'zoneCode',text:'库区',dictCode:''}) | |
285 | - fieldList.push({type:'string',value:'companyCode_dec',text:'货主',dictCode:''}) | |
286 | - fieldList.push({type:'string',value:'materialCode',text:'物料编码',dictCode:''}) | |
287 | - fieldList.push({type:'string',value:'materialName',text:'物料名称',dictCode:''}) | |
288 | - fieldList.push({type:'string',value:'materialSpec',text:'物料规格',dictCode:''}) | |
289 | - fieldList.push({type:'string',value:'materialUnit',text:'物料单位',dictCode:''}) | |
290 | - fieldList.push({type:'BigDecimal',value:'qty',text:'物料总数',dictCode:''}) | |
291 | - this.superFieldList = fieldList | |
262 | + } | |
292 | 263 | } |
264 | + }, | |
265 | + onSelectChange(selectedRowKeys, selectionRows) { | |
266 | + this.selectedMainId = selectionRows[0].zoneCode.toString() + "_" + selectionRows[0].materialCode.toString() | |
267 | + this.selectedRowKeys = selectedRowKeys | |
268 | + this.selectionRows = selectionRows | |
269 | + }, | |
270 | + onClearSelected() { | |
271 | + this.selectedMainId = '' | |
272 | + this.selectedRowKeys = [] | |
273 | + this.selectionRows = [] | |
274 | + }, | |
275 | + initDictConfig() {}, | |
276 | + getSuperFieldList() { | |
277 | + let fieldList = [] | |
278 | + fieldList.push({ type: 'string', value: 'zoneCode', text: '库区', dictCode: '' }) | |
279 | + fieldList.push({ type: 'string', value: 'companyCode', text: '货主', dictCode: '' }) | |
280 | + fieldList.push({ type: 'string', value: 'materialCode', text: '物料编码', dictCode: '' }) | |
281 | + fieldList.push({ type: 'string', value: 'materialName', text: '物料名称', dictCode: '' }) | |
282 | + fieldList.push({ type: 'string', value: 'materialSpec', text: '物料规格', dictCode: '' }) | |
283 | + fieldList.push({ type: 'string', value: 'materialUnit', text: '物料单位', dictCode: '' }) | |
284 | + fieldList.push({ type: 'BigDecimal', value: 'qty', text: '物料总数', dictCode: '' }) | |
285 | + this.superFieldList = fieldList | |
293 | 286 | } |
294 | 287 | } |
288 | +} | |
295 | 289 | </script> |
296 | 290 | <style scoped> |
297 | - @import '~@assets/less/common.less'; | |
291 | +@import '~@assets/less/common.less'; | |
298 | 292 | </style> |
299 | 293 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/views/system/inventory/subTables/InventoryDetailSubTable.vue
... | ... | @@ -2,86 +2,43 @@ |
2 | 2 | <a-card :bordered="false" :class="'cust-erp-sub-tab'"> |
3 | 3 | <!-- 操作按钮区域 --> |
4 | 4 | <div class="table-operator" v-if="mainId"> |
5 | - <a-button v-has="'inventoryDetail:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
5 | + <!-- <a-button v-has="'inventoryDetail:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button> --> | |
6 | 6 | <a-button type="primary" icon="download" @click="handleExportXls('库存详情')">导出</a-button> |
7 | - <a-upload | |
8 | - name="file" | |
9 | - :showUploadList="false" | |
10 | - :multiple="false" | |
11 | - :headers="tokenHeader" | |
12 | - :action="importExcelUrl" | |
13 | - @change="handleImportExcel"> | |
14 | - <a-button type="primary" icon="import">导入</a-button> | |
15 | - </a-upload> | |
16 | - <a-dropdown v-if="selectedRowKeys.length > 0"> | |
17 | - <a-menu slot="overlay" v-has="'inventoryDetail:deleteBatch'"> | |
18 | - <a-menu-item key="1" @click="batchDel"> | |
19 | - <a-icon type="delete"/> | |
20 | - 删除 | |
21 | - </a-menu-item> | |
22 | - </a-menu> | |
23 | - <a-button style="margin-left: 8px"> 批量操作 | |
24 | - <a-icon type="down"/> | |
25 | - </a-button> | |
26 | - </a-dropdown> | |
27 | 7 | </div> |
28 | 8 | |
29 | 9 | <!-- table区域-begin --> |
30 | 10 | <div> |
31 | - <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
32 | - <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a | |
33 | - style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项 | |
34 | - <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
35 | - </div> | |
36 | - | |
37 | 11 | <a-table |
38 | 12 | ref="table" |
39 | 13 | size="middle" |
40 | 14 | bordered |
41 | 15 | rowKey="id" |
42 | - :scroll="{x:true}" | |
16 | + :scroll="{ x: true }" | |
43 | 17 | :columns="columns" |
44 | 18 | :dataSource="dataSource" |
45 | 19 | :pagination="ipagination" |
46 | 20 | :loading="loading" |
47 | - :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
48 | - @change="handleTableChange"> | |
49 | - | |
50 | - <span slot="inventoryStatus_dictText" slot-scope="inventoryStatus_dictText"> | |
21 | + @change="handleTableChange" | |
22 | + class='j-table-force-nowrap' | |
23 | + > | |
24 | + | |
25 | + <span slot="inventoryStatus_dictText" slot-scope="inventoryStatus_dictText"> | |
51 | 26 | <a-tag :key="inventoryStatus_dictText" :color="getStatusColor(inventoryStatus_dictText)"> |
52 | 27 | {{ inventoryStatus_dictText }} |
53 | 28 | </a-tag> |
54 | 29 | </span> |
55 | - | |
30 | + | |
56 | 31 | <span slot="companyCode" slot-scope="companyCode"> |
57 | - <a-tag :key="companyCode" color=blue> | |
32 | + <a-tag :key="companyCode" color="blue"> | |
58 | 33 | {{ solutionCompany(companyCode) }} |
59 | 34 | </a-tag> |
60 | 35 | </span> |
61 | 36 | |
62 | - <template slot="htmlSlot" slot-scope="text"> | |
63 | - <div v-html="text"></div> | |
64 | - </template> | |
65 | - <template slot="imgSlot" slot-scope="text"> | |
66 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
67 | - <img v-else :src="getImgView(text)" height="25px" alt="" | |
68 | - style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
69 | - </template> | |
70 | - <template slot="fileSlot" slot-scope="text"> | |
71 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
72 | - <a-button | |
73 | - v-else | |
74 | - :ghost="true" | |
75 | - type="primary" | |
76 | - icon="download" | |
77 | - size="small" | |
78 | - @click="downloadFile(text)"> | |
79 | - 下载 | |
80 | - </a-button> | |
81 | - </template> | |
82 | - | |
83 | - | |
84 | - | |
37 | + <span slot="zoneCode" slot-scope="zoneCode"> | |
38 | + <a-tag :key="zoneCode" color="blue"> | |
39 | + {{ solutionZoneCode(zoneCode) }} | |
40 | + </a-tag> | |
41 | + </span> | |
85 | 42 | </a-table> |
86 | 43 | </div> |
87 | 44 | |
... | ... | @@ -90,15 +47,14 @@ |
90 | 47 | </template> |
91 | 48 | |
92 | 49 | <script> |
93 | - | |
94 | -import {JeecgListMixin} from '@/mixins/JeecgListMixin' | |
50 | +import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
95 | 51 | import InventoryDetailModal from '../modules/InventoryDetailModal' |
96 | -import {getCompanyList} from '@/api/api' | |
52 | +import { getCompanyList, getZoneList } from '@/api/api' | |
97 | 53 | |
98 | 54 | export default { |
99 | - name: "InventoryDetailSubTable", | |
55 | + name: 'InventoryDetailSubTable', | |
100 | 56 | mixins: [JeecgListMixin], |
101 | - components: {InventoryDetailModal}, | |
57 | + components: { InventoryDetailModal }, | |
102 | 58 | props: { |
103 | 59 | mainId: { |
104 | 60 | type: String, |
... | ... | @@ -113,90 +69,99 @@ export default { |
113 | 69 | if (!this.mainId) { |
114 | 70 | this.clearList() |
115 | 71 | } else { |
116 | - this.queryParam['id'] = val | |
117 | - this.loadData(1); | |
72 | + this.queryParam['zoneCode'] = val.split("_")[0]; | |
73 | + this.queryParam['materialCode'] = val.split("_")[1]; | |
74 | + this.loadData(1) | |
118 | 75 | } |
119 | 76 | } |
120 | 77 | } |
121 | 78 | }, |
122 | 79 | data() { |
123 | 80 | return { |
124 | - description: '库存表管理页面', | |
81 | + description: '库存物料汇总详情页面', | |
125 | 82 | disableMixinCreated: true, |
126 | 83 | companyList: [], |
84 | + zoneList: [], | |
127 | 85 | // 表头 |
128 | 86 | columns: [ |
129 | 87 | { |
130 | 88 | title: '库存详情ID', |
131 | - align: "center", | |
89 | + align: 'center', | |
132 | 90 | dataIndex: 'id' |
133 | 91 | }, |
134 | 92 | { |
135 | 93 | title: '货主', |
136 | - align: "center", | |
94 | + align: 'center', | |
137 | 95 | dataIndex: 'companyCode', |
138 | 96 | key: 'companyCode', |
139 | - scopedSlots: {customRender: 'companyCode'} | |
97 | + scopedSlots: { customRender: 'companyCode' } | |
140 | 98 | }, |
141 | 99 | { |
142 | 100 | title: '库区', |
143 | - align: "center", | |
144 | - dataIndex: 'zoneCode' | |
101 | + align: 'center', | |
102 | + dataIndex: 'zoneCode', | |
103 | + key: 'zoneCode', | |
104 | + scopedSlots: { customRender: 'zoneCode' } | |
145 | 105 | }, |
146 | 106 | { |
147 | - title: '容器编码', | |
148 | - align: "center", | |
149 | - dataIndex: 'containerCode' | |
107 | + title: '库位编码', | |
108 | + align: 'center', | |
109 | + dataIndex: 'locationCode' | |
150 | 110 | }, |
151 | 111 | { |
152 | - title: '库位编码', | |
112 | + title: '容器编码', | |
153 | 113 | align: "center", |
154 | - dataIndex: 'locationCode' | |
114 | + dataIndex: 'containerCode' | |
155 | 115 | }, |
156 | 116 | { |
157 | 117 | title: '物料编码', |
158 | - align: "center", | |
118 | + align: 'center', | |
159 | 119 | dataIndex: 'materialCode' |
160 | 120 | }, |
161 | 121 | { |
162 | 122 | title: '物料名称', |
163 | - align: "center", | |
123 | + align: 'center', | |
164 | 124 | dataIndex: 'materialName' |
165 | 125 | }, |
166 | - { | |
167 | - title: '物料规格', | |
168 | - align: "center", | |
169 | - dataIndex: 'materialSpec' | |
170 | - }, | |
126 | + // { | |
127 | + // title: '物料规格', | |
128 | + // align: 'center', | |
129 | + // dataIndex: 'materialSpec' | |
130 | + // }, | |
171 | 131 | { |
172 | 132 | title: '物料单位', |
173 | - align: "center", | |
133 | + align: 'center', | |
174 | 134 | dataIndex: 'materialUnit' |
175 | 135 | }, |
176 | 136 | { |
177 | 137 | title: '数量', |
178 | - align: "center", | |
138 | + align: 'center', | |
179 | 139 | dataIndex: 'qty' |
180 | 140 | }, |
181 | 141 | { |
182 | 142 | title: '任务锁定数量', |
183 | - align: "center", | |
143 | + align: 'center', | |
184 | 144 | dataIndex: 'taskQty' |
185 | 145 | }, |
186 | 146 | { |
187 | 147 | title: '库存状态', |
188 | - align: "center", | |
148 | + align: 'center', | |
189 | 149 | dataIndex: 'inventoryStatus_dictText', |
190 | 150 | scopedSlots: {customRender: 'inventoryStatus_dictText'} |
191 | 151 | }, |
192 | 152 | { |
153 | + title: '容器状态', | |
154 | + align: 'center', | |
155 | + dataIndex: 'containerStatus_dictText' | |
156 | + }, | |
157 | + { | |
193 | 158 | title: '批次', |
194 | 159 | align: "center", |
195 | 160 | dataIndex: 'batch' |
196 | 161 | }, |
197 | 162 | { |
198 | 163 | title: '唯一号', |
199 | - align: "center", | |
164 | + align: 'center', | |
200 | 165 | dataIndex: 'uniqueCode' |
201 | 166 | }, |
202 | 167 | { |
... | ... | @@ -206,53 +171,53 @@ export default { |
206 | 171 | }, |
207 | 172 | { |
208 | 173 | title: '库龄(天)', |
209 | - align: "center", | |
174 | + align: 'center', | |
210 | 175 | dataIndex: 'inventoryAge' |
211 | 176 | }, |
212 | 177 | { |
213 | 178 | title: '创建人', |
214 | - align: "center", | |
179 | + align: 'center', | |
215 | 180 | dataIndex: 'createBy' |
216 | 181 | }, |
217 | 182 | { |
218 | 183 | title: '创建日期', |
219 | - align: "center", | |
184 | + align: 'center', | |
220 | 185 | dataIndex: 'createTime' |
221 | 186 | }, |
222 | 187 | { |
223 | 188 | title: '更新人', |
224 | - align: "center", | |
189 | + align: 'center', | |
225 | 190 | dataIndex: 'updateBy' |
226 | 191 | }, |
227 | 192 | { |
228 | 193 | title: '更新日期', |
229 | - align: "center", | |
230 | - }, | |
231 | - { | |
232 | - title: '操作', | |
233 | - dataIndex: 'action', | |
234 | - align:"center", | |
235 | - fixed:"right", | |
236 | - width:147, | |
237 | - scopedSlots: { customRender: 'action' } | |
194 | + align: 'center' | |
238 | 195 | }, |
196 | + // { | |
197 | + // title: '操作', | |
198 | + // dataIndex: 'action', | |
199 | + // align: 'center', | |
200 | + // fixed: 'right', | |
201 | + // width: 147, | |
202 | + // scopedSlots: { customRender: 'action' } | |
203 | + // } | |
239 | 204 | ], |
240 | 205 | url: { |
241 | - list: "/InventoryMaterialSummary/inventoryMaterialSummary/inventoryMaterialSummaryChild", | |
242 | - exportXlsUrl: "/inventory/inventoryHeader/exportInventoryDetail", | |
243 | - importUrl: "/inventory/inventoryHeader/importInventoryDetail", | |
206 | + list: '/InventoryMaterialSummary/inventoryMaterialSummary/inventoryMaterialSummaryChild', | |
207 | + exportXlsUrl: '/inventory/inventoryHeader/exportInventoryDetail', | |
208 | + importUrl: '/inventory/inventoryHeader/importInventoryDetail' | |
244 | 209 | }, |
245 | 210 | dictOptions: { |
246 | - containerStatus: [], | |
211 | + containerStatus: [] | |
247 | 212 | } |
248 | 213 | } |
249 | 214 | }, |
250 | 215 | created() { |
251 | - this.loadFrom(); | |
216 | + this.loadFrom() | |
252 | 217 | }, |
253 | 218 | computed: { |
254 | 219 | importExcelUrl() { |
255 | - return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; | |
220 | + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}` | |
256 | 221 | } |
257 | 222 | }, |
258 | 223 | methods: { |
... | ... | @@ -267,31 +232,45 @@ export default { |
267 | 232 | return colors[status] || colors.default; |
268 | 233 | }, |
269 | 234 | loadFrom() { |
270 | - getCompanyList().then((res) => { | |
235 | + getCompanyList().then(res => { | |
271 | 236 | if (res.success) { |
272 | 237 | this.companyList = res.result |
273 | 238 | } |
274 | - }); | |
239 | + }) | |
240 | + getZoneList().then(res => { | |
241 | + if (res.success) { | |
242 | + this.zoneList = res.result | |
243 | + } | |
244 | + }) | |
275 | 245 | }, |
276 | 246 | solutionCompany(value) { |
277 | - var actions = [] | |
278 | - Object.keys(this.companyList).some((key) => { | |
279 | - if (this.companyList[key].code == ('' + value)) { | |
247 | + let actions = [] | |
248 | + Object.keys(this.companyList).some(key => { | |
249 | + if (this.companyList[key].code === '' + value) { | |
280 | 250 | actions.push(this.companyList[key].name) |
281 | 251 | return true |
282 | 252 | } |
283 | 253 | }) |
284 | 254 | return actions.join('') |
285 | 255 | }, |
256 | + solutionZoneCode(value) { | |
257 | + let actions = [] | |
258 | + Object.keys(this.zoneList).some(key => { | |
259 | + if (this.zoneList[key].code === '' + value) { | |
260 | + actions.push(this.zoneList[key].name) | |
261 | + return true | |
262 | + } | |
263 | + }) | |
264 | + return actions.join('') | |
265 | + }, | |
286 | 266 | clearList() { |
287 | 267 | this.dataSource = [] |
288 | 268 | this.selectedRowKeys = [] |
289 | 269 | this.ipagination.current = 1 |
290 | 270 | } |
291 | - | |
292 | 271 | } |
293 | 272 | } |
294 | 273 | </script> |
295 | 274 | <style scoped> |
296 | -@import '~@assets/less/common.less' | |
275 | +@import '~@assets/less/common.less'; | |
297 | 276 | </style> |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/InventoryMaterialSummary/controller/InventoryMaterialSummaryController.java
1 | 1 | package org.jeecg.modules.wms.inventory.InventoryMaterialSummary.controller; |
2 | 2 | |
3 | -import java.util.List; | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
5 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
4 | 7 | |
5 | -import javax.annotation.Resource; | |
6 | -import javax.servlet.http.HttpServletRequest; | |
7 | -import javax.servlet.http.HttpServletResponse; | |
8 | +import cn.hutool.core.collection.CollUtil; | |
9 | +import io.swagger.annotations.Api; | |
10 | +import io.swagger.annotations.ApiOperation; | |
11 | +import lombok.extern.slf4j.Slf4j; | |
8 | 12 | |
13 | +import org.apache.commons.beanutils.PropertyUtils; | |
14 | +import org.apache.shiro.SecurityUtils; | |
9 | 15 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
10 | 16 | import org.jeecg.common.api.vo.Result; |
11 | 17 | import org.jeecg.common.system.base.controller.JeecgController; |
12 | 18 | import org.jeecg.common.system.query.QueryGenerator; |
19 | +import org.jeecg.common.system.vo.LoginUser; | |
20 | +import org.jeecg.common.util.oConvertUtils; | |
21 | +import org.jeecg.modules.system.entity.SysUser; | |
22 | +import org.jeecg.modules.system.service.ISysUserService; | |
23 | +import org.jeecg.modules.wms.inventory.InventoryMaterialSummary.entity.InventoryMaterialSummary; | |
13 | 24 | import org.jeecg.modules.wms.inventory.InventoryMaterialSummary.service.IInventoryMaterialSummaryService; |
14 | 25 | import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; |
15 | 26 | import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; |
16 | -import org.jeecg.modules.wms.inventory.inventoryHeader.service.impl.InventoryDetailServiceImpl; | |
17 | 27 | import org.jeecg.utils.HuahengJwtUtil; |
18 | 28 | import org.jeecg.utils.StringUtils; |
29 | +import org.jeecgframework.poi.excel.entity.ExportParams; | |
30 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
31 | +import org.springframework.beans.BeanUtils; | |
32 | +import org.springframework.beans.factory.annotation.Value; | |
19 | 33 | import org.springframework.web.bind.annotation.*; |
20 | 34 | import org.springframework.web.servlet.ModelAndView; |
21 | 35 | |
22 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
23 | -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
24 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
25 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
36 | +import javax.annotation.Resource; | |
37 | +import javax.servlet.http.HttpServletRequest; | |
38 | +import javax.servlet.http.HttpServletResponse; | |
26 | 39 | |
27 | -import io.swagger.annotations.Api; | |
28 | -import io.swagger.annotations.ApiOperation; | |
29 | -import lombok.extern.slf4j.Slf4j; | |
40 | +import java.math.BigDecimal; | |
41 | +import java.util.Arrays; | |
42 | +import java.util.LinkedList; | |
43 | +import java.util.List; | |
44 | +import java.util.Map; | |
45 | +import java.util.stream.Collectors; | |
30 | 46 | |
31 | 47 | /** |
32 | - * @Description: 物料汇总主表 | |
48 | + * @Description: 库存物料汇总 | |
33 | 49 | * @Author: jeecg-boot |
34 | 50 | * @Date: 2023-02-22 |
35 | 51 | * @Version: V1.0 |
36 | 52 | */ |
37 | -@Api(tags = "物料汇总主表") | |
53 | +@Api(tags = "库存物料汇总") | |
38 | 54 | @RestController |
39 | 55 | @RequestMapping("/InventoryMaterialSummary/inventoryMaterialSummary") |
40 | 56 | @Slf4j |
41 | 57 | public class InventoryMaterialSummaryController extends JeecgController<InventoryDetail, IInventoryMaterialSummaryService> { |
58 | + | |
42 | 59 | @Resource |
43 | 60 | private IInventoryDetailService inventoryDetailService; |
44 | 61 | |
45 | 62 | @Resource |
46 | 63 | private IInventoryMaterialSummaryService inventoryMaterialSummaryService; |
47 | 64 | |
65 | + @Resource | |
66 | + private ISysUserService sysUserService; | |
67 | + | |
68 | + @Value("${jeecg.path.upload}") | |
69 | + private String upLoadPath; | |
70 | + | |
48 | 71 | /** |
49 | - * 分页列表查询 | |
72 | + * 库存物料汇总-分页主表查询 | |
50 | 73 | * @param pageNo |
51 | 74 | * @param pageSize |
52 | 75 | * @param req |
53 | 76 | * @return |
54 | 77 | */ |
55 | - @ApiOperation(value = "物料汇总主表-分页列表查询", notes = "物料汇总主表-分页列表查询") | |
78 | + @ApiOperation(value = "库存物料汇总-分页主表查询", notes = "库存物料汇总-分页主表查询") | |
56 | 79 | @GetMapping(value = "/list") |
57 | 80 | public Result<IPage<InventoryDetail>> queryPageList(InventoryDetail inventoryDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
58 | 81 | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { |
59 | 82 | HuahengJwtUtil.setWarehouseCode(req, inventoryDetail); |
60 | 83 | QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, req.getParameterMap()); |
84 | + queryWrapper.select("zone_code, company_code, material_code, material_name,material_spec, material_unit, SUM(qty) as qty"); | |
85 | + queryWrapper.groupBy("zone_code", "company_code", "material_code", "material_name", "material_spec", "material_unit"); | |
61 | 86 | Page<InventoryDetail> page = new Page<InventoryDetail>(pageNo, pageSize); |
62 | 87 | IPage<InventoryDetail> pageList = inventoryDetailService.page(page, queryWrapper); |
63 | - // 筛选库存汇总数据的专用方法 | |
64 | - pageList.setRecords(inventoryMaterialSummaryService.duplicateRemoval(pageList.getRecords())); | |
65 | 88 | return Result.OK(pageList); |
66 | 89 | } |
67 | 90 | |
68 | 91 | /** |
69 | - * 分页列表明细情况 | |
92 | + * 库存物料汇总-分页明细查询 | |
70 | 93 | * @param pageNo |
71 | 94 | * @param pageSize |
72 | 95 | * @param req |
73 | 96 | * @return |
74 | 97 | */ |
75 | - @ApiOperation(value = "物料汇总主表-库存汇总明细子单", notes = "物料汇总主表-库存汇总明细子单") | |
98 | + @ApiOperation(value = "库存物料汇总-分页明细查询", notes = "库存物料汇总-分页明细查询") | |
76 | 99 | @GetMapping(value = "/inventoryMaterialSummaryChild") |
77 | 100 | public Result<IPage<InventoryDetail>> inventoryMaterialSummaryChild(InventoryDetail inventoryDetail, |
78 | 101 | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
79 | 102 | HttpServletRequest req) { |
80 | - inventoryDetail = inventoryDetailService.getById(inventoryDetail.getId()); | |
81 | - LambdaQueryWrapper<InventoryDetail> queryWrapper = new LambdaQueryWrapper<>(); | |
82 | - queryWrapper.eq(InventoryDetail::getMaterialCode, inventoryDetail.getMaterialCode()).eq(InventoryDetail::getMaterialName, inventoryDetail.getMaterialName()) | |
83 | - .eq(StringUtils.isNotEmpty(inventoryDetail.getMaterialSpec()), InventoryDetail::getMaterialSpec, inventoryDetail.getMaterialSpec()) | |
84 | - .eq(StringUtils.isNotEmpty(inventoryDetail.getMaterialUnit()), InventoryDetail::getMaterialUnit, inventoryDetail.getMaterialUnit()); | |
85 | - | |
103 | + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, req.getParameterMap()); | |
86 | 104 | Page<InventoryDetail> page = new Page<InventoryDetail>(pageNo, pageSize); |
87 | 105 | IPage<InventoryDetail> pageList = inventoryDetailService.page(page, queryWrapper); |
88 | 106 | inventoryDetailService.calculateInventoryAge(pageList.getRecords());// 计算库龄 |
... | ... | @@ -90,14 +108,51 @@ public class InventoryMaterialSummaryController extends JeecgController<Inventor |
90 | 108 | } |
91 | 109 | |
92 | 110 | /** |
93 | - * 导出excel | |
111 | + * 库存物料汇总-主表导出Excel | |
94 | 112 | * @param request |
95 | 113 | * @param inventoryMaterialSummary |
96 | 114 | */ |
97 | 115 | @RequestMapping(value = "/exportXls") |
98 | 116 | @RequiresPermissions("inventoryMaterialSummary:export") |
99 | - public ModelAndView exportXls(HttpServletRequest request, InventoryDetail inventoryMaterialSummary) { | |
100 | - return super.exportXls(request, inventoryMaterialSummary, InventoryDetail.class, "物料汇总主表"); | |
117 | + public ModelAndView exportXls(HttpServletRequest request, InventoryDetail inventoryDetail) { | |
118 | + HuahengJwtUtil.setWarehouseCode(request, inventoryDetail); | |
119 | + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, request.getParameterMap()); | |
120 | + queryWrapper.select("zone_code, company_code, material_code, material_name, material_spec, material_spec, material_unit, SUM(qty) as qty"); | |
121 | + queryWrapper.groupBy("zone_code", "company_code", "material_code", "material_name", "material_spec", "material_spec", "material_unit"); | |
122 | + LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); | |
123 | + List<InventoryDetail> pageList = this.service.list(queryWrapper); | |
124 | + List<InventoryDetail> exportList = null; | |
125 | + String selections = request.getParameter("selections"); | |
126 | + if (oConvertUtils.isNotEmpty(selections)) { | |
127 | + List<String> selectionList = Arrays.asList(selections.split(",")); | |
128 | + exportList = pageList.stream().filter((item) -> { | |
129 | + return selectionList.contains(this.getItemCode(item)); | |
130 | + }).collect(Collectors.toList()); | |
131 | + } else { | |
132 | + exportList = pageList; | |
133 | + } | |
134 | + List<InventoryMaterialSummary> inventoryMaterialSummaryList = CollUtil.newArrayList(); | |
135 | + for (InventoryDetail source : exportList) { | |
136 | + InventoryMaterialSummary target = new InventoryMaterialSummary(); | |
137 | + BeanUtils.copyProperties(source, target); | |
138 | + inventoryMaterialSummaryList.add(target); | |
139 | + } | |
140 | + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | |
141 | + mv.addObject("fileName", "库存物料汇总"); | |
142 | + mv.addObject("entity", InventoryMaterialSummary.class); | |
143 | + ExportParams exportParams = new ExportParams("库存物料汇总" + "报表", "导出人:" + sysUser.getRealname(), "库存物料汇总"); | |
144 | + exportParams.setImageBasePath(this.upLoadPath); | |
145 | + mv.addObject("params", exportParams); | |
146 | + mv.addObject("data", inventoryMaterialSummaryList); | |
147 | + return mv; | |
148 | + } | |
149 | + | |
150 | + private String getItemCode(InventoryDetail item) { | |
151 | + try { | |
152 | + return PropertyUtils.getProperty(item, "zoneCode").toString() + "_" + PropertyUtils.getProperty(item, "materialCode").toString(); | |
153 | + } catch (Exception var3) { | |
154 | + return null; | |
155 | + } | |
101 | 156 | } |
102 | 157 | |
103 | 158 | /** |
... | ... | @@ -111,5 +166,4 @@ public class InventoryMaterialSummaryController extends JeecgController<Inventor |
111 | 166 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
112 | 167 | return super.importExcel(request, response, InventoryDetail.class); |
113 | 168 | } |
114 | - | |
115 | 169 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/InventoryMaterialSummary/entity/InventoryMaterialSummary.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.InventoryMaterialSummary.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.math.BigDecimal; | |
5 | +import java.util.Date; | |
6 | + | |
7 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
8 | +import org.jeecg.common.aspect.annotation.Dict; | |
9 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
10 | + | |
11 | +import com.baomidou.mybatisplus.annotation.IdType; | |
12 | +import com.baomidou.mybatisplus.annotation.TableId; | |
13 | +import com.baomidou.mybatisplus.annotation.TableName; | |
14 | + | |
15 | +import io.swagger.annotations.ApiModel; | |
16 | +import io.swagger.annotations.ApiModelProperty; | |
17 | +import lombok.Data; | |
18 | +import org.springframework.format.annotation.DateTimeFormat; | |
19 | + | |
20 | +/** | |
21 | + * @Description: 库存详情 | |
22 | + * @Author: jeecg-boot | |
23 | + * @Date: 2022-11-16 | |
24 | + * @Version: V1.0 | |
25 | + */ | |
26 | +@Data | |
27 | +@ApiModel(value = "InventoryMaterialSummary对象", description = "库存物料汇总主表") | |
28 | +public class InventoryMaterialSummary implements Serializable { | |
29 | + private static final long serialVersionUID = 1L; | |
30 | + | |
31 | + /** 货主 */ | |
32 | + @Excel(name = "货主", width = 15, dictTable = "company", dicText = "name", dicCode = "code") | |
33 | + @ApiModelProperty(value = "货主") | |
34 | + private String companyCode; | |
35 | + | |
36 | + /** 库区 */ | |
37 | + @Excel(name = "库区", width = 15, dictTable = "zone", dicText = "name", dicCode = "code") | |
38 | + @ApiModelProperty(value = "库区") | |
39 | + private String zoneCode; | |
40 | + | |
41 | + /** 物料编码 */ | |
42 | + @Excel(name = "物料编码", width = 15) | |
43 | + @ApiModelProperty(value = "物料编码") | |
44 | + private String materialCode; | |
45 | + | |
46 | + /** 物料名称 */ | |
47 | + @Excel(name = "物料名称", width = 15) | |
48 | + @ApiModelProperty(value = "物料名称") | |
49 | + private String materialName; | |
50 | + | |
51 | + /** 物料规格 */ | |
52 | + @Excel(name = "物料规格", width = 15) | |
53 | + @ApiModelProperty(value = "物料规格") | |
54 | + private String materialSpec; | |
55 | + | |
56 | + /** 物料单位 */ | |
57 | + @Excel(name = "物料单位", width = 15) | |
58 | + @ApiModelProperty(value = "物料单位") | |
59 | + private String materialUnit; | |
60 | + | |
61 | + /** 数量 */ | |
62 | + @Excel(name = "数量", width = 15) | |
63 | + @ApiModelProperty(value = "数量") | |
64 | + private java.math.BigDecimal qty; | |
65 | +} | |
0 | 66 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java
... | ... | @@ -235,7 +235,7 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, |
235 | 235 | this.inventoryDetailService.removeByIds(Arrays.asList(ids.split(","))); |
236 | 236 | return Result.OK("批量删除成功!"); |
237 | 237 | } |
238 | - | |
238 | + | |
239 | 239 | /** |
240 | 240 | * 导出 |
241 | 241 | * @return |
... | ... | @@ -246,11 +246,9 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, |
246 | 246 | // Step.1 组装查询条件 |
247 | 247 | QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, request.getParameterMap()); |
248 | 248 | LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); |
249 | - | |
250 | 249 | // Step.2 获取导出数据 |
251 | 250 | List<InventoryDetail> pageList = inventoryDetailService.list(queryWrapper); |
252 | 251 | List<InventoryDetail> exportList = null; |
253 | - | |
254 | 252 | // 过滤选中数据 |
255 | 253 | String selections = request.getParameter("selections"); |
256 | 254 | if (oConvertUtils.isNotEmpty(selections)) { |
... | ... | @@ -259,7 +257,7 @@ public class InventoryHeaderController extends JeecgController<InventoryHeader, |
259 | 257 | } else { |
260 | 258 | exportList = pageList; |
261 | 259 | } |
262 | - | |
260 | + inventoryDetailService.calculateInventoryAge(exportList);// 计算库龄 | |
263 | 261 | // Step.3 AutoPoi 导出Excel |
264 | 262 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
265 | 263 | mv.addObject(NormalExcelConstants.FILE_NAME, "库存详情"); // 此处设置的filename无效 ,前端会重更新设置一下 |
... | ... |