Commit 000fb0d4aedb4c0c1d6430fd1456f65924564f26
1 parent
1b45a53b
feat: 收货模块
Showing
19 changed files
with
1937 additions
and
10 deletions
ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue
... | ... | @@ -49,6 +49,8 @@ |
49 | 49 | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
50 | 50 | @change="handleTableChange"> |
51 | 51 | |
52 | + | |
53 | + | |
52 | 54 | <span slot="status_dictText" slot-scope="status_dictText"> |
53 | 55 | <a-tag :key="status_dictText" :color="getStatusColor(status_dictText)"> |
54 | 56 | {{ status_dictText }} |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/ReceiveDetailList.vue
0 → 100644
1 | +<template> | |
2 | + <a-card :bordered="false" :class="'cust-erp-sub-tab'"> | |
3 | + <!-- 操作按钮区域 --> | |
4 | + <div class="table-operator" v-if="mainId"> | |
5 | + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
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"> | |
18 | + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |
19 | + </a-menu> | |
20 | + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |
21 | + </a-dropdown> | |
22 | + </div> | |
23 | + | |
24 | + <!-- table区域-begin --> | |
25 | + <div> | |
26 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
27 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
28 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
29 | + </div> | |
30 | + | |
31 | + <a-table | |
32 | + ref="table" | |
33 | + size="middle" | |
34 | + bordered | |
35 | + rowKey="id" | |
36 | + :scroll="{x:true}" | |
37 | + :columns="columns" | |
38 | + :dataSource="dataSource" | |
39 | + :pagination="ipagination" | |
40 | + :loading="loading" | |
41 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
42 | + @change="handleTableChange"> | |
43 | + | |
44 | + <span slot="companyCode" slot-scope="companyCode"> | |
45 | + <a-tag :key="companyCode" color=blue> | |
46 | + {{ solutionCompany(companyCode) }} | |
47 | + </a-tag> | |
48 | + </span> | |
49 | + | |
50 | + <span slot="status_dictText" slot-scope="status_dictText"> | |
51 | + <a-tag :key="status_dictText" :color="getStatusColor(status_dictText)"> | |
52 | + {{ status_dictText }} | |
53 | + </a-tag> | |
54 | + </span> | |
55 | + | |
56 | + <span slot="inventoryStatus_dictText" slot-scope="inventoryStatus_dictText"> | |
57 | + <a-tag :key="inventoryStatus_dictText" :color="getStatusColor(inventoryStatus_dictText)"> | |
58 | + {{ inventoryStatus_dictText }} | |
59 | + </a-tag> | |
60 | + </span> | |
61 | + | |
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="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
68 | + </template> | |
69 | + <template slot="fileSlot" slot-scope="text"> | |
70 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
71 | + <a-button | |
72 | + v-else | |
73 | + :ghost="true" | |
74 | + type="primary" | |
75 | + icon="download" | |
76 | + size="small" | |
77 | + @click="downloadFile(text)"> | |
78 | + 下载 | |
79 | + </a-button> | |
80 | + </template> | |
81 | + | |
82 | + <span slot="action" slot-scope="text, record"> | |
83 | + <a @click="handleEdit(record)">编辑</a> | |
84 | + <a-divider type="vertical" /> | |
85 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
86 | + <a>删除</a> | |
87 | + </a-popconfirm> | |
88 | + </span> | |
89 | + | |
90 | + </a-table> | |
91 | + </div> | |
92 | + | |
93 | + <receiveDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></receiveDetail-modal> | |
94 | + </a-card> | |
95 | +</template> | |
96 | + | |
97 | +<script> | |
98 | + | |
99 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
100 | + import ReceiveDetailModal from './modules/ReceiveDetailModal' | |
101 | + import {getCompanyList, getSupplierList} from "@api/api"; | |
102 | + | |
103 | + export default { | |
104 | + name: "ReceiveDetailList", | |
105 | + mixins:[JeecgListMixin], | |
106 | + components: { ReceiveDetailModal }, | |
107 | + props:{ | |
108 | + mainId:{ | |
109 | + type:String, | |
110 | + default:'', | |
111 | + required:false | |
112 | + } | |
113 | + }, | |
114 | + watch:{ | |
115 | + mainId:{ | |
116 | + immediate: true, | |
117 | + handler(val) { | |
118 | + if(!this.mainId){ | |
119 | + this.clearList() | |
120 | + }else{ | |
121 | + this.queryParam['receiveId'] = val | |
122 | + this.loadData(1); | |
123 | + } | |
124 | + } | |
125 | + } | |
126 | + }, | |
127 | + data () { | |
128 | + return { | |
129 | + description: '收货单表头管理页面', | |
130 | + disableMixinCreated:true, | |
131 | + companyList:[], | |
132 | + // 表头 | |
133 | + columns: [ | |
134 | + { | |
135 | + title: '单据详情ID', | |
136 | + align: "center", | |
137 | + sorter: true, | |
138 | + dataIndex: 'id' | |
139 | + }, | |
140 | + { | |
141 | + title: '货主', | |
142 | + align: "center", | |
143 | + dataIndex: 'companyCode', | |
144 | + key: 'companyCode', | |
145 | + scopedSlots: {customRender: 'companyCode'} | |
146 | + }, | |
147 | + { | |
148 | + title:'物料编码', | |
149 | + align:"center", | |
150 | + dataIndex: 'materialCode' | |
151 | + }, | |
152 | + { | |
153 | + title:'物料名称', | |
154 | + align:"center", | |
155 | + dataIndex: 'materialName' | |
156 | + }, | |
157 | + { | |
158 | + title:'物料规格', | |
159 | + align:"center", | |
160 | + dataIndex: 'materialSpec' | |
161 | + }, | |
162 | + { | |
163 | + title:'物料单位', | |
164 | + align:"center", | |
165 | + dataIndex: 'materialUnit' | |
166 | + }, | |
167 | + { | |
168 | + title:'单据数量', | |
169 | + align:"center", | |
170 | + dataIndex: 'qty' | |
171 | + }, | |
172 | + { | |
173 | + title:'已收数量', | |
174 | + align:"center", | |
175 | + dataIndex: 'taskQty' | |
176 | + }, | |
177 | + { | |
178 | + title: '库存状态', | |
179 | + align: "center", | |
180 | + dataIndex: 'inventoryStatus_dictText', | |
181 | + scopedSlots: {customRender: 'inventoryStatus_dictText'} | |
182 | + }, | |
183 | + { | |
184 | + title:'批次', | |
185 | + align:"center", | |
186 | + dataIndex: 'batch' | |
187 | + }, | |
188 | + { | |
189 | + title:'批号', | |
190 | + align:"center", | |
191 | + dataIndex: 'lot' | |
192 | + }, | |
193 | + { | |
194 | + title:'项目号', | |
195 | + align:"center", | |
196 | + dataIndex: 'project' | |
197 | + }, | |
198 | + { | |
199 | + title: '单据状态', | |
200 | + align: "center", | |
201 | + dataIndex: 'status_dictText', | |
202 | + scopedSlots: {customRender: 'status_dictText'} | |
203 | + }, | |
204 | + { | |
205 | + title:'上游单号', | |
206 | + align:"center", | |
207 | + dataIndex: 'referCode' | |
208 | + }, | |
209 | + { | |
210 | + title:'上游行号', | |
211 | + align:"center", | |
212 | + dataIndex: 'referLineNum' | |
213 | + }, | |
214 | + { | |
215 | + title: '操作', | |
216 | + dataIndex: 'action', | |
217 | + align:"center", | |
218 | + fixed:"right", | |
219 | + width:147, | |
220 | + scopedSlots: { customRender: 'action' }, | |
221 | + } | |
222 | + ], | |
223 | + url: { | |
224 | + list: "/receipt/receiveHeader/listReceiveDetailByMainId", | |
225 | + delete: "/receipt/receiveHeader/deleteReceiveDetail", | |
226 | + deleteBatch: "/receipt/receiveHeader/deleteBatchReceiveDetail", | |
227 | + exportXlsUrl: "/receipt/receiveHeader/exportReceiveDetail", | |
228 | + importUrl: "/receipt/receiveHeader/importReceiveDetail", | |
229 | + }, | |
230 | + dictOptions:{ | |
231 | + } | |
232 | + } | |
233 | + }, | |
234 | + created() { | |
235 | + this.loadFrom(); | |
236 | + }, | |
237 | + computed: { | |
238 | + importExcelUrl(){ | |
239 | + return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`; | |
240 | + } | |
241 | + }, | |
242 | + methods: { | |
243 | + clearList(){ | |
244 | + this.dataSource=[] | |
245 | + this.selectedRowKeys=[] | |
246 | + this.ipagination.current = 1 | |
247 | + }, | |
248 | + solutionCompany(value) { | |
249 | + var actions = [] | |
250 | + Object.keys(this.companyList).some((key) => { | |
251 | + if (this.companyList[key].code == ('' + value)) { | |
252 | + actions.push(this.companyList[key].name) | |
253 | + return true | |
254 | + } | |
255 | + }) | |
256 | + return actions.join('') | |
257 | + }, | |
258 | + loadFrom() { | |
259 | + getCompanyList().then((res) => { | |
260 | + if (res.success) { | |
261 | + this.companyList = res.result | |
262 | + } | |
263 | + }); | |
264 | + }, | |
265 | + getStatusColor(status) { | |
266 | + const colors = { | |
267 | + '良品': 'green', | |
268 | + '报废品': 'purple', | |
269 | + '待确认 ': 'grey', | |
270 | + '次品': 'red', | |
271 | + '新建': 'green', | |
272 | + '收货': 'Skyblue', | |
273 | + '等待上架': 'blue', | |
274 | + '上架': 'darkorange', | |
275 | + '过账': 'purple', | |
276 | + '回传': 'grey', | |
277 | + '回传失败': 'red', | |
278 | + default: 'blue' | |
279 | + }; | |
280 | + return colors[status] || colors.default; | |
281 | + }, | |
282 | + } | |
283 | + } | |
284 | +</script> | |
285 | +<style scoped> | |
286 | + @import '~@assets/less/common.less' | |
287 | +</style> | |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/ReceiveHeaderList.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.code"></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-select | |
15 | + show-search | |
16 | + placeholder="请选择货主" | |
17 | + option-filter-prop="children" | |
18 | + v-model="queryParam.companyCode"> | |
19 | + <a-select-option v-for="item in companyList" :key="item.name" :value="item.code">{{ | |
20 | + item.name | |
21 | + }} | |
22 | + </a-select-option> | |
23 | + </a-select> | |
24 | + </a-form-item> | |
25 | + </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.firstStatus"></a-input> | |
29 | + </a-form-item> | |
30 | + </a-col> | |
31 | + <template v-if="toggleSearchStatus"> | |
32 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
33 | + <a-form-item label="尾状态"> | |
34 | + <a-input placeholder="请输入尾状态" v-model="queryParam.lastStatus"></a-input> | |
35 | + </a-form-item> | |
36 | + </a-col> | |
37 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
38 | + <a-form-item label="上游单号"> | |
39 | + <a-input placeholder="请输入上游单号" v-model="queryParam.referCode"></a-input> | |
40 | + </a-form-item> | |
41 | + </a-col> | |
42 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
43 | + <a-form-item label="供应商"> | |
44 | + <a-select | |
45 | + show-search | |
46 | + placeholder="请选择供应商" | |
47 | + option-filter-prop="children" | |
48 | + v-model="queryParam.supplierCode"> | |
49 | + <a-select-option v-for="item in supplierList" :key="item.name" :value="item.code">{{ | |
50 | + item.name | |
51 | + }} | |
52 | + </a-select-option> | |
53 | + </a-select> | |
54 | + </a-form-item> | |
55 | + </a-col> | |
56 | + <a-col :xl="12" :lg="14" :md="16" :sm="24"> | |
57 | + <a-form-item label="创建日期"> | |
58 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" | |
59 | + class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> | |
60 | + <span class="query-group-split-cust"></span> | |
61 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" | |
62 | + class="query-group-cust" v-model="queryParam.createTime_end"></j-date> | |
63 | + </a-form-item> | |
64 | + </a-col> | |
65 | + </template> | |
66 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
67 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
68 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
69 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
70 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
71 | + {{ toggleSearchStatus ? '收起' : '展开' }} | |
72 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
73 | + </a> | |
74 | + </span> | |
75 | + </a-col> | |
76 | + </a-row> | |
77 | + </a-form> | |
78 | + </div> | |
79 | + <!-- 查询区域-END --> | |
80 | + | |
81 | + <!-- 操作按钮区域 --> | |
82 | + <div class="table-operator"> | |
83 | + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
84 | + <a-button type="primary" icon="download" @click="handleExportXls('收货单表头')">导出</a-button> | |
85 | + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
86 | + <a-button type="primary" icon="import">导入</a-button> | |
87 | + </a-upload> | |
88 | + <!-- 高级查询区域 --> | |
89 | + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
90 | + </div> | |
91 | + | |
92 | + <!-- table区域-begin --> | |
93 | + <div> | |
94 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
95 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
96 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
97 | + </div> | |
98 | + | |
99 | + <a-table | |
100 | + ref="table" | |
101 | + size="middle" | |
102 | + bordered | |
103 | + rowKey="id" | |
104 | + class="j-table-force-nowrap" | |
105 | + :scroll="{x:true}" | |
106 | + :columns="columns" | |
107 | + :dataSource="dataSource" | |
108 | + :pagination="ipagination" | |
109 | + :loading="loading" | |
110 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" | |
111 | + :customRow="clickThenSelect" | |
112 | + @change="handleTableChange"> | |
113 | + | |
114 | + <span slot="companyCode" slot-scope="companyCode"> | |
115 | + <a-tag :key="companyCode" color=blue> | |
116 | + {{ solutionCompany(companyCode) }} | |
117 | + </a-tag> | |
118 | + </span> | |
119 | + | |
120 | + <span slot="firstStatus_dictText" slot-scope="firstStatus_dictText"> | |
121 | + <a-tag :key="firstStatus_dictText" :color="getStatusColor(firstStatus_dictText)"> | |
122 | + {{ firstStatus_dictText }} | |
123 | + </a-tag> | |
124 | + </span> | |
125 | + | |
126 | + <span slot="lastStatus_dictText" slot-scope="lastStatus_dictText"> | |
127 | + <a-tag :key="lastStatus_dictText" :color="getStatusColor(lastStatus_dictText)"> | |
128 | + {{ lastStatus_dictText }} | |
129 | + </a-tag> | |
130 | + </span> | |
131 | + | |
132 | + <span slot="supplierCode" slot-scope="supplierCode"> | |
133 | + <a-tag :key="supplierCode" color=pink> | |
134 | + {{ solutionSupplier(supplierCode) }} | |
135 | + </a-tag> | |
136 | + </span> | |
137 | + | |
138 | + <template slot="htmlSlot" slot-scope="text"> | |
139 | + <div v-html="text"></div> | |
140 | + </template> | |
141 | + <template slot="imgSlot" slot-scope="text"> | |
142 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
143 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
144 | + </template> | |
145 | + <template slot="fileSlot" slot-scope="text"> | |
146 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
147 | + <a-button | |
148 | + v-else | |
149 | + :ghost="true" | |
150 | + type="primary" | |
151 | + icon="download" | |
152 | + size="small" | |
153 | + @click="downloadFile(text)"> | |
154 | + 下载 | |
155 | + </a-button> | |
156 | + </template> | |
157 | + | |
158 | + <span slot="action" slot-scope="text, record"> | |
159 | + <a @click="receive(record)"> | |
160 | + <a-button type="primary">收货</a-button><a-divider type="vertical"/> | |
161 | + </a> | |
162 | + <a @click="handleEdit(record)">编辑</a> | |
163 | + | |
164 | + <a-divider type="vertical" /> | |
165 | + <a-dropdown> | |
166 | + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
167 | + <a-menu slot="overlay"> | |
168 | + <a-menu-item> | |
169 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
170 | + <a>删除</a> | |
171 | + </a-popconfirm> | |
172 | + </a-menu-item> | |
173 | + </a-menu> | |
174 | + </a-dropdown> | |
175 | + </span> | |
176 | + | |
177 | + </a-table> | |
178 | + </div> | |
179 | + | |
180 | + <a-tabs defaultActiveKey="1"> | |
181 | + <a-tab-pane tab="收货单详情" key="1" > | |
182 | + <ReceiveDetailList :mainId="selectedMainId" /> | |
183 | + </a-tab-pane> | |
184 | + </a-tabs> | |
185 | + | |
186 | + <receiveHeader-modal ref="modalForm" @ok="modalFormOk"></receiveHeader-modal> | |
187 | + </a-card> | |
188 | +</template> | |
189 | + | |
190 | +<script> | |
191 | + | |
192 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
193 | + import ReceiveHeaderModal from './modules/ReceiveHeaderModal' | |
194 | + import { getAction } from '@/api/manage' | |
195 | + import ReceiveDetailList from './ReceiveDetailList' | |
196 | + import '@/assets/less/TableExpand.less' | |
197 | + import {getCompanyList, getSupplierList} from "@api/api"; | |
198 | + | |
199 | + export default { | |
200 | + name: "ReceiveHeaderList", | |
201 | + mixins:[JeecgListMixin], | |
202 | + components: { | |
203 | + ReceiveDetailList, | |
204 | + ReceiveHeaderModal | |
205 | + }, | |
206 | + data () { | |
207 | + return { | |
208 | + description: '收货单表头管理页面', | |
209 | + companyList: [], | |
210 | + supplierList: [], | |
211 | + // 表头 | |
212 | + columns: [ | |
213 | + { | |
214 | + title: '单据ID', | |
215 | + align: "center", | |
216 | + dataIndex: 'id', | |
217 | + sorter: true, | |
218 | + }, | |
219 | + { | |
220 | + title:'编码', | |
221 | + align:"center", | |
222 | + dataIndex: 'code' | |
223 | + }, | |
224 | + { | |
225 | + title: '货主', | |
226 | + align: "center", | |
227 | + dataIndex: 'companyCode', | |
228 | + key: 'companyCode', | |
229 | + scopedSlots: {customRender: 'companyCode'} | |
230 | + }, | |
231 | + { | |
232 | + title: '头状态', | |
233 | + align: "center", | |
234 | + dataIndex: 'firstStatus_dictText', | |
235 | + key: 'firstStatus_dictText', | |
236 | + scopedSlots: {customRender: 'firstStatus_dictText'} | |
237 | + }, | |
238 | + { | |
239 | + title: '尾状态', | |
240 | + align: "center", | |
241 | + dataIndex: 'lastStatus_dictText', | |
242 | + key: 'lastStatus_dictText', | |
243 | + scopedSlots: {customRender: 'lastStatus_dictText'} | |
244 | + }, | |
245 | + { | |
246 | + title:'上游单号', | |
247 | + align:"center", | |
248 | + dataIndex: 'referCode' | |
249 | + }, | |
250 | + { | |
251 | + title: '供应商', | |
252 | + align: "center", | |
253 | + dataIndex: 'supplierCode', | |
254 | + key: 'supplierCode', | |
255 | + scopedSlots: {customRender: 'supplierCode'} | |
256 | + }, | |
257 | + { | |
258 | + title:'总数量', | |
259 | + align:"center", | |
260 | + dataIndex: 'totalQty' | |
261 | + }, | |
262 | + { | |
263 | + title:'总行数', | |
264 | + align:"center", | |
265 | + dataIndex: 'totalLines' | |
266 | + }, | |
267 | + { | |
268 | + title:'备注', | |
269 | + align:"center", | |
270 | + dataIndex: 'remark' | |
271 | + }, | |
272 | + { | |
273 | + title:'创建人', | |
274 | + align:"center", | |
275 | + dataIndex: 'createBy' | |
276 | + }, | |
277 | + { | |
278 | + title:'创建日期', | |
279 | + align:"center", | |
280 | + dataIndex: 'createTime' | |
281 | + }, | |
282 | + { | |
283 | + title:'更新人', | |
284 | + align:"center", | |
285 | + dataIndex: 'updateBy' | |
286 | + }, | |
287 | + { | |
288 | + title:'更新日期', | |
289 | + align:"center", | |
290 | + dataIndex: 'updateTime' | |
291 | + }, | |
292 | + { | |
293 | + title: '操作', | |
294 | + dataIndex: 'action', | |
295 | + align:"center", | |
296 | + fixed:"right", | |
297 | + width:147, | |
298 | + scopedSlots: { customRender: 'action' }, | |
299 | + } | |
300 | + ], | |
301 | + url: { | |
302 | + list: "/receipt/receiveHeader/list", | |
303 | + delete: "/receipt/receiveHeader/delete", | |
304 | + deleteBatch: "/receipt/receiveHeader/deleteBatch", | |
305 | + exportXlsUrl: "/receipt/receiveHeader/exportXls", | |
306 | + importExcelUrl: "receipt/receiveHeader/importExcel", | |
307 | + }, | |
308 | + dictOptions:{ | |
309 | + }, | |
310 | + /* 分页参数 */ | |
311 | + ipagination:{ | |
312 | + current: 1, | |
313 | + pageSize: 5, | |
314 | + pageSizeOptions: ['5', '10', '50'], | |
315 | + showTotal: (total, range) => { | |
316 | + return range[0] + "-" + range[1] + " 共" + total + "条" | |
317 | + }, | |
318 | + showQuickJumper: true, | |
319 | + showSizeChanger: true, | |
320 | + total: 0 | |
321 | + }, | |
322 | + selectedMainId:'', | |
323 | + superFieldList:[], | |
324 | + } | |
325 | + }, | |
326 | + created() { | |
327 | + this.getSuperFieldList(); | |
328 | + this.loadFrom(); | |
329 | + }, | |
330 | + | |
331 | + computed: { | |
332 | + importExcelUrl: function(){ | |
333 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
334 | + } | |
335 | + }, | |
336 | + methods: { | |
337 | + initDictConfig(){ | |
338 | + }, | |
339 | + clickThenSelect(record) { | |
340 | + return { | |
341 | + on: { | |
342 | + click: () => { | |
343 | + this.onSelectChange(record.id.split(","), [record]); | |
344 | + } | |
345 | + } | |
346 | + } | |
347 | + }, | |
348 | + onClearSelected() { | |
349 | + this.selectedRowKeys = []; | |
350 | + this.selectionRows = []; | |
351 | + this.selectedMainId='' | |
352 | + }, | |
353 | + onSelectChange(selectedRowKeys, selectionRows) { | |
354 | + this.selectedMainId=selectedRowKeys[0] | |
355 | + this.selectedRowKeys = selectedRowKeys; | |
356 | + this.selectionRows = selectionRows; | |
357 | + }, | |
358 | + getStatusColor(status) { | |
359 | + const colors = { | |
360 | + '新建': 'green', | |
361 | + '部分收货': 'Skyblue', | |
362 | + '收货完成': 'blue', | |
363 | + default: 'blue' | |
364 | + }; | |
365 | + return colors[status] || colors.default; | |
366 | + }, | |
367 | + loadFrom() { | |
368 | + getCompanyList().then((res) => { | |
369 | + if (res.success) { | |
370 | + this.companyList = res.result | |
371 | + } | |
372 | + }); | |
373 | + getSupplierList().then((res) => { | |
374 | + if (res.success) { | |
375 | + this.supplierList = res.result | |
376 | + } | |
377 | + }); | |
378 | + }, | |
379 | + solutionCompany(value) { | |
380 | + var actions = [] | |
381 | + Object.keys(this.companyList).some((key) => { | |
382 | + if (this.companyList[key].code == ('' + value)) { | |
383 | + actions.push(this.companyList[key].name) | |
384 | + return true | |
385 | + } | |
386 | + }) | |
387 | + return actions.join('') | |
388 | + }, | |
389 | + solutionSupplier(value) { | |
390 | + var actions = [] | |
391 | + Object.keys(this.supplierList).some((key) => { | |
392 | + if (this.supplierList[key].code == ('' + value)) { | |
393 | + actions.push(this.supplierList[key].name) | |
394 | + return true | |
395 | + } | |
396 | + }) | |
397 | + return actions.join('') | |
398 | + }, | |
399 | + loadData(arg) { | |
400 | + if(!this.url.list){ | |
401 | + this.$message.error("请设置url.list属性!") | |
402 | + return | |
403 | + } | |
404 | + //加载数据 若传入参数1则加载第一页的内容 | |
405 | + if (arg === 1) { | |
406 | + this.ipagination.current = 1; | |
407 | + } | |
408 | + this.onClearSelected() | |
409 | + var params = this.getQueryParams();//查询条件 | |
410 | + this.loading = true; | |
411 | + getAction(this.url.list, params).then((res) => { | |
412 | + if (res.success) { | |
413 | + this.dataSource = res.result.records; | |
414 | + this.ipagination.total = res.result.total; | |
415 | + } | |
416 | + if(res.code===510){ | |
417 | + this.$message.warning(res.message) | |
418 | + } | |
419 | + this.loading = false; | |
420 | + }) | |
421 | + }, | |
422 | + getSuperFieldList(){ | |
423 | + let fieldList=[]; | |
424 | + fieldList.push({type:'string',value:'code',text:'编码',dictCode:''}) | |
425 | + fieldList.push({type: 'string', value: 'companyCode', text: '货主', dictCode: ''}) | |
426 | + fieldList.push({type:'string',value:'warehouseCode',text:'仓库编码',dictCode:''}) | |
427 | + fieldList.push({type: 'int', value: 'firstStatus', text: '头状态', dictCode: 'receive_status'}) | |
428 | + fieldList.push({type: 'int', value: 'lastStatus', text: '尾状态', dictCode: 'receive_status'}) | |
429 | + fieldList.push({type:'string',value:'referCode',text:'上游单号',dictCode:''}) | |
430 | + fieldList.push({type:'string',value:'supplierCode',text:'供应商编码',dictCode:''}) | |
431 | + fieldList.push({type:'BigDecimal',value:'totalQty',text:'总数量',dictCode:''}) | |
432 | + fieldList.push({type:'int',value:'totalLines',text:'总行数',dictCode:''}) | |
433 | + fieldList.push({type:'string',value:'remark',text:'备注',dictCode:''}) | |
434 | + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) | |
435 | + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) | |
436 | + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) | |
437 | + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) | |
438 | + this.superFieldList = fieldList | |
439 | + } | |
440 | + } | |
441 | + } | |
442 | +</script> | |
443 | +<style scoped> | |
444 | + @import '~@assets/less/common.less' | |
445 | +</style> | |
0 | 446 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiveDetailModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + :confirmLoading="confirmLoading" | |
7 | + switchFullscreen | |
8 | + @ok="handleOk" | |
9 | + @cancel="handleCancel" | |
10 | + cancelText="关闭"> | |
11 | + <a-spin :spinning="confirmLoading"> | |
12 | + <a-form-model ref="form" :model="model" :rules="validatorRules"> | |
13 | + <a-row> | |
14 | + <a-form-model-item label="物料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> | |
15 | + <j-search-select-tag | |
16 | + v-model="model.materialCode" | |
17 | + :dictOptions="materialList" | |
18 | + :trigger-change="true" | |
19 | + placeholder="请选择物料编码" | |
20 | + @change="searchMaterial"> | |
21 | + </j-search-select-tag> | |
22 | + </a-form-model-item> | |
23 | + <a-col :span="24"> | |
24 | + <a-form-model-item label="单据数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty"> | |
25 | + <a-input-number v-model="model.qty" placeholder="请输入单据数量" style="width: 100%"/> | |
26 | + </a-form-model-item> | |
27 | + </a-col> | |
28 | + <a-col :span="24"> | |
29 | + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus"> | |
30 | + <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status" | |
31 | + placeholder="请选择库存状态"/> | |
32 | + </a-form-model-item> | |
33 | + </a-col> | |
34 | + <a-col :span="24"> | |
35 | + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch"> | |
36 | + <a-input v-model="model.batch" placeholder="请输入批次"></a-input> | |
37 | + </a-form-model-item> | |
38 | + </a-col> | |
39 | + </a-row> | |
40 | + </a-form-model> | |
41 | + </a-spin> | |
42 | + </j-modal> | |
43 | +</template> | |
44 | + | |
45 | +<script> | |
46 | + | |
47 | + import { httpAction } from '@/api/manage' | |
48 | + import { validateDuplicateValue } from '@/utils/util' | |
49 | + import {getCompanyList, getReceiptTypeList, getSupplierList, searchMaterialByCode} from "@api/api"; | |
50 | + | |
51 | + export default { | |
52 | + name: "ReceiveDetailModal", | |
53 | + components: { | |
54 | + }, | |
55 | + props:{ | |
56 | + mainId:{ | |
57 | + type:String, | |
58 | + required:false, | |
59 | + default:'' | |
60 | + } | |
61 | + }, | |
62 | + data () { | |
63 | + return { | |
64 | + title:"操作", | |
65 | + width:800, | |
66 | + visible: false, | |
67 | + materialList: {}, | |
68 | + companyList: [], | |
69 | + querySource: {}, | |
70 | + model:{ | |
71 | + }, | |
72 | + labelCol: { | |
73 | + xs: { span: 24 }, | |
74 | + sm: { span: 5 }, | |
75 | + }, | |
76 | + wrapperCol: { | |
77 | + xs: { span: 24 }, | |
78 | + sm: { span: 16 }, | |
79 | + }, | |
80 | + | |
81 | + confirmLoading: false, | |
82 | + validatorRules: { | |
83 | + }, | |
84 | + url: { | |
85 | + add: "/receipt/receiveHeader/addReceiveDetail", | |
86 | + edit: "/receipt/receiveHeader/editReceiveDetail", | |
87 | + } | |
88 | + | |
89 | + } | |
90 | + }, | |
91 | + created () { | |
92 | + //备份model原始值 | |
93 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
94 | + this.searchMaterial(); | |
95 | + this.loadFrom(); | |
96 | + }, | |
97 | + methods: { | |
98 | + add () { | |
99 | + let record={inventoryStatus:'good'} | |
100 | + this.edit(record); | |
101 | + }, | |
102 | + edit (record) { | |
103 | + this.model = Object.assign({}, record); | |
104 | + this.visible = true; | |
105 | + }, | |
106 | + close () { | |
107 | + this.$emit('close'); | |
108 | + this.visible = false; | |
109 | + this.$refs.form.clearValidate(); | |
110 | + }, | |
111 | + searchMaterial() { | |
112 | + const that = this; | |
113 | + that.querySource.materialCode = that.model.materialCode; | |
114 | + searchMaterialByCode(that.querySource).then((res) => { | |
115 | + that.materialList = res.result; | |
116 | + }) | |
117 | + }, | |
118 | + loadFrom() { | |
119 | + getCompanyList().then((res) => { | |
120 | + if (res.success) { | |
121 | + this.companyList = res.result | |
122 | + } | |
123 | + }); | |
124 | + }, | |
125 | + handleOk () { | |
126 | + const that = this; | |
127 | + // 触发表单验证 | |
128 | + this.$refs.form.validate(valid => { | |
129 | + if (valid) { | |
130 | + that.confirmLoading = true; | |
131 | + let httpurl = ''; | |
132 | + let method = ''; | |
133 | + if(!this.model.id){ | |
134 | + httpurl+=this.url.add; | |
135 | + method = 'post'; | |
136 | + }else{ | |
137 | + httpurl+=this.url.edit; | |
138 | + method = 'put'; | |
139 | + } | |
140 | + this.model['receiveId'] = this.mainId | |
141 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
142 | + if(res.success){ | |
143 | + that.$message.success(res.message); | |
144 | + that.$emit('ok'); | |
145 | + }else{ | |
146 | + that.$message.warning(res.message); | |
147 | + } | |
148 | + }).finally(() => { | |
149 | + that.confirmLoading = false; | |
150 | + that.close(); | |
151 | + }) | |
152 | + }else{ | |
153 | + return false | |
154 | + } | |
155 | + }) | |
156 | + }, | |
157 | + handleCancel () { | |
158 | + this.close() | |
159 | + }, | |
160 | + | |
161 | + | |
162 | + } | |
163 | + } | |
164 | +</script> | |
... | ... |
ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiveHeaderModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + :confirmLoading="confirmLoading" | |
7 | + switchFullscreen | |
8 | + @ok="handleOk" | |
9 | + @cancel="handleCancel" | |
10 | + cancelText="关闭"> | |
11 | + <a-spin :spinning="confirmLoading"> | |
12 | + <a-form-model ref="form" :model="model" :rules="validatorRules"> | |
13 | + <a-row> | |
14 | + <a-col :span="24"> | |
15 | + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> | |
16 | + <a-select | |
17 | + show-search | |
18 | + placeholder="请选择货主" | |
19 | + option-filter-prop="children" | |
20 | + v-model="model.companyCode"> | |
21 | + <a-select-option v-for="item in companyList" :key="item.name" :value="item.code">{{ | |
22 | + item.name | |
23 | + }} | |
24 | + </a-select-option> | |
25 | + </a-select> | |
26 | + </a-form-model-item> | |
27 | + </a-col> | |
28 | + <a-col :span="24"> | |
29 | + <a-form-model-item label="供应商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplierCode"> | |
30 | + <a-select | |
31 | + show-search | |
32 | + placeholder="请选择供应商" | |
33 | + option-filter-prop="children" | |
34 | + v-model="model.supplierCode"> | |
35 | + <a-select-option v-for="item in supplierList" :key="item.name" :value="item.code">{{ | |
36 | + item.name | |
37 | + }} | |
38 | + </a-select-option> | |
39 | + </a-select> | |
40 | + </a-form-model-item> | |
41 | + </a-col> | |
42 | + <a-col :span="24"> | |
43 | + <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> | |
44 | + <a-input v-model="model.remark" placeholder="请输入备注" ></a-input> | |
45 | + </a-form-model-item> | |
46 | + </a-col> | |
47 | + </a-row> | |
48 | + </a-form-model> | |
49 | + </a-spin> | |
50 | + </j-modal> | |
51 | +</template> | |
52 | + | |
53 | +<script> | |
54 | + | |
55 | + import { httpAction } from '@/api/manage' | |
56 | + import { validateDuplicateValue } from '@/utils/util' | |
57 | + import {getCompanyList, getSupplierList} from "@api/api"; | |
58 | + | |
59 | + export default { | |
60 | + name: "ReceiveHeaderModal", | |
61 | + components: { | |
62 | + }, | |
63 | + data () { | |
64 | + return { | |
65 | + title:"操作", | |
66 | + width:800, | |
67 | + visible: false, | |
68 | + companyList: [], | |
69 | + supplierList: [], | |
70 | + model:{ | |
71 | + }, | |
72 | + labelCol: { | |
73 | + xs: { span: 24 }, | |
74 | + sm: { span: 5 }, | |
75 | + }, | |
76 | + wrapperCol: { | |
77 | + xs: { span: 24 }, | |
78 | + sm: { span: 16 }, | |
79 | + }, | |
80 | + | |
81 | + confirmLoading: false, | |
82 | + validatorRules: { | |
83 | + }, | |
84 | + url: { | |
85 | + add: "/receipt/receiveHeader/add", | |
86 | + edit: "/receipt/receiveHeader/edit", | |
87 | + } | |
88 | + | |
89 | + } | |
90 | + }, | |
91 | + created () { | |
92 | + //备份model原始值 | |
93 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
94 | + this.loadFrom(); | |
95 | + }, | |
96 | + methods: { | |
97 | + add () { | |
98 | + let record={companyCode: this.companyList[0].code} | |
99 | + this.edit(record); | |
100 | + }, | |
101 | + edit (record) { | |
102 | + this.model = Object.assign({}, record); | |
103 | + this.visible = true; | |
104 | + }, | |
105 | + close () { | |
106 | + this.$emit('close'); | |
107 | + this.visible = false; | |
108 | + this.$refs.form.clearValidate(); | |
109 | + }, | |
110 | + loadFrom() { | |
111 | + getCompanyList().then((res) => { | |
112 | + if (res.success) { | |
113 | + this.companyList = res.result | |
114 | + } | |
115 | + }); | |
116 | + getSupplierList().then((res) => { | |
117 | + if (res.success) { | |
118 | + this.supplierList = res.result | |
119 | + } | |
120 | + }); | |
121 | + }, | |
122 | + handleOk () { | |
123 | + const that = this; | |
124 | + // 触发表单验证 | |
125 | + this.$refs.form.validate(valid => { | |
126 | + if (valid) { | |
127 | + that.confirmLoading = true; | |
128 | + let httpurl = ''; | |
129 | + let method = ''; | |
130 | + if(!this.model.id){ | |
131 | + httpurl+=this.url.add; | |
132 | + method = 'post'; | |
133 | + }else{ | |
134 | + httpurl+=this.url.edit; | |
135 | + method = 'put'; | |
136 | + } | |
137 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
138 | + if(res.success){ | |
139 | + that.$message.success(res.message); | |
140 | + that.$emit('ok'); | |
141 | + }else{ | |
142 | + that.$message.warning(res.message); | |
143 | + } | |
144 | + }).finally(() => { | |
145 | + that.confirmLoading = false; | |
146 | + that.close(); | |
147 | + }) | |
148 | + }else{ | |
149 | + return false | |
150 | + } | |
151 | + }) | |
152 | + }, | |
153 | + handleCancel () { | |
154 | + this.close() | |
155 | + }, | |
156 | + | |
157 | + | |
158 | + } | |
159 | + } | |
160 | +</script> | |
0 | 161 | \ No newline at end of file |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/IReceiptHeaderService.java
... | ... | @@ -19,25 +19,25 @@ public interface IReceiptHeaderService extends IService<ReceiptHeader> { |
19 | 19 | /** |
20 | 20 | * 删除一对多 reason进入历史单据的原因 |
21 | 21 | */ |
22 | - public boolean delMain(String id, String reason); | |
22 | + boolean delMain(String id, String reason); | |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * 批量删除一对多 |
26 | 26 | */ |
27 | - public void delBatchMain(Collection<? extends Serializable> idList); | |
27 | + void delBatchMain(Collection<? extends Serializable> idList); | |
28 | 28 | |
29 | 29 | /** |
30 | - * | |
30 | + * 保存入库单 | |
31 | 31 | */ |
32 | - public Result<ReceiptHeader> saveReceiptHeader(ReceiptHeader receiptHeader); | |
32 | + Result<ReceiptHeader> saveReceiptHeader(ReceiptHeader receiptHeader); | |
33 | 33 | |
34 | - public boolean updateReceiptHeaderStatus(Integer id); | |
34 | + boolean updateReceiptHeaderStatus(Integer id); | |
35 | 35 | |
36 | - public boolean updateReceiptHeader(Integer id); | |
36 | + boolean updateReceiptHeader(Integer id); | |
37 | 37 | |
38 | - public ReceiptHeader getReceiptHeaderByCode(String code, String warehouseCode); | |
38 | + ReceiptHeader getReceiptHeaderByCode(String code, String warehouseCode); | |
39 | 39 | |
40 | - public ReceiptHeader getReceiptHeaderByReferCode(String referCode, String warehouseCode); | |
40 | + ReceiptHeader getReceiptHeaderByReferCode(String referCode, String warehouseCode); | |
41 | 41 | |
42 | 42 | String createReceiptCode(String receiptType); |
43 | 43 | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptHeaderServiceImpl.java
... | ... | @@ -104,12 +104,12 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, R |
104 | 104 | } |
105 | 105 | String referCode = receiptHeader.getReferCode(); |
106 | 106 | if (StringUtils.isNotEmpty(referCode)) { |
107 | - ReceiptHeader referReceiptHeader = getReceiptHeaderByReferCode(referCode, warehouseCode); | |
107 | + ReceiptHeader referReceiptHeader = receiptHeaderService.getReceiptHeaderByReferCode(referCode, warehouseCode); | |
108 | 108 | if (referReceiptHeader != null) { |
109 | 109 | return Result.error("上游单号" + referCode + ",已经存在"); |
110 | 110 | } |
111 | 111 | } |
112 | - String code = createReceiptCode(receiptHeader.getType()); | |
112 | + String code = receiptHeaderService.createReceiptCode(receiptHeader.getType()); | |
113 | 113 | if (StringUtils.isEmpty(code)) { |
114 | 114 | throw new JeecgBootException("根据入库单据类型" + receiptHeader.getType() + "生成单号失败"); |
115 | 115 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/controller/ReceiveHeaderController.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.controller; | |
2 | + | |
3 | +import java.io.IOException; | |
4 | +import java.util.Arrays; | |
5 | +import java.util.List; | |
6 | +import java.util.Map; | |
7 | +import java.util.stream.Collectors; | |
8 | + | |
9 | +import javax.servlet.http.HttpServletRequest; | |
10 | +import javax.servlet.http.HttpServletResponse; | |
11 | + | |
12 | +import org.apache.shiro.SecurityUtils; | |
13 | +import org.jeecg.common.api.vo.Result; | |
14 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
15 | +import org.jeecg.common.system.base.controller.JeecgController; | |
16 | +import org.jeecg.common.system.query.QueryGenerator; | |
17 | +import org.jeecg.common.system.vo.LoginUser; | |
18 | +import org.jeecg.common.util.oConvertUtils; | |
19 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveDetail; | |
20 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveHeader; | |
21 | +import org.jeecg.modules.wms.receipt.receiveHeader.service.IReceiveDetailService; | |
22 | +import org.jeecg.modules.wms.receipt.receiveHeader.service.IReceiveHeaderService; | |
23 | +import org.jeecg.utils.HuahengJwtUtil; | |
24 | +import org.jeecgframework.poi.excel.ExcelImportUtil; | |
25 | +import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
26 | +import org.jeecgframework.poi.excel.entity.ExportParams; | |
27 | +import org.jeecgframework.poi.excel.entity.ImportParams; | |
28 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
29 | +import org.springframework.beans.factory.annotation.Autowired; | |
30 | +import org.springframework.web.bind.annotation.*; | |
31 | +import org.springframework.web.multipart.MultipartFile; | |
32 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | |
33 | +import org.springframework.web.servlet.ModelAndView; | |
34 | + | |
35 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
36 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
37 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
38 | + | |
39 | +import io.swagger.annotations.Api; | |
40 | +import io.swagger.annotations.ApiOperation; | |
41 | +import lombok.extern.slf4j.Slf4j; | |
42 | + | |
43 | +/** | |
44 | + * @Description: 收货单表头 | |
45 | + * @Author: jeecg-boot | |
46 | + * @Date: 2023-08-22 | |
47 | + * @Version: V1.0 | |
48 | + */ | |
49 | +@Api(tags = "收货单表头") | |
50 | +@RestController | |
51 | +@RequestMapping("/receipt/receiveHeader") | |
52 | +@Slf4j | |
53 | +public class ReceiveHeaderController extends JeecgController<ReceiveHeader, IReceiveHeaderService> { | |
54 | + | |
55 | + @Autowired | |
56 | + private IReceiveHeaderService receiveHeaderService; | |
57 | + | |
58 | + @Autowired | |
59 | + private IReceiveDetailService receiveDetailService; | |
60 | + | |
61 | + /*---------------------------------主表处理-begin-------------------------------------*/ | |
62 | + | |
63 | + /** | |
64 | + * 分页列表查询 | |
65 | + * @param receiveHeader | |
66 | + * @param pageNo | |
67 | + * @param pageSize | |
68 | + * @param req | |
69 | + * @return | |
70 | + */ | |
71 | + // @AutoLog(value = "收货单表头-分页列表查询") | |
72 | + @ApiOperation(value = "收货单表头-分页列表查询", notes = "收货单表头-分页列表查询") | |
73 | + @GetMapping(value = "/list") | |
74 | + public Result<IPage<ReceiveHeader>> queryPageList(ReceiveHeader receiveHeader, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | |
75 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | |
76 | + QueryWrapper<ReceiveHeader> queryWrapper = QueryGenerator.initQueryWrapper(receiveHeader, req.getParameterMap()); | |
77 | + Page<ReceiveHeader> page = new Page<ReceiveHeader>(pageNo, pageSize); | |
78 | + IPage<ReceiveHeader> pageList = receiveHeaderService.page(page, queryWrapper); | |
79 | + return Result.OK(pageList); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * 添加 | |
84 | + * @param receiveHeader | |
85 | + * @return | |
86 | + */ | |
87 | + @AutoLog(value = "收货单表头-添加") | |
88 | + @ApiOperation(value = "收货单表头-添加", notes = "收货单表头-添加") | |
89 | + @PostMapping(value = "/add") | |
90 | + public Result<String> add(@RequestBody ReceiveHeader receiveHeader, HttpServletRequest req) { | |
91 | + HuahengJwtUtil.setWarehouseCode(req, receiveHeader); | |
92 | + Result result = receiveHeaderService.saveReceiveHeader(receiveHeader); | |
93 | + return result; | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * 编辑 | |
98 | + * @param receiveHeader | |
99 | + * @return | |
100 | + */ | |
101 | + @AutoLog(value = "收货单表头-编辑") | |
102 | + @ApiOperation(value = "收货单表头-编辑", notes = "收货单表头-编辑") | |
103 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) | |
104 | + public Result<String> edit(@RequestBody ReceiveHeader receiveHeader) { | |
105 | + receiveHeaderService.updateById(receiveHeader); | |
106 | + return Result.OK("编辑成功!"); | |
107 | + } | |
108 | + | |
109 | + /** | |
110 | + * 通过id删除 | |
111 | + * @param id | |
112 | + * @return | |
113 | + */ | |
114 | + @AutoLog(value = "收货单表头-通过id删除") | |
115 | + @ApiOperation(value = "收货单表头-通过id删除", notes = "收货单表头-通过id删除") | |
116 | + @DeleteMapping(value = "/delete") | |
117 | + public Result<String> delete(@RequestParam(name = "id", required = true) String id) { | |
118 | + receiveHeaderService.delMain(id); | |
119 | + return Result.OK("删除成功!"); | |
120 | + } | |
121 | + | |
122 | + /** | |
123 | + * 批量删除 | |
124 | + * @param ids | |
125 | + * @return | |
126 | + */ | |
127 | + @AutoLog(value = "收货单表头-批量删除") | |
128 | + @ApiOperation(value = "收货单表头-批量删除", notes = "收货单表头-批量删除") | |
129 | + @DeleteMapping(value = "/deleteBatch") | |
130 | + public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { | |
131 | + this.receiveHeaderService.delBatchMain(Arrays.asList(ids.split(","))); | |
132 | + return Result.OK("批量删除成功!"); | |
133 | + } | |
134 | + | |
135 | + /** | |
136 | + * 导出 | |
137 | + * @return | |
138 | + */ | |
139 | + @RequestMapping(value = "/exportXls") | |
140 | + public ModelAndView exportXls(HttpServletRequest request, ReceiveHeader receiveHeader) { | |
141 | + return super.exportXls(request, receiveHeader, ReceiveHeader.class, "收货单表头"); | |
142 | + } | |
143 | + | |
144 | + /** | |
145 | + * 导入 | |
146 | + * @return | |
147 | + */ | |
148 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |
149 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |
150 | + return super.importExcel(request, response, ReceiveHeader.class); | |
151 | + } | |
152 | + /*---------------------------------主表处理-end-------------------------------------*/ | |
153 | + | |
154 | + /*--------------------------------子表处理-收货单详情-begin----------------------------------------------*/ | |
155 | + /** | |
156 | + * 通过主表ID查询 | |
157 | + * @return | |
158 | + */ | |
159 | + // @AutoLog(value = "收货单详情-通过主表ID查询") | |
160 | + @ApiOperation(value = "收货单详情-通过主表ID查询", notes = "收货单详情-通过主表ID查询") | |
161 | + @GetMapping(value = "/listReceiveDetailByMainId") | |
162 | + public Result<IPage<ReceiveDetail>> listReceiveDetailByMainId(ReceiveDetail receiveDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | |
163 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { | |
164 | + QueryWrapper<ReceiveDetail> queryWrapper = QueryGenerator.initQueryWrapper(receiveDetail, req.getParameterMap()); | |
165 | + Page<ReceiveDetail> page = new Page<ReceiveDetail>(pageNo, pageSize); | |
166 | + IPage<ReceiveDetail> pageList = receiveDetailService.page(page, queryWrapper); | |
167 | + return Result.OK(pageList); | |
168 | + } | |
169 | + | |
170 | + /** | |
171 | + * 添加 | |
172 | + * @param receiveDetail | |
173 | + * @return | |
174 | + */ | |
175 | + @AutoLog(value = "收货单详情-添加") | |
176 | + @ApiOperation(value = "收货单详情-添加", notes = "收货单详情-添加") | |
177 | + @PostMapping(value = "/addReceiveDetail") | |
178 | + public Result<String> addReceiveDetail(@RequestBody ReceiveDetail receiveDetail) { | |
179 | + return receiveDetailService.saveReceiveDetail(receiveDetail); | |
180 | + } | |
181 | + | |
182 | + /** | |
183 | + * 编辑 | |
184 | + * @param receiveDetail | |
185 | + * @return | |
186 | + */ | |
187 | + @AutoLog(value = "收货单详情-编辑") | |
188 | + @ApiOperation(value = "收货单详情-编辑", notes = "收货单详情-编辑") | |
189 | + @RequestMapping(value = "/editReceiveDetail", method = {RequestMethod.PUT, RequestMethod.POST}) | |
190 | + public Result<String> editReceiveDetail(@RequestBody ReceiveDetail receiveDetail) { | |
191 | + receiveDetailService.updateById(receiveDetail); | |
192 | + return Result.OK("编辑成功!"); | |
193 | + } | |
194 | + | |
195 | + /** | |
196 | + * 通过id删除 | |
197 | + * @param id | |
198 | + * @return | |
199 | + */ | |
200 | + @AutoLog(value = "收货单详情-通过id删除") | |
201 | + @ApiOperation(value = "收货单详情-通过id删除", notes = "收货单详情-通过id删除") | |
202 | + @DeleteMapping(value = "/deleteReceiveDetail") | |
203 | + public Result<String> deleteReceiveDetail(@RequestParam(name = "id", required = true) String id) { | |
204 | + receiveDetailService.removeById(id); | |
205 | + return Result.OK("删除成功!"); | |
206 | + } | |
207 | + | |
208 | + /** | |
209 | + * 批量删除 | |
210 | + * @param ids | |
211 | + * @return | |
212 | + */ | |
213 | + @AutoLog(value = "收货单详情-批量删除") | |
214 | + @ApiOperation(value = "收货单详情-批量删除", notes = "收货单详情-批量删除") | |
215 | + @DeleteMapping(value = "/deleteBatchReceiveDetail") | |
216 | + public Result<String> deleteBatchReceiveDetail(@RequestParam(name = "ids", required = true) String ids) { | |
217 | + this.receiveDetailService.removeByIds(Arrays.asList(ids.split(","))); | |
218 | + return Result.OK("批量删除成功!"); | |
219 | + } | |
220 | + | |
221 | + /** | |
222 | + * 导出 | |
223 | + * @return | |
224 | + */ | |
225 | + @RequestMapping(value = "/exportReceiveDetail") | |
226 | + public ModelAndView exportReceiveDetail(HttpServletRequest request, ReceiveDetail receiveDetail) { | |
227 | + // Step.1 组装查询条件 | |
228 | + QueryWrapper<ReceiveDetail> queryWrapper = QueryGenerator.initQueryWrapper(receiveDetail, request.getParameterMap()); | |
229 | + LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal(); | |
230 | + | |
231 | + // Step.2 获取导出数据 | |
232 | + List<ReceiveDetail> pageList = receiveDetailService.list(queryWrapper); | |
233 | + List<ReceiveDetail> exportList = null; | |
234 | + | |
235 | + // 过滤选中数据 | |
236 | + String selections = request.getParameter("selections"); | |
237 | + if (oConvertUtils.isNotEmpty(selections)) { | |
238 | + List<String> selectionList = Arrays.asList(selections.split(",")); | |
239 | + exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); | |
240 | + } else { | |
241 | + exportList = pageList; | |
242 | + } | |
243 | + | |
244 | + // Step.3 AutoPoi 导出Excel | |
245 | + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | |
246 | + mv.addObject(NormalExcelConstants.FILE_NAME, "收货单详情"); // 此处设置的filename无效 ,前端会重更新设置一下 | |
247 | + mv.addObject(NormalExcelConstants.CLASS, ReceiveDetail.class); | |
248 | + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("收货单详情报表", "导出人:" + sysUser.getRealname(), "收货单详情")); | |
249 | + mv.addObject(NormalExcelConstants.DATA_LIST, exportList); | |
250 | + return mv; | |
251 | + } | |
252 | + | |
253 | + /** | |
254 | + * 导入 | |
255 | + * @return | |
256 | + */ | |
257 | + @RequestMapping(value = "/importReceiveDetail/{mainId}") | |
258 | + public Result<?> importReceiveDetail(HttpServletRequest request, HttpServletResponse response, @PathVariable("mainId") Integer mainId) { | |
259 | + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request; | |
260 | + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | |
261 | + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | |
262 | + MultipartFile file = entity.getValue();// 获取上传文件对象 | |
263 | + ImportParams params = new ImportParams(); | |
264 | + params.setTitleRows(2); | |
265 | + params.setHeadRows(1); | |
266 | + params.setNeedSave(true); | |
267 | + try { | |
268 | + List<ReceiveDetail> list = ExcelImportUtil.importExcel(file.getInputStream(), ReceiveDetail.class, params); | |
269 | + for (ReceiveDetail temp : list) { | |
270 | + temp.setReceiveId(mainId); | |
271 | + } | |
272 | + long start = System.currentTimeMillis(); | |
273 | + receiveDetailService.saveBatch(list); | |
274 | + log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒"); | |
275 | + return Result.OK("文件导入成功!数据行数:" + list.size()); | |
276 | + } catch (Exception e) { | |
277 | + log.error(e.getMessage(), e); | |
278 | + return Result.error("文件导入失败:" + e.getMessage()); | |
279 | + } finally { | |
280 | + try { | |
281 | + file.getInputStream().close(); | |
282 | + } catch (IOException e) { | |
283 | + e.printStackTrace(); | |
284 | + } | |
285 | + } | |
286 | + } | |
287 | + return Result.error("文件导入失败!"); | |
288 | + } | |
289 | + | |
290 | + /*--------------------------------子表处理-收货单详情-end----------------------------------------------*/ | |
291 | + | |
292 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/entity/ReceiveDetail.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.util.Date; | |
5 | + | |
6 | +import org.jeecg.common.aspect.annotation.Dict; | |
7 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
8 | + | |
9 | +import com.baomidou.mybatisplus.annotation.IdType; | |
10 | +import com.baomidou.mybatisplus.annotation.TableId; | |
11 | +import com.baomidou.mybatisplus.annotation.TableName; | |
12 | + | |
13 | +import io.swagger.annotations.ApiModel; | |
14 | +import io.swagger.annotations.ApiModelProperty; | |
15 | +import lombok.Data; | |
16 | + | |
17 | +/** | |
18 | + * @Description: 收货单详情 | |
19 | + * @Author: jeecg-boot | |
20 | + * @Date: 2023-08-22 | |
21 | + * @Version: V1.0 | |
22 | + */ | |
23 | +@Data | |
24 | +@TableName("receive_detail") | |
25 | +@ApiModel(value = "receive_detail对象", description = "收货单详情") | |
26 | +public class ReceiveDetail implements Serializable { | |
27 | + private static final long serialVersionUID = 1L; | |
28 | + | |
29 | + /** 主键 */ | |
30 | + @TableId(type = IdType.AUTO) | |
31 | + @ApiModelProperty(value = "主键") | |
32 | + private Integer id; | |
33 | + /** 收货单ID */ | |
34 | + @ApiModelProperty(value = "收货单ID") | |
35 | + private Integer receiveId; | |
36 | + /** 收货单编码 */ | |
37 | + @Excel(name = "收货单编码", width = 15) | |
38 | + @ApiModelProperty(value = "收货单编码") | |
39 | + private String receiveCode; | |
40 | + /** 仓库编码 */ | |
41 | + @Excel(name = "仓库编码", width = 15) | |
42 | + @ApiModelProperty(value = "仓库编码") | |
43 | + private String warehouseCode; | |
44 | + /** 货主编码 */ | |
45 | + @Excel(name = "货主编码", width = 15) | |
46 | + @ApiModelProperty(value = "货主编码") | |
47 | + private String companyCode; | |
48 | + /** 物料编码 */ | |
49 | + @Excel(name = "物料编码", width = 15) | |
50 | + @ApiModelProperty(value = "物料编码") | |
51 | + private String materialCode; | |
52 | + /** 物料名称 */ | |
53 | + @Excel(name = "物料名称", width = 15) | |
54 | + @ApiModelProperty(value = "物料名称") | |
55 | + private String materialName; | |
56 | + /** 物料规格 */ | |
57 | + @Excel(name = "物料规格", width = 15) | |
58 | + @ApiModelProperty(value = "物料规格") | |
59 | + private String materialSpec; | |
60 | + /** 物料单位 */ | |
61 | + @Excel(name = "物料单位", width = 15) | |
62 | + @ApiModelProperty(value = "物料单位") | |
63 | + private String materialUnit; | |
64 | + /** 单据数量 */ | |
65 | + @Excel(name = "单据数量", width = 15) | |
66 | + @ApiModelProperty(value = "单据数量") | |
67 | + private java.math.BigDecimal qty; | |
68 | + /** 已收数量 */ | |
69 | + @Excel(name = "已收数量", width = 15) | |
70 | + @ApiModelProperty(value = "已收数量") | |
71 | + private java.math.BigDecimal taskQty; | |
72 | + /** 库存状态 */ | |
73 | + @Excel(name = "库存状态", width = 15) | |
74 | + @Dict(dicCode = "inventory_status") | |
75 | + @ApiModelProperty(value = "库存状态") | |
76 | + private String inventoryStatus; | |
77 | + /** 批次 */ | |
78 | + @Excel(name = "批次", width = 15) | |
79 | + @ApiModelProperty(value = "批次") | |
80 | + private String batch; | |
81 | + /** 批号 */ | |
82 | + @Excel(name = "批号", width = 15) | |
83 | + @ApiModelProperty(value = "批号") | |
84 | + private String lot; | |
85 | + /** 项目号 */ | |
86 | + @Excel(name = "项目号", width = 15) | |
87 | + @ApiModelProperty(value = "项目号") | |
88 | + private String project; | |
89 | + /** 单据状态 */ | |
90 | + @Excel(name = "单据状态", width = 15) | |
91 | + @Dict(dicCode = "receive_status") | |
92 | + @ApiModelProperty(value = "单据状态") | |
93 | + private Integer status; | |
94 | + /** 上游单号 */ | |
95 | + @Excel(name = "上游单号", width = 15) | |
96 | + @ApiModelProperty(value = "上游单号") | |
97 | + private String referCode; | |
98 | + /** 上游行号 */ | |
99 | + @Excel(name = "上游行号", width = 15) | |
100 | + @ApiModelProperty(value = "上游行号") | |
101 | + private Integer referLineNum; | |
102 | + /** 创建人 */ | |
103 | + @ApiModelProperty(value = "创建人") | |
104 | + private String createBy; | |
105 | + /** 创建日期 */ | |
106 | + @ApiModelProperty(value = "创建日期") | |
107 | + private Date createTime; | |
108 | + /** 更新人 */ | |
109 | + @ApiModelProperty(value = "更新人") | |
110 | + private String updateBy; | |
111 | + /** 更新日期 */ | |
112 | + @ApiModelProperty(value = "更新日期") | |
113 | + private Date updateTime; | |
114 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/entity/ReceiveHeader.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.util.Date; | |
5 | + | |
6 | +import org.jeecg.common.aspect.annotation.Dict; | |
7 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
8 | + | |
9 | +import com.baomidou.mybatisplus.annotation.IdType; | |
10 | +import com.baomidou.mybatisplus.annotation.TableId; | |
11 | +import com.baomidou.mybatisplus.annotation.TableName; | |
12 | + | |
13 | +import io.swagger.annotations.ApiModel; | |
14 | +import io.swagger.annotations.ApiModelProperty; | |
15 | +import lombok.Data; | |
16 | + | |
17 | +/** | |
18 | + * @Description: 收货单表头 | |
19 | + * @Author: jeecg-boot | |
20 | + * @Date: 2023-08-22 | |
21 | + * @Version: V1.0 | |
22 | + */ | |
23 | +@Data | |
24 | +@TableName("receive_header") | |
25 | +@ApiModel(value = "receive_header对象", description = "收货单表头") | |
26 | +public class ReceiveHeader implements Serializable { | |
27 | + private static final long serialVersionUID = 1L; | |
28 | + | |
29 | + /** 主键 */ | |
30 | + @TableId(type = IdType.AUTO) | |
31 | + @ApiModelProperty(value = "主键") | |
32 | + private Integer id; | |
33 | + /** 编码 */ | |
34 | + @Excel(name = "编码", width = 15) | |
35 | + @ApiModelProperty(value = "编码") | |
36 | + private String code; | |
37 | + /** 仓库编码 */ | |
38 | + @Excel(name = "仓库编码", width = 15) | |
39 | + @ApiModelProperty(value = "仓库编码") | |
40 | + private String warehouseCode; | |
41 | + /** 仓库编码 */ | |
42 | + @Excel(name = "货主编码", width = 15) | |
43 | + @ApiModelProperty(value = "货主编码") | |
44 | + private String companyCode; | |
45 | + /** 头状态 */ | |
46 | + @Excel(name = "头状态", width = 15) | |
47 | + @ApiModelProperty(value = "头状态") | |
48 | + @Dict(dicCode = "receive_status") | |
49 | + private Integer firstStatus; | |
50 | + /** 尾状态 */ | |
51 | + @Excel(name = "尾状态", width = 15) | |
52 | + @ApiModelProperty(value = "尾状态") | |
53 | + @Dict(dicCode = "receive_status") | |
54 | + private Integer lastStatus; | |
55 | + /** 上游单号 */ | |
56 | + @Excel(name = "上游单号", width = 15) | |
57 | + @ApiModelProperty(value = "上游单号") | |
58 | + private String referCode; | |
59 | + /** 类型 */ | |
60 | + @Excel(name = "类型", width = 15) | |
61 | + @ApiModelProperty(value = "类型") | |
62 | + private String type; | |
63 | + /** 供应商编码 */ | |
64 | + @Excel(name = "供应商编码", width = 15) | |
65 | + @ApiModelProperty(value = "供应商编码") | |
66 | + private String supplierCode; | |
67 | + /** 总数量 */ | |
68 | + @Excel(name = "总数量", width = 15) | |
69 | + @ApiModelProperty(value = "总数量") | |
70 | + private java.math.BigDecimal totalQty; | |
71 | + /** 总行数 */ | |
72 | + @Excel(name = "总行数", width = 15) | |
73 | + @ApiModelProperty(value = "总行数") | |
74 | + private Integer totalLines; | |
75 | + /** 备注 */ | |
76 | + @Excel(name = "备注", width = 15) | |
77 | + @ApiModelProperty(value = "备注") | |
78 | + private String remark; | |
79 | + /** 创建人 */ | |
80 | + @ApiModelProperty(value = "创建人") | |
81 | + private String createBy; | |
82 | + /** 创建日期 */ | |
83 | + @ApiModelProperty(value = "创建日期") | |
84 | + private Date createTime; | |
85 | + /** 更新人 */ | |
86 | + @ApiModelProperty(value = "更新人") | |
87 | + private String updateBy; | |
88 | + /** 更新日期 */ | |
89 | + @ApiModelProperty(value = "更新日期") | |
90 | + private Date updateTime; | |
91 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/mapper/ReceiveDetailMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.mapper; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.apache.ibatis.annotations.Param; | |
6 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveDetail; | |
7 | + | |
8 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
9 | + | |
10 | +/** | |
11 | + * @Description: 收货单详情 | |
12 | + * @Author: jeecg-boot | |
13 | + * @Date: 2023-08-22 | |
14 | + * @Version: V1.0 | |
15 | + */ | |
16 | +public interface ReceiveDetailMapper extends BaseMapper<ReceiveDetail> { | |
17 | + | |
18 | + public boolean deleteByMainId(@Param("mainId") String mainId); | |
19 | + | |
20 | + public List<ReceiveDetail> selectByMainId(@Param("mainId") String mainId); | |
21 | + | |
22 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/mapper/ReceiveHeaderMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.mapper; | |
2 | + | |
3 | +import org.apache.ibatis.annotations.Param; | |
4 | +import org.apache.ibatis.annotations.Select; | |
5 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveHeader; | |
6 | + | |
7 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
8 | + | |
9 | +/** | |
10 | + * @Description: 收货单表头 | |
11 | + * @Author: jeecg-boot | |
12 | + * @Date: 2023-08-22 | |
13 | + * @Version: V1.0 | |
14 | + */ | |
15 | +public interface ReceiveHeaderMapper extends BaseMapper<ReceiveHeader> { | |
16 | + | |
17 | + @Select("select r.code from receive_header r where r.type = #{receiptType} order by r.code desc limit 1") | |
18 | + ReceiveHeader getMaxReceiveHeaderCode(@Param("receiptType") String receiptType); | |
19 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/mapper/xml/ReceiveDetailMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | +<mapper namespace="org.jeecg.modules.wms.receipt.receiveHeader.mapper.ReceiveDetailMapper"> | |
4 | + | |
5 | + <delete id="deleteByMainId" parameterType="java.lang.String"> | |
6 | + DELETE | |
7 | + FROM receive_detail | |
8 | + WHERE receive_id = #{mainId} | |
9 | + </delete> | |
10 | + | |
11 | + <select id="selectByMainId" parameterType="java.lang.String" | |
12 | + resultType="org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveDetail"> | |
13 | + SELECT * | |
14 | + FROM receive_detail | |
15 | + WHERE receive_id = #{mainId} | |
16 | + </select> | |
17 | +</mapper> | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/mapper/xml/ReceiveHeaderMapper.xml
0 → 100644
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/service/IReceiveDetailService.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.service; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.jeecg.common.api.vo.Result; | |
6 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveDetail; | |
7 | + | |
8 | +import com.baomidou.mybatisplus.extension.service.IService; | |
9 | + | |
10 | +/** | |
11 | + * @Description: 收货单详情 | |
12 | + * @Author: jeecg-boot | |
13 | + * @Date: 2023-08-22 | |
14 | + * @Version: V1.0 | |
15 | + */ | |
16 | +public interface IReceiveDetailService extends IService<ReceiveDetail> { | |
17 | + | |
18 | + public List<ReceiveDetail> selectByMainId(String mainId); | |
19 | + | |
20 | + Result saveReceiveDetail(ReceiveDetail receiveDetail); | |
21 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/service/IReceiveHeaderService.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.service; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.util.Collection; | |
5 | + | |
6 | +import org.jeecg.common.api.vo.Result; | |
7 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveHeader; | |
8 | + | |
9 | +import com.baomidou.mybatisplus.extension.service.IService; | |
10 | + | |
11 | +/** | |
12 | + * @Description: 收货单表头 | |
13 | + * @Author: jeecg-boot | |
14 | + * @Date: 2023-08-22 | |
15 | + * @Version: V1.0 | |
16 | + */ | |
17 | +public interface IReceiveHeaderService extends IService<ReceiveHeader> { | |
18 | + | |
19 | + /** | |
20 | + * 删除一对多 | |
21 | + */ | |
22 | + public void delMain(String id); | |
23 | + | |
24 | + /** | |
25 | + * 批量删除一对多 | |
26 | + */ | |
27 | + public void delBatchMain(Collection<? extends Serializable> idList); | |
28 | + | |
29 | + /** | |
30 | + * 保存收货单 | |
31 | + */ | |
32 | + Result saveReceiveHeader(ReceiveHeader receiveHeader); | |
33 | + | |
34 | + ReceiveHeader getReceiveHeaderByReferCode(String referCode, String warehouseCode); | |
35 | + | |
36 | + String createReceiveCode(String receiptType); | |
37 | + | |
38 | + boolean updateReceiveHeader(Integer id); | |
39 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/service/impl/ReceiveDetailServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.service.impl; | |
2 | + | |
3 | +import java.util.Collections; | |
4 | +import java.util.List; | |
5 | + | |
6 | +import javax.annotation.Resource; | |
7 | + | |
8 | +import org.jeecg.common.api.vo.Result; | |
9 | +import org.jeecg.common.exception.JeecgBootException; | |
10 | +import org.jeecg.modules.wms.config.material.entity.Material; | |
11 | +import org.jeecg.modules.wms.config.material.service.IMaterialService; | |
12 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveDetail; | |
13 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveHeader; | |
14 | +import org.jeecg.modules.wms.receipt.receiveHeader.mapper.ReceiveDetailMapper; | |
15 | +import org.jeecg.modules.wms.receipt.receiveHeader.service.IReceiveDetailService; | |
16 | +import org.jeecg.modules.wms.receipt.receiveHeader.service.IReceiveHeaderService; | |
17 | +import org.jeecg.utils.StringUtils; | |
18 | +import org.jeecg.utils.constant.QuantityConstant; | |
19 | +import org.springframework.beans.factory.annotation.Autowired; | |
20 | +import org.springframework.stereotype.Service; | |
21 | +import org.springframework.transaction.annotation.Transactional; | |
22 | + | |
23 | +import com.alibaba.fastjson.JSON; | |
24 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
25 | + | |
26 | +import cn.monitor4all.logRecord.context.LogRecordContext; | |
27 | + | |
28 | +/** | |
29 | + * @Description: 收货单详情 | |
30 | + * @Author: jeecg-boot | |
31 | + * @Date: 2023-08-22 | |
32 | + * @Version: V1.0 | |
33 | + */ | |
34 | +@Service | |
35 | +public class ReceiveDetailServiceImpl extends ServiceImpl<ReceiveDetailMapper, ReceiveDetail> implements IReceiveDetailService { | |
36 | + | |
37 | + @Autowired | |
38 | + private ReceiveDetailMapper receiveDetailMapper; | |
39 | + | |
40 | + @Resource | |
41 | + private IReceiveHeaderService receiveHeaderService; | |
42 | + @Resource | |
43 | + private IMaterialService materialService; | |
44 | + @Resource | |
45 | + private IReceiveDetailService receiveDetailService; | |
46 | + | |
47 | + @Override | |
48 | + public List<ReceiveDetail> selectByMainId(String mainId) { | |
49 | + return receiveDetailMapper.selectByMainId(mainId); | |
50 | + } | |
51 | + | |
52 | + @Override | |
53 | + @Transactional | |
54 | + public Result saveReceiveDetail(ReceiveDetail receiveDetail) { | |
55 | + ReceiveHeader receiveHeader = receiveHeaderService.getById(receiveDetail.getReceiveId()); | |
56 | + if (receiveHeader == null) { | |
57 | + return Result.error("添加失败,没有找到入库单头"); | |
58 | + } | |
59 | + if (receiveHeader.getFirstStatus().intValue() != QuantityConstant.RECEIVE_HEADER_BUILD) { | |
60 | + return Result.error("添加失败,收货单非创建状态不能新增详情"); | |
61 | + } | |
62 | + String receiveCode = receiveHeader.getCode(); | |
63 | + if (StringUtils.isEmpty(receiveCode)) { | |
64 | + return Result.error("添加失败,没有找到收货单编码"); | |
65 | + } | |
66 | + String warehouseCode = receiveHeader.getWarehouseCode(); | |
67 | + String companyCode = receiveHeader.getCompanyCode(); | |
68 | + String materialCode = receiveDetail.getMaterialCode(); | |
69 | + Material material = materialService.getMaterialByCode(materialCode); | |
70 | + if (material == null) { | |
71 | + return Result.error("添加失败,没有找到物料信息," + materialCode); | |
72 | + } | |
73 | + String materialName = material.getName(); | |
74 | + String materialSpec = material.getSpec(); | |
75 | + String materialUnit = material.getUnit(); | |
76 | + receiveDetail.setReceiveCode(receiveCode); | |
77 | + receiveDetail.setWarehouseCode(warehouseCode); | |
78 | + receiveDetail.setCompanyCode(companyCode); | |
79 | + receiveDetail.setMaterialName(materialName); | |
80 | + receiveDetail.setMaterialSpec(materialSpec); | |
81 | + receiveDetail.setMaterialUnit(materialUnit); | |
82 | + receiveDetail.setStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
83 | + boolean success = receiveDetailService.save(receiveDetail); | |
84 | + if (!success) { | |
85 | + throw new JeecgBootException("添加失败, 保存收货单详情的时候报错"); | |
86 | + } | |
87 | + success = receiveHeaderService.updateReceiveHeader(receiveDetail.getReceiveId()); | |
88 | + if (!success) { | |
89 | + throw new JeecgBootException("添加失败, 保存收货单详失败"); | |
90 | + } | |
91 | + LogRecordContext.putVariable("extraJsonString", JSON.toJSONString(Collections.singletonList(receiveDetail)));// 操作日志收集 | |
92 | + return Result.OK("添加成功!"); | |
93 | + } | |
94 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/receipt/receiveHeader/service/impl/ReceiveHeaderServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.receipt.receiveHeader.service.impl; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.math.BigDecimal; | |
5 | +import java.text.SimpleDateFormat; | |
6 | +import java.util.Collection; | |
7 | +import java.util.Date; | |
8 | +import java.util.List; | |
9 | + | |
10 | +import javax.annotation.Resource; | |
11 | + | |
12 | +import org.jeecg.common.api.vo.Result; | |
13 | +import org.jeecg.common.exception.JeecgBootException; | |
14 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveDetail; | |
15 | +import org.jeecg.modules.wms.receipt.receiveHeader.entity.ReceiveHeader; | |
16 | +import org.jeecg.modules.wms.receipt.receiveHeader.mapper.ReceiveDetailMapper; | |
17 | +import org.jeecg.modules.wms.receipt.receiveHeader.mapper.ReceiveHeaderMapper; | |
18 | +import org.jeecg.modules.wms.receipt.receiveHeader.service.IReceiveDetailService; | |
19 | +import org.jeecg.modules.wms.receipt.receiveHeader.service.IReceiveHeaderService; | |
20 | +import org.jeecg.utils.StringUtils; | |
21 | +import org.jeecg.utils.constant.QuantityConstant; | |
22 | +import org.springframework.beans.factory.annotation.Autowired; | |
23 | +import org.springframework.stereotype.Service; | |
24 | +import org.springframework.transaction.annotation.Transactional; | |
25 | + | |
26 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
27 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
28 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
29 | + | |
30 | +/** | |
31 | + * @Description: 收货单表头 | |
32 | + * @Author: jeecg-boot | |
33 | + * @Date: 2023-08-22 | |
34 | + * @Version: V1.0 | |
35 | + */ | |
36 | +@Service | |
37 | +public class ReceiveHeaderServiceImpl extends ServiceImpl<ReceiveHeaderMapper, ReceiveHeader> implements IReceiveHeaderService { | |
38 | + | |
39 | + @Autowired | |
40 | + private ReceiveHeaderMapper receiveHeaderMapper; | |
41 | + @Autowired | |
42 | + private ReceiveDetailMapper receiveDetailMapper; | |
43 | + @Resource | |
44 | + private IReceiveHeaderService receiveHeaderService; | |
45 | + @Resource | |
46 | + private IReceiveDetailService receiveDetailService; | |
47 | + | |
48 | + @Override | |
49 | + @Transactional | |
50 | + public void delMain(String id) { | |
51 | + receiveDetailMapper.deleteByMainId(id); | |
52 | + receiveHeaderMapper.deleteById(id); | |
53 | + } | |
54 | + | |
55 | + @Override | |
56 | + @Transactional | |
57 | + public void delBatchMain(Collection<? extends Serializable> idList) { | |
58 | + for (Serializable id : idList) { | |
59 | + receiveDetailMapper.deleteByMainId(id.toString()); | |
60 | + receiveHeaderMapper.deleteById(id); | |
61 | + } | |
62 | + } | |
63 | + | |
64 | + @Override | |
65 | + public Result saveReceiveHeader(ReceiveHeader receiveHeader) { | |
66 | + String warehouseCode = receiveHeader.getWarehouseCode(); | |
67 | + String referCode = receiveHeader.getReferCode(); | |
68 | + if (StringUtils.isNotEmpty(referCode)) { | |
69 | + ReceiveHeader referReceiveHeader = receiveHeaderService.getReceiveHeaderByReferCode(referCode, warehouseCode); | |
70 | + if (referReceiveHeader != null) { | |
71 | + return Result.error("上游单号" + referCode + ",已经存在"); | |
72 | + } | |
73 | + } | |
74 | + String code = receiveHeaderService.createReceiveCode(QuantityConstant.RECEIVE_BILL_SH); | |
75 | + if (StringUtils.isEmpty(code)) { | |
76 | + throw new JeecgBootException("根据收货单据类型" + QuantityConstant.RECEIVE_BILL_SH + "生成单号失败"); | |
77 | + } | |
78 | + receiveHeader.setType(QuantityConstant.RECEIVE_BILL_SH); | |
79 | + receiveHeader.setCode(code); | |
80 | + receiveHeader.setFirstStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
81 | + receiveHeader.setLastStatus(QuantityConstant.RECEIPT_HEADER_BUILD); | |
82 | + boolean success = save(receiveHeader); | |
83 | + if (!success) { | |
84 | + return Result.OK("添加失败!"); | |
85 | + } | |
86 | + return Result.OK("添加成功!", receiveHeader); | |
87 | + } | |
88 | + | |
89 | + @Override | |
90 | + public ReceiveHeader getReceiveHeaderByReferCode(String referCode, String warehouseCode) { | |
91 | + LambdaQueryWrapper<ReceiveHeader> receiveHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
92 | + receiveHeaderLambdaQueryWrapper.eq(ReceiveHeader::getReferCode, referCode).eq(ReceiveHeader::getWarehouseCode, warehouseCode); | |
93 | + ReceiveHeader receiveHeader = getOne(receiveHeaderLambdaQueryWrapper); | |
94 | + return receiveHeader; | |
95 | + } | |
96 | + | |
97 | + @Override | |
98 | + public String createReceiveCode(String receiptType) { | |
99 | + String code = null; | |
100 | + Date now = new Date(); | |
101 | + SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); | |
102 | + String maxCode = null; | |
103 | + ReceiveHeader receiveHeader = receiveHeaderMapper.getMaxReceiveHeaderCode(receiptType); | |
104 | + if (receiveHeader != null) { | |
105 | + maxCode = receiveHeader.getCode(); | |
106 | + } | |
107 | + if (maxCode != null) { | |
108 | + String day = maxCode.substring(maxCode.length() - 13, maxCode.length() - 5); | |
109 | + if (day.equals(df.format(now))) { | |
110 | + Integer Count = Integer.valueOf(maxCode.substring(maxCode.length() - 5, maxCode.length())); | |
111 | + code = receiptType + df.format(now) + String.format("%05d", Count + 1); | |
112 | + } else { | |
113 | + code = receiptType + df.format(now) + String.format("%05d", 0000 + 1); | |
114 | + } | |
115 | + } else { | |
116 | + code = receiptType + df.format(now) + String.format("%05d", 0000 + 1); | |
117 | + } | |
118 | + return code; | |
119 | + } | |
120 | + | |
121 | + @Override | |
122 | + public boolean updateReceiveHeader(Integer id) { | |
123 | + LambdaQueryWrapper<ReceiveDetail> receiveDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
124 | + receiveDetailLambdaQueryWrapper.eq(ReceiveDetail::getReceiveId, id); | |
125 | + List<ReceiveDetail> receiveDetailList = receiveDetailService.list(receiveDetailLambdaQueryWrapper); | |
126 | + ReceiveHeader receiveHeader = receiveHeaderService.getById(id); | |
127 | + if (receiveHeader == null) { | |
128 | + return false; | |
129 | + } | |
130 | + BigDecimal totalQty = new BigDecimal(0); | |
131 | + int totalLines = 0; | |
132 | + for (ReceiveDetail receiveDetail : receiveDetailList) { | |
133 | + totalLines++; | |
134 | + totalQty = totalQty.add(receiveDetail.getQty()); | |
135 | + } | |
136 | + receiveHeader = new ReceiveHeader(); | |
137 | + receiveHeader.setId(id); | |
138 | + receiveHeader.setTotalQty(totalQty); | |
139 | + receiveHeader.setTotalLines(totalLines); | |
140 | + if (!receiveHeaderService.updateById(receiveHeader)) { | |
141 | + return false; | |
142 | + } | |
143 | + return true; | |
144 | + } | |
145 | +} | |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -396,6 +396,13 @@ public class QuantityConstant { |
396 | 396 | // 审核驳回 |
397 | 397 | public static final Integer AUDIT_NO_STATUS = 2; |
398 | 398 | |
399 | + // 收货单新建状态 | |
400 | + public static final Integer RECEIVE_HEADER_BUILD = 0; | |
401 | + // 收货单部分收货状态 | |
402 | + public static final Integer RECEIVE_HEADER_HALF = 100; | |
403 | + // 收货单完成收货状态 | |
404 | + public static final Integer RECEIVE_HEADER_COMPLETE = 200; | |
405 | + | |
399 | 406 | // WCS库位信息查询 |
400 | 407 | public static final String ADDRESS_WCS_LOCATION_INFO = "WCS_LOCATION_INFO"; |
401 | 408 | |
... | ... | @@ -544,6 +551,9 @@ public class QuantityConstant { |
544 | 551 | public static final String BILL_TYPE_SHIPMENT_SINGLE = "JDSCLL01_SYS"; |
545 | 552 | public static final String BILL_TYPE_SHIPMENT_OTHER = "SO"; |
546 | 553 | |
554 | + /* 收货单据类型 */ | |
555 | + public static final String RECEIVE_BILL_SH = "SH"; // 收货单 | |
556 | + | |
547 | 557 | /* 入库单据类型 */ |
548 | 558 | public static final String RECEIPT_BILL_TYPE_SCR = "SCR"; // 生产入库单 |
549 | 559 | public static final String RECEIPT_BILL_TYPE_DBR = "DBR"; // 调拨入库单 |
... | ... |