Commit 051b62205f21d7356cb70aa1ae90b96380b7dc68
1 parent
3e216c00
增加库存、库存明细、库存交易、下发任务等
Showing
72 changed files
with
6283 additions
and
47 deletions
jeecg-boot-master/ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -107,6 +107,7 @@ export const getShipmentTypeList = (params)=>getAction('/config/shipmentType/get |
107 | 107 | export const searchMaterialByCode = (params)=>postAction('/config/material/searchMaterialByCode', params); |
108 | 108 | export const listReceiveByReceiptId = (params)=>postAction('/receipt/receiveHeader/listReceiveByReceiptId', params); |
109 | 109 | export const createTask = (params)=>postAction('/receipt/receiptContainerHeader/createTask', params); |
110 | +export const completeTaskByWMS = (params)=>postAction('/task/taskHeader/completeTaskByWMS', params); | |
110 | 111 | |
111 | 112 | |
112 | 113 | // 中转HTTP请求 |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryDetailList.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 | + <template slot="htmlSlot" slot-scope="text"> | |
45 | + <div v-html="text"></div> | |
46 | + </template> | |
47 | + <template slot="imgSlot" slot-scope="text"> | |
48 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
49 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
50 | + </template> | |
51 | + <template slot="fileSlot" slot-scope="text"> | |
52 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
53 | + <a-button | |
54 | + v-else | |
55 | + :ghost="true" | |
56 | + type="primary" | |
57 | + icon="download" | |
58 | + size="small" | |
59 | + @click="downloadFile(text)"> | |
60 | + 下载 | |
61 | + </a-button> | |
62 | + </template> | |
63 | + | |
64 | + <span slot="action" slot-scope="text, record"> | |
65 | + <a @click="handleEdit(record)">编辑</a> | |
66 | + <a-divider type="vertical" /> | |
67 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
68 | + <a>删除</a> | |
69 | + </a-popconfirm> | |
70 | + </span> | |
71 | + | |
72 | + </a-table> | |
73 | + </div> | |
74 | + | |
75 | + <inventoryDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></inventoryDetail-modal> | |
76 | + </a-card> | |
77 | +</template> | |
78 | + | |
79 | +<script> | |
80 | + | |
81 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
82 | + import InventoryDetailModal from './modules/InventoryDetailModal' | |
83 | + | |
84 | + export default { | |
85 | + name: "InventoryDetailList", | |
86 | + mixins:[JeecgListMixin], | |
87 | + components: { InventoryDetailModal }, | |
88 | + props:{ | |
89 | + mainId:{ | |
90 | + type:String, | |
91 | + default:'', | |
92 | + required:false | |
93 | + } | |
94 | + }, | |
95 | + watch:{ | |
96 | + mainId:{ | |
97 | + immediate: true, | |
98 | + handler(val) { | |
99 | + if(!this.mainId){ | |
100 | + this.clearList() | |
101 | + }else{ | |
102 | + this.queryParam['inventoryHeaderId'] = val | |
103 | + this.loadData(1); | |
104 | + } | |
105 | + } | |
106 | + } | |
107 | + }, | |
108 | + data () { | |
109 | + return { | |
110 | + description: '库存表管理页面', | |
111 | + disableMixinCreated:true, | |
112 | + // 表头 | |
113 | + columns: [ | |
114 | + { | |
115 | + title:'库存详情ID', | |
116 | + align:"center", | |
117 | + dataIndex: 'id' | |
118 | + }, | |
119 | + { | |
120 | + title:'货主', | |
121 | + align:"center", | |
122 | + dataIndex: 'companyCode' | |
123 | + }, | |
124 | + { | |
125 | + title:'库区', | |
126 | + align:"center", | |
127 | + dataIndex: 'zoneCode' | |
128 | + }, | |
129 | + { | |
130 | + title:'容器编码', | |
131 | + align:"center", | |
132 | + dataIndex: 'containerCode' | |
133 | + }, | |
134 | + { | |
135 | + title:'库位编码', | |
136 | + align:"center", | |
137 | + dataIndex: 'locationCode' | |
138 | + }, | |
139 | + { | |
140 | + title:'物料编码', | |
141 | + align:"center", | |
142 | + dataIndex: 'materialCode' | |
143 | + }, | |
144 | + { | |
145 | + title:'物料名称', | |
146 | + align:"center", | |
147 | + dataIndex: 'materialName' | |
148 | + }, | |
149 | + { | |
150 | + title:'物料规格', | |
151 | + align:"center", | |
152 | + dataIndex: 'materialSpec' | |
153 | + }, | |
154 | + { | |
155 | + title:'物料单位', | |
156 | + align:"center", | |
157 | + dataIndex: 'materialUnit' | |
158 | + }, | |
159 | + { | |
160 | + title:'数量', | |
161 | + align:"center", | |
162 | + dataIndex: 'qty' | |
163 | + }, | |
164 | + { | |
165 | + title:'任务锁定数量', | |
166 | + align:"center", | |
167 | + dataIndex: 'taskQty' | |
168 | + }, | |
169 | + { | |
170 | + title:'库存状态', | |
171 | + align:"center", | |
172 | + dataIndex: 'inventoryStatus_dictText', | |
173 | + }, | |
174 | + { | |
175 | + title:'批次', | |
176 | + align:"center", | |
177 | + dataIndex: 'batch' | |
178 | + }, | |
179 | + { | |
180 | + title:'唯一号', | |
181 | + align:"center", | |
182 | + dataIndex: 'uniqueCode' | |
183 | + }, | |
184 | + { | |
185 | + title:'入库日期', | |
186 | + align:"center", | |
187 | + dataIndex: 'receiptDate' | |
188 | + }, | |
189 | + { | |
190 | + title:'库龄(天)', | |
191 | + align:"center", | |
192 | + dataIndex: 'inventoryAge' | |
193 | + }, | |
194 | + { | |
195 | + title:'创建人', | |
196 | + align:"center", | |
197 | + dataIndex: 'createBy' | |
198 | + }, | |
199 | + { | |
200 | + title:'创建日期', | |
201 | + align:"center", | |
202 | + dataIndex: 'createTime' | |
203 | + }, | |
204 | + { | |
205 | + title:'更新人', | |
206 | + align:"center", | |
207 | + dataIndex: 'updateBy' | |
208 | + }, | |
209 | + { | |
210 | + title:'更新日期', | |
211 | + align:"center", | |
212 | + dataIndex: 'updateTime' | |
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: "/inventory/inventoryHeader/listInventoryDetailByMainId", | |
225 | + delete: "/inventory/inventoryHeader/deleteInventoryDetail", | |
226 | + deleteBatch: "/inventory/inventoryHeader/deleteBatchInventoryDetail", | |
227 | + exportXlsUrl: "/inventory/inventoryHeader/exportInventoryDetail", | |
228 | + importUrl: "/inventory/inventoryHeader/importInventoryDetail", | |
229 | + }, | |
230 | + dictOptions:{ | |
231 | + containerStatus:[], | |
232 | + } | |
233 | + } | |
234 | + }, | |
235 | + created() { | |
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 | + | |
249 | + } | |
250 | + } | |
251 | +</script> | |
252 | +<style scoped> | |
253 | + @import '~@assets/less/common.less' | |
254 | +</style> | |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryHeaderList.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.companyCode"></a-input> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | + <a-form-item label="库区"> | |
14 | + <a-input placeholder="请输入库区" v-model="queryParam.zoneCode"></a-input> | |
15 | + </a-form-item> | |
16 | + </a-col> | |
17 | + <template v-if="toggleSearchStatus"> | |
18 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
19 | + <a-form-item label="容器号"> | |
20 | + <a-input placeholder="请输入容器号" v-model="queryParam.containerCode"></a-input> | |
21 | + </a-form-item> | |
22 | + </a-col> | |
23 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
24 | + <a-form-item label="容器状态"> | |
25 | + <j-dict-select-tag placeholder="请选择容器状态" v-model="queryParam.containerStatus" dictCode="container_status"/> | |
26 | + </a-form-item> | |
27 | + </a-col> | |
28 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
29 | + <a-form-item label="库位号"> | |
30 | + <a-input placeholder="请输入库位号" v-model="queryParam.locationCode"></a-input> | |
31 | + </a-form-item> | |
32 | + </a-col> | |
33 | + <a-col :xl="10" :lg="11" :md="12" :sm="24"> | |
34 | + <a-form-item label="创建日期"> | |
35 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> | |
36 | + <span class="query-group-split-cust"></span> | |
37 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> | |
38 | + </a-form-item> | |
39 | + </a-col> | |
40 | + </template> | |
41 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
42 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
43 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
44 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
45 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
46 | + {{ toggleSearchStatus ? '收起' : '展开' }} | |
47 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
48 | + </a> | |
49 | + </span> | |
50 | + </a-col> | |
51 | + </a-row> | |
52 | + </a-form> | |
53 | + </div> | |
54 | + <!-- 查询区域-END --> | |
55 | + | |
56 | + <!-- 操作按钮区域 --> | |
57 | + <div class="table-operator"> | |
58 | + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
59 | + <a-button type="primary" icon="download" @click="handleExportXls('库存表')">导出</a-button> | |
60 | + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
61 | + <a-button type="primary" icon="import">导入</a-button> | |
62 | + </a-upload> | |
63 | + <!-- 高级查询区域 --> | |
64 | + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
65 | + </div> | |
66 | + | |
67 | + <!-- table区域-begin --> | |
68 | + <div> | |
69 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
70 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
71 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
72 | + </div> | |
73 | + | |
74 | + <a-table | |
75 | + ref="table" | |
76 | + size="middle" | |
77 | + bordered | |
78 | + rowKey="id" | |
79 | + class="j-table-force-nowrap" | |
80 | + :scroll="{x:true}" | |
81 | + :columns="columns" | |
82 | + :dataSource="dataSource" | |
83 | + :pagination="ipagination" | |
84 | + :loading="loading" | |
85 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'radio'}" | |
86 | + :customRow="clickThenSelect" | |
87 | + @change="handleTableChange"> | |
88 | + | |
89 | + <template slot="htmlSlot" slot-scope="text"> | |
90 | + <div v-html="text"></div> | |
91 | + </template> | |
92 | + <template slot="imgSlot" slot-scope="text"> | |
93 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
94 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
95 | + </template> | |
96 | + <template slot="fileSlot" slot-scope="text"> | |
97 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
98 | + <a-button | |
99 | + v-else | |
100 | + :ghost="true" | |
101 | + type="primary" | |
102 | + icon="download" | |
103 | + size="small" | |
104 | + @click="downloadFile(text)"> | |
105 | + 下载 | |
106 | + </a-button> | |
107 | + </template> | |
108 | + | |
109 | + <span slot="action" slot-scope="text, record"> | |
110 | + <a @click="handleEdit(record)">编辑</a> | |
111 | + | |
112 | + <a-divider type="vertical" /> | |
113 | + <a-dropdown> | |
114 | + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
115 | + <a-menu slot="overlay"> | |
116 | + <a-menu-item> | |
117 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
118 | + <a>删除</a> | |
119 | + </a-popconfirm> | |
120 | + </a-menu-item> | |
121 | + </a-menu> | |
122 | + </a-dropdown> | |
123 | + </span> | |
124 | + | |
125 | + </a-table> | |
126 | + </div> | |
127 | + | |
128 | + <a-tabs defaultActiveKey="1"> | |
129 | + <a-tab-pane tab="库存详情" key="1" > | |
130 | + <InventoryDetailList :mainId="selectedMainId" /> | |
131 | + </a-tab-pane> | |
132 | + </a-tabs> | |
133 | + | |
134 | + <inventoryHeader-modal ref="modalForm" @ok="modalFormOk"></inventoryHeader-modal> | |
135 | + </a-card> | |
136 | +</template> | |
137 | + | |
138 | +<script> | |
139 | + | |
140 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
141 | + import InventoryHeaderModal from './modules/InventoryHeaderModal' | |
142 | + import { getAction } from '@/api/manage' | |
143 | + import InventoryDetailList from './InventoryDetailList' | |
144 | + import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |
145 | + import '@/assets/less/TableExpand.less' | |
146 | + | |
147 | + export default { | |
148 | + name: "InventoryHeaderList", | |
149 | + mixins:[JeecgListMixin], | |
150 | + components: { | |
151 | + InventoryDetailList, | |
152 | + InventoryHeaderModal | |
153 | + }, | |
154 | + data () { | |
155 | + return { | |
156 | + description: '库存表管理页面', | |
157 | + // 表头 | |
158 | + columns: [ | |
159 | + { | |
160 | + title:'库存ID', | |
161 | + align:"center", | |
162 | + dataIndex: 'id' | |
163 | + }, | |
164 | + { | |
165 | + title:'库区', | |
166 | + align:"center", | |
167 | + dataIndex: 'zoneCode' | |
168 | + }, | |
169 | + { | |
170 | + title:'容器号', | |
171 | + align:"center", | |
172 | + dataIndex: 'containerCode' | |
173 | + }, | |
174 | + { | |
175 | + title:'容器状态', | |
176 | + align:"center", | |
177 | + dataIndex: 'containerStatus_dictText', | |
178 | + }, | |
179 | + { | |
180 | + title:'库位号', | |
181 | + align:"center", | |
182 | + dataIndex: 'locationCode' | |
183 | + }, | |
184 | + { | |
185 | + title:'总数量', | |
186 | + align:"center", | |
187 | + dataIndex: 'totalQty' | |
188 | + }, | |
189 | + { | |
190 | + title:'总行量', | |
191 | + align:"center", | |
192 | + dataIndex: 'totalLines' | |
193 | + }, | |
194 | + { | |
195 | + title:'创建人', | |
196 | + align:"center", | |
197 | + dataIndex: 'createBy' | |
198 | + }, | |
199 | + { | |
200 | + title:'创建日期', | |
201 | + align:"center", | |
202 | + dataIndex: 'createTime' | |
203 | + }, | |
204 | + { | |
205 | + title:'更新人', | |
206 | + align:"center", | |
207 | + dataIndex: 'updateBy' | |
208 | + }, | |
209 | + { | |
210 | + title:'更新日期', | |
211 | + align:"center", | |
212 | + dataIndex: 'updateTime' | |
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: "/inventory/inventoryHeader/list", | |
225 | + delete: "/inventory/inventoryHeader/delete", | |
226 | + deleteBatch: "/inventory/inventoryHeader/deleteBatch", | |
227 | + exportXlsUrl: "/inventory/inventoryHeader/exportXls", | |
228 | + importExcelUrl: "inventory/inventoryHeader/importExcel", | |
229 | + }, | |
230 | + dictOptions:{ | |
231 | + containerStatus:[], | |
232 | + }, | |
233 | + /* 分页参数 */ | |
234 | + ipagination:{ | |
235 | + current: 1, | |
236 | + pageSize: 5, | |
237 | + pageSizeOptions: ['5', '10', '50'], | |
238 | + showTotal: (total, range) => { | |
239 | + return range[0] + "-" + range[1] + " 共" + total + "条" | |
240 | + }, | |
241 | + showQuickJumper: true, | |
242 | + showSizeChanger: true, | |
243 | + total: 0 | |
244 | + }, | |
245 | + selectedMainId:'', | |
246 | + superFieldList:[], | |
247 | + } | |
248 | + }, | |
249 | + created() { | |
250 | + this.getSuperFieldList(); | |
251 | + }, | |
252 | + computed: { | |
253 | + importExcelUrl: function(){ | |
254 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
255 | + } | |
256 | + }, | |
257 | + methods: { | |
258 | + initDictConfig(){ | |
259 | + }, | |
260 | + clickThenSelect(record) { | |
261 | + return { | |
262 | + on: { | |
263 | + click: () => { | |
264 | + this.onSelectChange(record.id.split(","), [record]); | |
265 | + } | |
266 | + } | |
267 | + } | |
268 | + }, | |
269 | + onClearSelected() { | |
270 | + this.selectedRowKeys = []; | |
271 | + this.selectionRows = []; | |
272 | + this.selectedMainId='' | |
273 | + }, | |
274 | + onSelectChange(selectedRowKeys, selectionRows) { | |
275 | + this.selectedMainId=selectedRowKeys[0] | |
276 | + this.selectedRowKeys = selectedRowKeys; | |
277 | + this.selectionRows = selectionRows; | |
278 | + }, | |
279 | + loadData(arg) { | |
280 | + if(!this.url.list){ | |
281 | + this.$message.error("请设置url.list属性!") | |
282 | + return | |
283 | + } | |
284 | + //加载数据 若传入参数1则加载第一页的内容 | |
285 | + if (arg === 1) { | |
286 | + this.ipagination.current = 1; | |
287 | + } | |
288 | + this.onClearSelected() | |
289 | + var params = this.getQueryParams();//查询条件 | |
290 | + this.loading = true; | |
291 | + getAction(this.url.list, params).then((res) => { | |
292 | + if (res.success) { | |
293 | + this.dataSource = res.result.records; | |
294 | + this.ipagination.total = res.result.total; | |
295 | + } | |
296 | + if(res.code===510){ | |
297 | + this.$message.warning(res.message) | |
298 | + } | |
299 | + this.loading = false; | |
300 | + }) | |
301 | + }, | |
302 | + getSuperFieldList(){ | |
303 | + let fieldList=[]; | |
304 | + fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''}) | |
305 | + fieldList.push({type:'string',value:'zoneCode',text:'库区',dictCode:''}) | |
306 | + fieldList.push({type:'string',value:'containerCode',text:'容器号',dictCode:''}) | |
307 | + fieldList.push({type:'string',value:'containerStatus',text:'容器状态',dictCode:'container_status'}) | |
308 | + fieldList.push({type:'string',value:'locationCode',text:'库位号',dictCode:''}) | |
309 | + fieldList.push({type:'BigDecimal',value:'totalQty',text:'总数量',dictCode:''}) | |
310 | + fieldList.push({type:'int',value:'totalLines',text:'总行量',dictCode:''}) | |
311 | + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) | |
312 | + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) | |
313 | + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) | |
314 | + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) | |
315 | + this.superFieldList = fieldList | |
316 | + } | |
317 | + } | |
318 | + } | |
319 | +</script> | |
320 | +<style scoped> | |
321 | + @import '~@assets/less/common.less' | |
322 | +</style> | |
0 | 323 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/InventoryTransactionList.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.companyCode"></a-input> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | + <a-form-item label="容器编码"> | |
14 | + <a-input placeholder="请输入容器编码" v-model="queryParam.containerCode"></a-input> | |
15 | + </a-form-item> | |
16 | + </a-col> | |
17 | + <template v-if="toggleSearchStatus"> | |
18 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
19 | + <a-form-item label="库位编码"> | |
20 | + <a-input placeholder="请输入库位编码" v-model="queryParam.locationCode"></a-input> | |
21 | + </a-form-item> | |
22 | + </a-col> | |
23 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
24 | + <a-form-item label="交易类型"> | |
25 | + <j-dict-select-tag placeholder="请选择交易类型" v-model="queryParam.type" dictCode="inventory_transaction_type"/> | |
26 | + </a-form-item> | |
27 | + </a-col> | |
28 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
29 | + <a-form-item label="物料编码"> | |
30 | + <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input> | |
31 | + </a-form-item> | |
32 | + </a-col> | |
33 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
34 | + <a-form-item label="物料名称"> | |
35 | + <a-input placeholder="请输入物料名称" v-model="queryParam.materialName"></a-input> | |
36 | + </a-form-item> | |
37 | + </a-col> | |
38 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
39 | + <a-form-item label="物料规格"> | |
40 | + <a-input placeholder="请输入物料规格" v-model="queryParam.materialSpec"></a-input> | |
41 | + </a-form-item> | |
42 | + </a-col> | |
43 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
44 | + <a-form-item label="物料单位"> | |
45 | + <a-input placeholder="请输入物料单位" v-model="queryParam.materialUnit"></a-input> | |
46 | + </a-form-item> | |
47 | + </a-col> | |
48 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
49 | + <a-form-item label="库存状态"> | |
50 | + <a-input placeholder="请输入库存状态" v-model="queryParam.inventoryStatus"></a-input> | |
51 | + </a-form-item> | |
52 | + </a-col> | |
53 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
54 | + <a-form-item label="批次"> | |
55 | + <a-input placeholder="请输入批次" v-model="queryParam.batch"></a-input> | |
56 | + </a-form-item> | |
57 | + </a-col> | |
58 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
59 | + <a-form-item label="创建人"> | |
60 | + <a-input placeholder="请输入创建人" v-model="queryParam.createBy"></a-input> | |
61 | + </a-form-item> | |
62 | + </a-col> | |
63 | + <a-col :xl="10" :lg="11" :md="12" :sm="24"> | |
64 | + <a-form-item label="创建日期"> | |
65 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> | |
66 | + <span class="query-group-split-cust"></span> | |
67 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> | |
68 | + </a-form-item> | |
69 | + </a-col> | |
70 | + </template> | |
71 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
72 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
73 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
74 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
75 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
76 | + {{ toggleSearchStatus ? '收起' : '展开' }} | |
77 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
78 | + </a> | |
79 | + </span> | |
80 | + </a-col> | |
81 | + </a-row> | |
82 | + </a-form> | |
83 | + </div> | |
84 | + <!-- 查询区域-END --> | |
85 | + | |
86 | + <!-- 操作按钮区域 --> | |
87 | + <div class="table-operator"> | |
88 | + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
89 | + <a-button type="primary" icon="download" @click="handleExportXls('库存交易记录')">导出</a-button> | |
90 | + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
91 | + <a-button type="primary" icon="import">导入</a-button> | |
92 | + </a-upload> | |
93 | + <!-- 高级查询区域 --> | |
94 | + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
95 | + <a-dropdown v-if="selectedRowKeys.length > 0"> | |
96 | + <a-menu slot="overlay"> | |
97 | + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |
98 | + </a-menu> | |
99 | + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |
100 | + </a-dropdown> | |
101 | + </div> | |
102 | + | |
103 | + <!-- table区域-begin --> | |
104 | + <div> | |
105 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
106 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
107 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
108 | + </div> | |
109 | + | |
110 | + <a-table | |
111 | + ref="table" | |
112 | + size="middle" | |
113 | + :scroll="{x:true}" | |
114 | + bordered | |
115 | + rowKey="id" | |
116 | + :columns="columns" | |
117 | + :dataSource="dataSource" | |
118 | + :pagination="ipagination" | |
119 | + :loading="loading" | |
120 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
121 | + class="j-table-force-nowrap" | |
122 | + @change="handleTableChange"> | |
123 | + | |
124 | + <template slot="htmlSlot" slot-scope="text"> | |
125 | + <div v-html="text"></div> | |
126 | + </template> | |
127 | + <template slot="imgSlot" slot-scope="text"> | |
128 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
129 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
130 | + </template> | |
131 | + <template slot="fileSlot" slot-scope="text"> | |
132 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
133 | + <a-button | |
134 | + v-else | |
135 | + :ghost="true" | |
136 | + type="primary" | |
137 | + icon="download" | |
138 | + size="small" | |
139 | + @click="downloadFile(text)"> | |
140 | + 下载 | |
141 | + </a-button> | |
142 | + </template> | |
143 | + | |
144 | + <span slot="action" slot-scope="text, record"> | |
145 | + <a @click="handleEdit(record)">编辑</a> | |
146 | + | |
147 | + <a-divider type="vertical" /> | |
148 | + <a-dropdown> | |
149 | + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
150 | + <a-menu slot="overlay"> | |
151 | + <a-menu-item> | |
152 | + <a @click="handleDetail(record)">详情</a> | |
153 | + </a-menu-item> | |
154 | + <a-menu-item> | |
155 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
156 | + <a>删除</a> | |
157 | + </a-popconfirm> | |
158 | + </a-menu-item> | |
159 | + </a-menu> | |
160 | + </a-dropdown> | |
161 | + </span> | |
162 | + | |
163 | + </a-table> | |
164 | + </div> | |
165 | + | |
166 | + <inventory-transaction-modal ref="modalForm" @ok="modalFormOk"></inventory-transaction-modal> | |
167 | + </a-card> | |
168 | +</template> | |
169 | + | |
170 | +<script> | |
171 | + | |
172 | + import '@/assets/less/TableExpand.less' | |
173 | + import { mixinDevice } from '@/utils/mixin' | |
174 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
175 | + import InventoryTransactionModal from './modules/InventoryTransactionModal' | |
176 | + import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' | |
177 | + | |
178 | + export default { | |
179 | + name: 'InventoryTransactionList', | |
180 | + mixins:[JeecgListMixin, mixinDevice], | |
181 | + components: { | |
182 | + InventoryTransactionModal | |
183 | + }, | |
184 | + data () { | |
185 | + return { | |
186 | + description: '库存交易记录管理页面', | |
187 | + // 表头 | |
188 | + columns: [ | |
189 | + { | |
190 | + title:'库存交易ID', | |
191 | + align:"center", | |
192 | + dataIndex: 'id' | |
193 | + }, | |
194 | + { | |
195 | + title:'货主', | |
196 | + align:"center", | |
197 | + dataIndex: 'companyCode' | |
198 | + }, | |
199 | + { | |
200 | + title:'容器编码', | |
201 | + align:"center", | |
202 | + dataIndex: 'containerCode' | |
203 | + }, | |
204 | + { | |
205 | + title:'库位编码', | |
206 | + align:"center", | |
207 | + dataIndex: 'locationCode' | |
208 | + }, | |
209 | + { | |
210 | + title:'交易类型', | |
211 | + align:"center", | |
212 | + dataIndex: 'type_dictText' | |
213 | + }, | |
214 | + { | |
215 | + title:'物料编码', | |
216 | + align:"center", | |
217 | + dataIndex: 'materialCode' | |
218 | + }, | |
219 | + { | |
220 | + title:'物料名称', | |
221 | + align:"center", | |
222 | + dataIndex: 'materialName' | |
223 | + }, | |
224 | + { | |
225 | + title:'物料规格', | |
226 | + align:"center", | |
227 | + dataIndex: 'materialSpec' | |
228 | + }, | |
229 | + { | |
230 | + title:'物料单位', | |
231 | + align:"center", | |
232 | + dataIndex: 'materialUnit' | |
233 | + }, | |
234 | + { | |
235 | + title:'库存状态', | |
236 | + align:"center", | |
237 | + dataIndex: 'inventoryStatus' | |
238 | + }, | |
239 | + { | |
240 | + title:'数量', | |
241 | + align:"center", | |
242 | + dataIndex: 'qty' | |
243 | + }, | |
244 | + { | |
245 | + title:'批次', | |
246 | + align:"center", | |
247 | + dataIndex: 'batch' | |
248 | + }, | |
249 | + { | |
250 | + title:'创建人', | |
251 | + align:"center", | |
252 | + dataIndex: 'createBy' | |
253 | + }, | |
254 | + { | |
255 | + title:'创建日期', | |
256 | + align:"center", | |
257 | + dataIndex: 'createTime' | |
258 | + }, | |
259 | + { | |
260 | + title:'更新人', | |
261 | + align:"center", | |
262 | + dataIndex: 'updateBy' | |
263 | + }, | |
264 | + { | |
265 | + title:'更新日期', | |
266 | + align:"center", | |
267 | + dataIndex: 'updateTime' | |
268 | + }, | |
269 | + { | |
270 | + title: '操作', | |
271 | + dataIndex: 'action', | |
272 | + align:"center", | |
273 | + fixed:"right", | |
274 | + width:147, | |
275 | + scopedSlots: { customRender: 'action' } | |
276 | + } | |
277 | + ], | |
278 | + url: { | |
279 | + list: "/inventory/inventoryTransaction/list", | |
280 | + delete: "/inventory/inventoryTransaction/delete", | |
281 | + deleteBatch: "/inventory/inventoryTransaction/deleteBatch", | |
282 | + exportXlsUrl: "/inventory/inventoryTransaction/exportXls", | |
283 | + importExcelUrl: "inventory/inventoryTransaction/importExcel", | |
284 | + | |
285 | + }, | |
286 | + dictOptions:{}, | |
287 | + superFieldList:[], | |
288 | + } | |
289 | + }, | |
290 | + created() { | |
291 | + this.getSuperFieldList(); | |
292 | + }, | |
293 | + computed: { | |
294 | + importExcelUrl: function(){ | |
295 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
296 | + }, | |
297 | + }, | |
298 | + methods: { | |
299 | + initDictConfig(){ | |
300 | + }, | |
301 | + getSuperFieldList(){ | |
302 | + let fieldList=[]; | |
303 | + fieldList.push({type:'string',value:'companyCode',text:'货主',dictCode:''}) | |
304 | + fieldList.push({type:'string',value:'containerCode',text:'容器编码',dictCode:''}) | |
305 | + fieldList.push({type:'string',value:'locationCode',text:'库位编码',dictCode:''}) | |
306 | + fieldList.push({type:'int',value:'type',text:'交易类型',dictCode:'inventory_transaction_type'}) | |
307 | + fieldList.push({type:'string',value:'materialCode',text:'物料编码',dictCode:''}) | |
308 | + fieldList.push({type:'string',value:'materialName',text:'物料名称',dictCode:''}) | |
309 | + fieldList.push({type:'string',value:'materialSpec',text:'物料规格',dictCode:''}) | |
310 | + fieldList.push({type:'string',value:'materialUnit',text:'物料单位',dictCode:''}) | |
311 | + fieldList.push({type:'string',value:'inventoryStatus',text:'库存状态',dictCode:''}) | |
312 | + fieldList.push({type:'BigDecimal',value:'qty',text:'数量',dictCode:''}) | |
313 | + fieldList.push({type:'string',value:'batch',text:'批次',dictCode:''}) | |
314 | + fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''}) | |
315 | + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) | |
316 | + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) | |
317 | + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) | |
318 | + this.superFieldList = fieldList | |
319 | + } | |
320 | + } | |
321 | + } | |
322 | +</script> | |
323 | +<style scoped> | |
324 | + @import '~@assets/less/common.less'; | |
325 | +</style> | |
0 | 326 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryDetailModal.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-input v-model="model.companyCode"placeholder="请输入货主" ></a-input> | |
17 | + </a-form-model-item> | |
18 | + </a-col> | |
19 | + <a-col :span="24"> | |
20 | + <a-form-model-item label="库区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode"> | |
21 | + <a-input v-model="model.zoneCode"placeholder="请输入库区" ></a-input> | |
22 | + </a-form-model-item> | |
23 | + </a-col> | |
24 | + <a-col :span="24"> | |
25 | + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> | |
26 | + <a-input v-model="model.containerCode"placeholder="请输入容器编码" ></a-input> | |
27 | + </a-form-model-item> | |
28 | + </a-col> | |
29 | + <a-col :span="24"> | |
30 | + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> | |
31 | + <a-input v-model="model.locationCode"placeholder="请输入库位编码" ></a-input> | |
32 | + </a-form-model-item> | |
33 | + </a-col> | |
34 | + <a-col :span="24"> | |
35 | + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> | |
36 | + <a-input v-model="model.materialCode"placeholder="请输入物料编码" ></a-input> | |
37 | + </a-form-model-item> | |
38 | + </a-col> | |
39 | + <a-col :span="24"> | |
40 | + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> | |
41 | + <a-input v-model="model.materialName"placeholder="请输入物料名称" ></a-input> | |
42 | + </a-form-model-item> | |
43 | + </a-col> | |
44 | + <a-col :span="24"> | |
45 | + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec"> | |
46 | + <a-input v-model="model.materialSpec"placeholder="请输入物料规格" ></a-input> | |
47 | + </a-form-model-item> | |
48 | + </a-col> | |
49 | + <a-col :span="24"> | |
50 | + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> | |
51 | + <a-input v-model="model.materialUnit"placeholder="请输入物料单位" ></a-input> | |
52 | + </a-form-model-item> | |
53 | + </a-col> | |
54 | + <a-col :span="24"> | |
55 | + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty"> | |
56 | + <a-input-number v-model="model.qty"placeholder="请输入数量" style="width: 100%" /> | |
57 | + </a-form-model-item> | |
58 | + </a-col> | |
59 | + <a-col :span="24"> | |
60 | + <a-form-model-item label="任务锁定数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskQty"> | |
61 | + <a-input-number v-model="model.taskQty"placeholder="请输入任务锁定数量" style="width: 100%" /> | |
62 | + </a-form-model-item> | |
63 | + </a-col> | |
64 | + <a-col :span="24"> | |
65 | + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus"> | |
66 | + <j-dict-select-tag type="list" v-model="model.inventoryStatus" dictCode="inventory_status" placeholder="请选择库存状态" /> | |
67 | + </a-form-model-item> | |
68 | + </a-col> | |
69 | + <a-col :span="24"> | |
70 | + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch"> | |
71 | + <a-input v-model="model.batch"placeholder="请输入批次" ></a-input> | |
72 | + </a-form-model-item> | |
73 | + </a-col> | |
74 | + </a-row> | |
75 | + </a-form-model> | |
76 | + </a-spin> | |
77 | + </j-modal> | |
78 | +</template> | |
79 | + | |
80 | +<script> | |
81 | + | |
82 | + import { httpAction } from '@/api/manage' | |
83 | + import { validateDuplicateValue } from '@/utils/util' | |
84 | + | |
85 | + export default { | |
86 | + name: "InventoryDetailModal", | |
87 | + components: { | |
88 | + }, | |
89 | + props:{ | |
90 | + mainId:{ | |
91 | + type:String, | |
92 | + required:false, | |
93 | + default:'' | |
94 | + } | |
95 | + }, | |
96 | + data () { | |
97 | + return { | |
98 | + title:"操作", | |
99 | + width:800, | |
100 | + visible: false, | |
101 | + model:{ | |
102 | + }, | |
103 | + labelCol: { | |
104 | + xs: { span: 24 }, | |
105 | + sm: { span: 5 }, | |
106 | + }, | |
107 | + wrapperCol: { | |
108 | + xs: { span: 24 }, | |
109 | + sm: { span: 16 }, | |
110 | + }, | |
111 | + | |
112 | + confirmLoading: false, | |
113 | + validatorRules: { | |
114 | + containerCode: [ | |
115 | + { required: true, message: '请输入容器编码!'}, | |
116 | + ], | |
117 | + materialCode: [ | |
118 | + { required: true, message: '请输入物料编码!'}, | |
119 | + ], | |
120 | + }, | |
121 | + url: { | |
122 | + add: "/inventory/inventoryHeader/addInventoryDetail", | |
123 | + edit: "/inventory/inventoryHeader/editInventoryDetail", | |
124 | + } | |
125 | + | |
126 | + } | |
127 | + }, | |
128 | + created () { | |
129 | + //备份model原始值 | |
130 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
131 | + }, | |
132 | + methods: { | |
133 | + add () { | |
134 | + this.edit(this.modelDefault); | |
135 | + }, | |
136 | + edit (record) { | |
137 | + this.model = Object.assign({}, record); | |
138 | + this.visible = true; | |
139 | + }, | |
140 | + close () { | |
141 | + this.$emit('close'); | |
142 | + this.visible = false; | |
143 | + this.$refs.form.clearValidate(); | |
144 | + }, | |
145 | + handleOk () { | |
146 | + const that = this; | |
147 | + // 触发表单验证 | |
148 | + this.$refs.form.validate(valid => { | |
149 | + if (valid) { | |
150 | + that.confirmLoading = true; | |
151 | + let httpurl = ''; | |
152 | + let method = ''; | |
153 | + if(!this.model.id){ | |
154 | + httpurl+=this.url.add; | |
155 | + method = 'post'; | |
156 | + }else{ | |
157 | + httpurl+=this.url.edit; | |
158 | + method = 'put'; | |
159 | + } | |
160 | + this.model['inventoryHeaderId'] = this.mainId | |
161 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
162 | + if(res.success){ | |
163 | + that.$message.success(res.message); | |
164 | + that.$emit('ok'); | |
165 | + }else{ | |
166 | + that.$message.warning(res.message); | |
167 | + } | |
168 | + }).finally(() => { | |
169 | + that.confirmLoading = false; | |
170 | + that.close(); | |
171 | + }) | |
172 | + }else{ | |
173 | + return false | |
174 | + } | |
175 | + }) | |
176 | + }, | |
177 | + handleCancel () { | |
178 | + this.close() | |
179 | + }, | |
180 | + | |
181 | + | |
182 | + } | |
183 | + } | |
184 | +</script> | |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryHeaderModal.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-input v-model="model.companyCode" placeholder="请输入货主" ></a-input> | |
17 | + </a-form-model-item> | |
18 | + </a-col> | |
19 | + <a-col :span="24"> | |
20 | + <a-form-model-item label="库区" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zoneCode"> | |
21 | + <a-input v-model="model.zoneCode" placeholder="请输入库区" ></a-input> | |
22 | + </a-form-model-item> | |
23 | + </a-col> | |
24 | + <a-col :span="24"> | |
25 | + <a-form-model-item label="容器号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> | |
26 | + <a-input v-model="model.containerCode" placeholder="请输入容器号" ></a-input> | |
27 | + </a-form-model-item> | |
28 | + </a-col> | |
29 | + <a-col :span="24"> | |
30 | + <a-form-model-item label="容器状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerStatus"> | |
31 | + <j-dict-select-tag type="list" v-model="model.containerStatus" dictCode="container_status" 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="locationCode"> | |
36 | + <a-input v-model="model.locationCode" placeholder="请输入库位号" ></a-input> | |
37 | + </a-form-model-item> | |
38 | + </a-col> | |
39 | + <a-col :span="24"> | |
40 | + <a-form-model-item label="总数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalQty"> | |
41 | + <a-input-number v-model="model.totalQty" placeholder="请输入总数量" style="width: 100%" /> | |
42 | + </a-form-model-item> | |
43 | + </a-col> | |
44 | + <a-col :span="24"> | |
45 | + <a-form-model-item label="总行量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalLines"> | |
46 | + <a-input-number v-model="model.totalLines" placeholder="请输入总行量" style="width: 100%" /> | |
47 | + </a-form-model-item> | |
48 | + </a-col> | |
49 | + </a-row> | |
50 | + </a-form-model> | |
51 | + </a-spin> | |
52 | + </j-modal> | |
53 | +</template> | |
54 | + | |
55 | +<script> | |
56 | + | |
57 | + import { httpAction } from '@/api/manage' | |
58 | + import { validateDuplicateValue } from '@/utils/util' | |
59 | + | |
60 | + export default { | |
61 | + name: "InventoryHeaderModal", | |
62 | + components: { | |
63 | + }, | |
64 | + data () { | |
65 | + return { | |
66 | + title:"操作", | |
67 | + width:800, | |
68 | + visible: false, | |
69 | + model:{ | |
70 | + }, | |
71 | + labelCol: { | |
72 | + xs: { span: 24 }, | |
73 | + sm: { span: 5 }, | |
74 | + }, | |
75 | + wrapperCol: { | |
76 | + xs: { span: 24 }, | |
77 | + sm: { span: 16 }, | |
78 | + }, | |
79 | + | |
80 | + confirmLoading: false, | |
81 | + validatorRules: { | |
82 | + }, | |
83 | + url: { | |
84 | + add: "/inventory/inventoryHeader/add", | |
85 | + edit: "/inventory/inventoryHeader/edit", | |
86 | + } | |
87 | + | |
88 | + } | |
89 | + }, | |
90 | + created () { | |
91 | + //备份model原始值 | |
92 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
93 | + }, | |
94 | + methods: { | |
95 | + add () { | |
96 | + this.edit(this.modelDefault); | |
97 | + }, | |
98 | + edit (record) { | |
99 | + this.model = Object.assign({}, record); | |
100 | + this.visible = true; | |
101 | + }, | |
102 | + close () { | |
103 | + this.$emit('close'); | |
104 | + this.visible = false; | |
105 | + this.$refs.form.clearValidate(); | |
106 | + }, | |
107 | + handleOk () { | |
108 | + const that = this; | |
109 | + // 触发表单验证 | |
110 | + this.$refs.form.validate(valid => { | |
111 | + if (valid) { | |
112 | + that.confirmLoading = true; | |
113 | + let httpurl = ''; | |
114 | + let method = ''; | |
115 | + if(!this.model.id){ | |
116 | + httpurl+=this.url.add; | |
117 | + method = 'post'; | |
118 | + }else{ | |
119 | + httpurl+=this.url.edit; | |
120 | + method = 'put'; | |
121 | + } | |
122 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
123 | + if(res.success){ | |
124 | + that.$message.success(res.message); | |
125 | + that.$emit('ok'); | |
126 | + }else{ | |
127 | + that.$message.warning(res.message); | |
128 | + } | |
129 | + }).finally(() => { | |
130 | + that.confirmLoading = false; | |
131 | + that.close(); | |
132 | + }) | |
133 | + }else{ | |
134 | + return false | |
135 | + } | |
136 | + }) | |
137 | + }, | |
138 | + handleCancel () { | |
139 | + this.close() | |
140 | + }, | |
141 | + | |
142 | + | |
143 | + } | |
144 | + } | |
145 | +</script> | |
0 | 146 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionForm.vue
0 → 100644
1 | +<template> | |
2 | + <a-spin :spinning="confirmLoading"> | |
3 | + <j-form-container :disabled="formDisabled"> | |
4 | + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |
5 | + <a-row> | |
6 | + <a-col :span="24"> | |
7 | + <a-form-model-item label="货主" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="companyCode"> | |
8 | + <a-input v-model="model.companyCode" placeholder="请输入货主" ></a-input> | |
9 | + </a-form-model-item> | |
10 | + </a-col> | |
11 | + <a-col :span="24"> | |
12 | + <a-form-model-item label="容器编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="containerCode"> | |
13 | + <a-input v-model="model.containerCode" placeholder="请输入容器编码" ></a-input> | |
14 | + </a-form-model-item> | |
15 | + </a-col> | |
16 | + <a-col :span="24"> | |
17 | + <a-form-model-item label="库位编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="locationCode"> | |
18 | + <a-input v-model="model.locationCode" placeholder="请输入库位编码" ></a-input> | |
19 | + </a-form-model-item> | |
20 | + </a-col> | |
21 | + <a-col :span="24"> | |
22 | + <a-form-model-item label="交易类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> | |
23 | + <j-dict-select-tag type="list" v-model="model.type" dictCode="inventory_transaction_type" placeholder="请选择交易类型" /> | |
24 | + </a-form-model-item> | |
25 | + </a-col> | |
26 | + <a-col :span="24"> | |
27 | + <a-form-model-item label="物料编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCode"> | |
28 | + <a-input v-model="model.materialCode" placeholder="请输入物料编码" ></a-input> | |
29 | + </a-form-model-item> | |
30 | + </a-col> | |
31 | + <a-col :span="24"> | |
32 | + <a-form-model-item label="物料名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> | |
33 | + <a-input v-model="model.materialName" placeholder="请输入物料名称" ></a-input> | |
34 | + </a-form-model-item> | |
35 | + </a-col> | |
36 | + <a-col :span="24"> | |
37 | + <a-form-model-item label="物料规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialSpec"> | |
38 | + <a-input v-model="model.materialSpec" placeholder="请输入物料规格" ></a-input> | |
39 | + </a-form-model-item> | |
40 | + </a-col> | |
41 | + <a-col :span="24"> | |
42 | + <a-form-model-item label="物料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> | |
43 | + <a-input v-model="model.materialUnit" placeholder="请输入物料单位" ></a-input> | |
44 | + </a-form-model-item> | |
45 | + </a-col> | |
46 | + <a-col :span="24"> | |
47 | + <a-form-model-item label="库存状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus"> | |
48 | + <a-input v-model="model.inventoryStatus" placeholder="请输入库存状态" ></a-input> | |
49 | + </a-form-model-item> | |
50 | + </a-col> | |
51 | + <a-col :span="24"> | |
52 | + <a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qty"> | |
53 | + <a-input-number v-model="model.qty" placeholder="请输入数量" style="width: 100%" /> | |
54 | + </a-form-model-item> | |
55 | + </a-col> | |
56 | + <a-col :span="24"> | |
57 | + <a-form-model-item label="批次" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batch"> | |
58 | + <a-input v-model="model.batch" placeholder="请输入批次" ></a-input> | |
59 | + </a-form-model-item> | |
60 | + </a-col> | |
61 | + </a-row> | |
62 | + </a-form-model> | |
63 | + </j-form-container> | |
64 | + </a-spin> | |
65 | +</template> | |
66 | + | |
67 | +<script> | |
68 | + | |
69 | + import { httpAction, getAction } from '@/api/manage' | |
70 | + import { validateDuplicateValue } from '@/utils/util' | |
71 | + | |
72 | + export default { | |
73 | + name: 'InventoryTransactionForm', | |
74 | + components: { | |
75 | + }, | |
76 | + props: { | |
77 | + //表单禁用 | |
78 | + disabled: { | |
79 | + type: Boolean, | |
80 | + default: false, | |
81 | + required: false | |
82 | + } | |
83 | + }, | |
84 | + data () { | |
85 | + return { | |
86 | + model:{ | |
87 | + }, | |
88 | + labelCol: { | |
89 | + xs: { span: 24 }, | |
90 | + sm: { span: 5 }, | |
91 | + }, | |
92 | + wrapperCol: { | |
93 | + xs: { span: 24 }, | |
94 | + sm: { span: 16 }, | |
95 | + }, | |
96 | + confirmLoading: false, | |
97 | + validatorRules: { | |
98 | + }, | |
99 | + url: { | |
100 | + add: "/inventory/inventoryTransaction/add", | |
101 | + edit: "/inventory/inventoryTransaction/edit", | |
102 | + queryById: "/inventory/inventoryTransaction/queryById" | |
103 | + } | |
104 | + } | |
105 | + }, | |
106 | + computed: { | |
107 | + formDisabled(){ | |
108 | + return this.disabled | |
109 | + }, | |
110 | + }, | |
111 | + created () { | |
112 | + //备份model原始值 | |
113 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
114 | + }, | |
115 | + methods: { | |
116 | + add () { | |
117 | + this.edit(this.modelDefault); | |
118 | + }, | |
119 | + edit (record) { | |
120 | + this.model = Object.assign({}, record); | |
121 | + this.visible = true; | |
122 | + }, | |
123 | + submitForm () { | |
124 | + const that = this; | |
125 | + // 触发表单验证 | |
126 | + this.$refs.form.validate(valid => { | |
127 | + if (valid) { | |
128 | + that.confirmLoading = true; | |
129 | + let httpurl = ''; | |
130 | + let method = ''; | |
131 | + if(!this.model.id){ | |
132 | + httpurl+=this.url.add; | |
133 | + method = 'post'; | |
134 | + }else{ | |
135 | + httpurl+=this.url.edit; | |
136 | + method = 'put'; | |
137 | + } | |
138 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
139 | + if(res.success){ | |
140 | + that.$message.success(res.message); | |
141 | + that.$emit('ok'); | |
142 | + }else{ | |
143 | + that.$message.warning(res.message); | |
144 | + } | |
145 | + }).finally(() => { | |
146 | + that.confirmLoading = false; | |
147 | + }) | |
148 | + } | |
149 | + | |
150 | + }) | |
151 | + }, | |
152 | + } | |
153 | + } | |
154 | +</script> | |
0 | 155 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.Style#Drawer.vue
0 → 100644
1 | +<template> | |
2 | + <a-drawer | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + placement="right" | |
6 | + :closable="false" | |
7 | + @close="close" | |
8 | + destroyOnClose | |
9 | + :visible="visible"> | |
10 | + <inventory-transaction-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></inventory-transaction-form> | |
11 | + <div class="drawer-footer"> | |
12 | + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |
13 | + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |
14 | + </div> | |
15 | + </a-drawer> | |
16 | +</template> | |
17 | + | |
18 | +<script> | |
19 | + | |
20 | + import InventoryTransactionForm from './InventoryTransactionForm' | |
21 | + | |
22 | + export default { | |
23 | + name: 'InventoryTransactionModal', | |
24 | + components: { | |
25 | + InventoryTransactionForm | |
26 | + }, | |
27 | + data () { | |
28 | + return { | |
29 | + title:"操作", | |
30 | + width:800, | |
31 | + visible: false, | |
32 | + disableSubmit: false | |
33 | + } | |
34 | + }, | |
35 | + methods: { | |
36 | + add () { | |
37 | + this.visible=true | |
38 | + this.$nextTick(()=>{ | |
39 | + this.$refs.realForm.add(); | |
40 | + }) | |
41 | + }, | |
42 | + edit (record) { | |
43 | + this.visible=true | |
44 | + this.$nextTick(()=>{ | |
45 | + this.$refs.realForm.edit(record); | |
46 | + }); | |
47 | + }, | |
48 | + close () { | |
49 | + this.$emit('close'); | |
50 | + this.visible = false; | |
51 | + }, | |
52 | + submitCallback(){ | |
53 | + this.$emit('ok'); | |
54 | + this.visible = false; | |
55 | + }, | |
56 | + handleOk () { | |
57 | + this.$refs.realForm.submitForm(); | |
58 | + }, | |
59 | + handleCancel () { | |
60 | + this.close() | |
61 | + } | |
62 | + } | |
63 | + } | |
64 | +</script> | |
65 | + | |
66 | +<style lang="less" scoped> | |
67 | +/** Button按钮间距 */ | |
68 | + .ant-btn { | |
69 | + margin-left: 30px; | |
70 | + margin-bottom: 30px; | |
71 | + float: right; | |
72 | + } | |
73 | + .drawer-footer{ | |
74 | + position: absolute; | |
75 | + bottom: -8px; | |
76 | + width: 100%; | |
77 | + border-top: 1px solid #e8e8e8; | |
78 | + padding: 10px 16px; | |
79 | + text-align: right; | |
80 | + left: 0; | |
81 | + background: #fff; | |
82 | + border-radius: 0 0 2px 2px; | |
83 | + } | |
84 | +</style> | |
0 | 85 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/inventory/modules/InventoryTransactionModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + switchFullscreen | |
7 | + @ok="handleOk" | |
8 | + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |
9 | + @cancel="handleCancel" | |
10 | + cancelText="关闭"> | |
11 | + <inventory-transaction-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></inventory-transaction-form> | |
12 | + </j-modal> | |
13 | +</template> | |
14 | + | |
15 | +<script> | |
16 | + | |
17 | + import InventoryTransactionForm from './InventoryTransactionForm' | |
18 | + export default { | |
19 | + name: 'InventoryTransactionModal', | |
20 | + components: { | |
21 | + InventoryTransactionForm | |
22 | + }, | |
23 | + data () { | |
24 | + return { | |
25 | + title:'', | |
26 | + width:800, | |
27 | + visible: false, | |
28 | + disableSubmit: false | |
29 | + } | |
30 | + }, | |
31 | + methods: { | |
32 | + add () { | |
33 | + this.visible=true | |
34 | + this.$nextTick(()=>{ | |
35 | + this.$refs.realForm.add(); | |
36 | + }) | |
37 | + }, | |
38 | + edit (record) { | |
39 | + this.visible=true | |
40 | + this.$nextTick(()=>{ | |
41 | + this.$refs.realForm.edit(record); | |
42 | + }) | |
43 | + }, | |
44 | + close () { | |
45 | + this.$emit('close'); | |
46 | + this.visible = false; | |
47 | + }, | |
48 | + handleOk () { | |
49 | + this.$refs.realForm.submitForm(); | |
50 | + }, | |
51 | + submitCallback(){ | |
52 | + this.$emit('ok'); | |
53 | + this.visible = false; | |
54 | + }, | |
55 | + handleCancel () { | |
56 | + this.close() | |
57 | + } | |
58 | + } | |
59 | + } | |
60 | +</script> | |
0 | 61 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/ApiLogList.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.apiName"></a-input> | |
10 | + </a-form-item> | |
11 | + </a-col> | |
12 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
13 | + <a-form-item label="请求类型"> | |
14 | + <a-input placeholder="请输入请求类型" v-model="queryParam.apiMethod"></a-input> | |
15 | + </a-form-item> | |
16 | + </a-col> | |
17 | + <template v-if="toggleSearchStatus"> | |
18 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
19 | + <a-form-item label="请求方地址"> | |
20 | + <a-input placeholder="请输入请求方地址" v-model="queryParam.ip"></a-input> | |
21 | + </a-form-item> | |
22 | + </a-col> | |
23 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
24 | + <a-form-item label="请求方名称"> | |
25 | + <a-input placeholder="请输入请求方名称" v-model="queryParam.responseFrom"></a-input> | |
26 | + </a-form-item> | |
27 | + </a-col> | |
28 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
29 | + <a-form-item label="响应方名称"> | |
30 | + <a-input placeholder="请输入响应方名称" v-model="queryParam.responseBy"></a-input> | |
31 | + </a-form-item> | |
32 | + </a-col> | |
33 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
34 | + <a-form-item label="请求地址"> | |
35 | + <a-input placeholder="请输入请求地址" v-model="queryParam.url"></a-input> | |
36 | + </a-form-item> | |
37 | + </a-col> | |
38 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
39 | + <a-form-item label="响应耗时(毫秒)"> | |
40 | + <a-input placeholder="请输入响应耗时(毫秒)" v-model="queryParam.duration"></a-input> | |
41 | + </a-form-item> | |
42 | + </a-col> | |
43 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
44 | + <a-form-item label="业务响应码"> | |
45 | + <a-input placeholder="请输入业务响应码" v-model="queryParam.retCode"></a-input> | |
46 | + </a-form-item> | |
47 | + </a-col> | |
48 | + <a-col :xl="10" :lg="11" :md="12" :sm="24"> | |
49 | + <a-form-item label="创建日期"> | |
50 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择开始时间" class="query-group-cust" v-model="queryParam.createTime_begin"></j-date> | |
51 | + <span class="query-group-split-cust"></span> | |
52 | + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="请选择结束时间" class="query-group-cust" v-model="queryParam.createTime_end"></j-date> | |
53 | + </a-form-item> | |
54 | + </a-col> | |
55 | + </template> | |
56 | + <a-col :xl="6" :lg="7" :md="8" :sm="24"> | |
57 | + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> | |
58 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
59 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
60 | + <a @click="handleToggleSearch" style="margin-left: 8px"> | |
61 | + {{ toggleSearchStatus ? '收起' : '展开' }} | |
62 | + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> | |
63 | + </a> | |
64 | + </span> | |
65 | + </a-col> | |
66 | + </a-row> | |
67 | + </a-form> | |
68 | + </div> | |
69 | + <!-- 查询区域-END --> | |
70 | + | |
71 | + <!-- 操作按钮区域 --> | |
72 | + <div class="table-operator"> | |
73 | + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
74 | + <a-button type="primary" icon="download" @click="handleExportXls('接口日志')">导出</a-button> | |
75 | + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
76 | + <a-button type="primary" icon="import">导入</a-button> | |
77 | + </a-upload> | |
78 | + <!-- 高级查询区域 --> | |
79 | + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
80 | + <a-dropdown v-if="selectedRowKeys.length > 0"> | |
81 | + <a-menu slot="overlay"> | |
82 | + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |
83 | + </a-menu> | |
84 | + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |
85 | + </a-dropdown> | |
86 | + </div> | |
87 | + | |
88 | + <!-- table区域-begin --> | |
89 | + <div> | |
90 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
91 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
92 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
93 | + </div> | |
94 | + | |
95 | + <a-table | |
96 | + ref="table" | |
97 | + size="middle" | |
98 | + :scroll="{x:true}" | |
99 | + bordered | |
100 | + rowKey="id" | |
101 | + :columns="columns" | |
102 | + :dataSource="dataSource" | |
103 | + :pagination="ipagination" | |
104 | + :loading="loading" | |
105 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
106 | + class="j-table-force-nowrap" | |
107 | + @change="handleTableChange"> | |
108 | + | |
109 | + <template slot="htmlSlot" slot-scope="text"> | |
110 | + <div v-html="text"></div> | |
111 | + </template> | |
112 | + <template slot="imgSlot" slot-scope="text"> | |
113 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
114 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
115 | + </template> | |
116 | + <template slot="fileSlot" slot-scope="text"> | |
117 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
118 | + <a-button | |
119 | + v-else | |
120 | + :ghost="true" | |
121 | + type="primary" | |
122 | + icon="download" | |
123 | + size="small" | |
124 | + @click="downloadFile(text)"> | |
125 | + 下载 | |
126 | + </a-button> | |
127 | + </template> | |
128 | + | |
129 | + <span slot="action" slot-scope="text, record"> | |
130 | + <a @click="handleEdit(record)">编辑</a> | |
131 | + | |
132 | + <a-divider type="vertical" /> | |
133 | + <a-dropdown> | |
134 | + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
135 | + <a-menu slot="overlay"> | |
136 | + <a-menu-item> | |
137 | + <a @click="handleDetail(record)">详情</a> | |
138 | + </a-menu-item> | |
139 | + <a-menu-item> | |
140 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
141 | + <a>删除</a> | |
142 | + </a-popconfirm> | |
143 | + </a-menu-item> | |
144 | + </a-menu> | |
145 | + </a-dropdown> | |
146 | + </span> | |
147 | + | |
148 | + </a-table> | |
149 | + </div> | |
150 | + | |
151 | + <api-log-modal ref="modalForm" @ok="modalFormOk"></api-log-modal> | |
152 | + </a-card> | |
153 | +</template> | |
154 | + | |
155 | +<script> | |
156 | + | |
157 | + import '@/assets/less/TableExpand.less' | |
158 | + import { mixinDevice } from '@/utils/mixin' | |
159 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
160 | + import ApiLogModal from './modules/ApiLogModal' | |
161 | + | |
162 | + export default { | |
163 | + name: 'ApiLogList', | |
164 | + mixins:[JeecgListMixin, mixinDevice], | |
165 | + components: { | |
166 | + ApiLogModal | |
167 | + }, | |
168 | + data () { | |
169 | + return { | |
170 | + description: '接口日志管理页面', | |
171 | + // 表头 | |
172 | + columns: [ | |
173 | + { | |
174 | + title:'接口ID', | |
175 | + align:"center", | |
176 | + dataIndex: 'id' | |
177 | + }, | |
178 | + { | |
179 | + title:'接口名称', | |
180 | + align:"center", | |
181 | + dataIndex: 'apiName' | |
182 | + }, | |
183 | + { | |
184 | + title:'请求类型', | |
185 | + align:"center", | |
186 | + dataIndex: 'apiMethod' | |
187 | + }, | |
188 | + { | |
189 | + title:'请求方地址', | |
190 | + align:"center", | |
191 | + dataIndex: 'ip' | |
192 | + }, | |
193 | + { | |
194 | + title:'响应耗时(毫秒)', | |
195 | + align:"center", | |
196 | + dataIndex: 'duration' | |
197 | + }, | |
198 | + { | |
199 | + title:'请求方名称', | |
200 | + align:"center", | |
201 | + dataIndex: 'responseFrom' | |
202 | + }, | |
203 | + { | |
204 | + title:'响应方名称', | |
205 | + align:"center", | |
206 | + dataIndex: 'responseBy' | |
207 | + }, | |
208 | + { | |
209 | + title:'请求地址', | |
210 | + align:"center", | |
211 | + dataIndex: 'url' | |
212 | + }, | |
213 | + { | |
214 | + title:'请求时间', | |
215 | + align:"center", | |
216 | + dataIndex: 'requestTime' | |
217 | + }, | |
218 | + { | |
219 | + title:'响应时间', | |
220 | + align:"center", | |
221 | + dataIndex: 'responseTime' | |
222 | + }, | |
223 | + { | |
224 | + title:'请求头', | |
225 | + align:"center", | |
226 | + dataIndex: 'requestHeader' | |
227 | + }, | |
228 | + { | |
229 | + title:'请求内容', | |
230 | + align:"center", | |
231 | + dataIndex: 'requestBody' | |
232 | + }, | |
233 | + { | |
234 | + title:'响应头', | |
235 | + align:"center", | |
236 | + dataIndex: 'responseHeader' | |
237 | + }, | |
238 | + { | |
239 | + title:'响应内容', | |
240 | + align:"center", | |
241 | + dataIndex: 'responseBody' | |
242 | + }, | |
243 | + { | |
244 | + title:'httpCode', | |
245 | + align:"center", | |
246 | + dataIndex: 'httpCode' | |
247 | + }, | |
248 | + { | |
249 | + title:'业务响应码', | |
250 | + align:"center", | |
251 | + dataIndex: 'retCode' | |
252 | + }, | |
253 | + { | |
254 | + title:'异常堆栈信息', | |
255 | + align:"center", | |
256 | + dataIndex: 'exception' | |
257 | + }, | |
258 | + { | |
259 | + title: '操作', | |
260 | + dataIndex: 'action', | |
261 | + align:"center", | |
262 | + fixed:"right", | |
263 | + width:147, | |
264 | + scopedSlots: { customRender: 'action' } | |
265 | + } | |
266 | + ], | |
267 | + url: { | |
268 | + list: "/monitor/apiLog/list", | |
269 | + delete: "/monitor/apiLog/delete", | |
270 | + deleteBatch: "/monitor/apiLog/deleteBatch", | |
271 | + exportXlsUrl: "/monitor/apiLog/exportXls", | |
272 | + importExcelUrl: "monitor/apiLog/importExcel", | |
273 | + | |
274 | + }, | |
275 | + dictOptions:{}, | |
276 | + superFieldList:[], | |
277 | + } | |
278 | + }, | |
279 | + created() { | |
280 | + this.getSuperFieldList(); | |
281 | + }, | |
282 | + computed: { | |
283 | + importExcelUrl: function(){ | |
284 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
285 | + }, | |
286 | + }, | |
287 | + methods: { | |
288 | + initDictConfig(){ | |
289 | + }, | |
290 | + getSuperFieldList(){ | |
291 | + let fieldList=[]; | |
292 | + fieldList.push({type:'string',value:'apiName',text:'接口名称',dictCode:''}) | |
293 | + fieldList.push({type:'string',value:'apiMethod',text:'请求类型',dictCode:''}) | |
294 | + fieldList.push({type:'string',value:'ip',text:'请求方地址',dictCode:''}) | |
295 | + fieldList.push({type:'string',value:'responseFrom',text:'请求方名称',dictCode:''}) | |
296 | + fieldList.push({type:'string',value:'responseBy',text:'响应方名称',dictCode:''}) | |
297 | + fieldList.push({type:'string',value:'url',text:'请求地址',dictCode:''}) | |
298 | + fieldList.push({type:'datetime',value:'requestTime',text:'请求时间'}) | |
299 | + fieldList.push({type:'datetime',value:'responseTime',text:'响应时间'}) | |
300 | + fieldList.push({type:'Text',value:'requestHeader',text:'请求头',dictCode:''}) | |
301 | + fieldList.push({type:'Text',value:'requestBody',text:'请求内容',dictCode:''}) | |
302 | + fieldList.push({type:'Text',value:'responseHeader',text:'响应头',dictCode:''}) | |
303 | + fieldList.push({type:'Text',value:'responseBody',text:'响应内容',dictCode:''}) | |
304 | + fieldList.push({type:'string',value:'duration',text:'响应耗时(毫秒)',dictCode:''}) | |
305 | + fieldList.push({type:'int',value:'httpCode',text:'httpCode',dictCode:''}) | |
306 | + fieldList.push({type:'int',value:'retCode',text:'业务响应码',dictCode:''}) | |
307 | + fieldList.push({type:'Text',value:'exception',text:'异常堆栈信息',dictCode:''}) | |
308 | + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) | |
309 | + this.superFieldList = fieldList | |
310 | + } | |
311 | + } | |
312 | + } | |
313 | +</script> | |
314 | +<style scoped> | |
315 | + @import '~@assets/less/common.less'; | |
316 | +</style> | |
0 | 317 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogForm.vue
0 → 100644
1 | +<template> | |
2 | + <a-spin :spinning="confirmLoading"> | |
3 | + <j-form-container :disabled="formDisabled"> | |
4 | + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |
5 | + <a-row> | |
6 | + <a-col :span="24"> | |
7 | + <a-form-model-item label="接口名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="apiName"> | |
8 | + <a-input v-model="model.apiName" placeholder="请输入接口名称" ></a-input> | |
9 | + </a-form-model-item> | |
10 | + </a-col> | |
11 | + <a-col :span="24"> | |
12 | + <a-form-model-item label="请求类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="apiMethod"> | |
13 | + <a-input v-model="model.apiMethod" placeholder="请输入请求类型" ></a-input> | |
14 | + </a-form-model-item> | |
15 | + </a-col> | |
16 | + <a-col :span="24"> | |
17 | + <a-form-model-item label="请求方地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ip"> | |
18 | + <a-input v-model="model.ip" placeholder="请输入请求方地址" ></a-input> | |
19 | + </a-form-model-item> | |
20 | + </a-col> | |
21 | + <a-col :span="24"> | |
22 | + <a-form-model-item label="请求方名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseFrom"> | |
23 | + <a-input v-model="model.responseFrom" placeholder="请输入请求方名称" ></a-input> | |
24 | + </a-form-model-item> | |
25 | + </a-col> | |
26 | + <a-col :span="24"> | |
27 | + <a-form-model-item label="响应方名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseBy"> | |
28 | + <a-input v-model="model.responseBy" placeholder="请输入响应方名称" ></a-input> | |
29 | + </a-form-model-item> | |
30 | + </a-col> | |
31 | + <a-col :span="24"> | |
32 | + <a-form-model-item label="请求地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url"> | |
33 | + <a-input v-model="model.url" placeholder="请输入请求地址" ></a-input> | |
34 | + </a-form-model-item> | |
35 | + </a-col> | |
36 | + <a-col :span="24"> | |
37 | + <a-form-model-item label="请求时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestTime"> | |
38 | + <j-date placeholder="请选择请求时间" v-model="model.requestTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> | |
39 | + </a-form-model-item> | |
40 | + </a-col> | |
41 | + <a-col :span="24"> | |
42 | + <a-form-model-item label="响应时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseTime"> | |
43 | + <j-date placeholder="请选择响应时间" v-model="model.responseTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> | |
44 | + </a-form-model-item> | |
45 | + </a-col> | |
46 | + <a-col :span="24"> | |
47 | + <a-form-model-item label="请求头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestHeader"> | |
48 | + <a-input v-model="model.requestHeader" placeholder="请输入请求头" ></a-input> | |
49 | + </a-form-model-item> | |
50 | + </a-col> | |
51 | + <a-col :span="24"> | |
52 | + <a-form-model-item label="请求内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requestBody"> | |
53 | + <a-input v-model="model.requestBody" placeholder="请输入请求内容" ></a-input> | |
54 | + </a-form-model-item> | |
55 | + </a-col> | |
56 | + <a-col :span="24"> | |
57 | + <a-form-model-item label="响应头" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseHeader"> | |
58 | + <a-input v-model="model.responseHeader" placeholder="请输入响应头" ></a-input> | |
59 | + </a-form-model-item> | |
60 | + </a-col> | |
61 | + <a-col :span="24"> | |
62 | + <a-form-model-item label="响应内容" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responseBody"> | |
63 | + <a-input v-model="model.responseBody" placeholder="请输入响应内容" ></a-input> | |
64 | + </a-form-model-item> | |
65 | + </a-col> | |
66 | + <a-col :span="24"> | |
67 | + <a-form-model-item label="响应耗时(毫秒)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="duration"> | |
68 | + <a-input v-model="model.duration" placeholder="请输入响应耗时(毫秒)" ></a-input> | |
69 | + </a-form-model-item> | |
70 | + </a-col> | |
71 | + <a-col :span="24"> | |
72 | + <a-form-model-item label="httpCode" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="httpCode"> | |
73 | + <a-input-number v-model="model.httpCode" placeholder="请输入httpCode" style="width: 100%" /> | |
74 | + </a-form-model-item> | |
75 | + </a-col> | |
76 | + <a-col :span="24"> | |
77 | + <a-form-model-item label="业务响应码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="retCode"> | |
78 | + <a-input-number v-model="model.retCode" placeholder="请输入业务响应码" style="width: 100%" /> | |
79 | + </a-form-model-item> | |
80 | + </a-col> | |
81 | + <a-col :span="24"> | |
82 | + <a-form-model-item label="异常堆栈信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="exception"> | |
83 | + <a-input v-model="model.exception" placeholder="请输入异常堆栈信息" ></a-input> | |
84 | + </a-form-model-item> | |
85 | + </a-col> | |
86 | + </a-row> | |
87 | + </a-form-model> | |
88 | + </j-form-container> | |
89 | + </a-spin> | |
90 | +</template> | |
91 | + | |
92 | +<script> | |
93 | + | |
94 | + import { httpAction, getAction } from '@/api/manage' | |
95 | + import { validateDuplicateValue } from '@/utils/util' | |
96 | + | |
97 | + export default { | |
98 | + name: 'ApiLogForm', | |
99 | + components: { | |
100 | + }, | |
101 | + props: { | |
102 | + //表单禁用 | |
103 | + disabled: { | |
104 | + type: Boolean, | |
105 | + default: false, | |
106 | + required: false | |
107 | + } | |
108 | + }, | |
109 | + data () { | |
110 | + return { | |
111 | + model:{ | |
112 | + }, | |
113 | + labelCol: { | |
114 | + xs: { span: 24 }, | |
115 | + sm: { span: 5 }, | |
116 | + }, | |
117 | + wrapperCol: { | |
118 | + xs: { span: 24 }, | |
119 | + sm: { span: 16 }, | |
120 | + }, | |
121 | + confirmLoading: false, | |
122 | + validatorRules: { | |
123 | + }, | |
124 | + url: { | |
125 | + add: "/monitor/apiLog/add", | |
126 | + edit: "/monitor/apiLog/edit", | |
127 | + queryById: "/monitor/apiLog/queryById" | |
128 | + } | |
129 | + } | |
130 | + }, | |
131 | + computed: { | |
132 | + formDisabled(){ | |
133 | + return this.disabled | |
134 | + }, | |
135 | + }, | |
136 | + created () { | |
137 | + //备份model原始值 | |
138 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
139 | + }, | |
140 | + methods: { | |
141 | + add () { | |
142 | + this.edit(this.modelDefault); | |
143 | + }, | |
144 | + edit (record) { | |
145 | + this.model = Object.assign({}, record); | |
146 | + this.visible = true; | |
147 | + }, | |
148 | + submitForm () { | |
149 | + const that = this; | |
150 | + // 触发表单验证 | |
151 | + this.$refs.form.validate(valid => { | |
152 | + if (valid) { | |
153 | + that.confirmLoading = true; | |
154 | + let httpurl = ''; | |
155 | + let method = ''; | |
156 | + if(!this.model.id){ | |
157 | + httpurl+=this.url.add; | |
158 | + method = 'post'; | |
159 | + }else{ | |
160 | + httpurl+=this.url.edit; | |
161 | + method = 'put'; | |
162 | + } | |
163 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
164 | + if(res.success){ | |
165 | + that.$message.success(res.message); | |
166 | + that.$emit('ok'); | |
167 | + }else{ | |
168 | + that.$message.warning(res.message); | |
169 | + } | |
170 | + }).finally(() => { | |
171 | + that.confirmLoading = false; | |
172 | + }) | |
173 | + } | |
174 | + | |
175 | + }) | |
176 | + }, | |
177 | + } | |
178 | + } | |
179 | +</script> | |
0 | 180 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.Style#Drawer.vue
0 → 100644
1 | +<template> | |
2 | + <a-drawer | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + placement="right" | |
6 | + :closable="false" | |
7 | + @close="close" | |
8 | + destroyOnClose | |
9 | + :visible="visible"> | |
10 | + <api-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></api-log-form> | |
11 | + <div class="drawer-footer"> | |
12 | + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |
13 | + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |
14 | + </div> | |
15 | + </a-drawer> | |
16 | +</template> | |
17 | + | |
18 | +<script> | |
19 | + | |
20 | + import ApiLogForm from './ApiLogForm' | |
21 | + | |
22 | + export default { | |
23 | + name: 'ApiLogModal', | |
24 | + components: { | |
25 | + ApiLogForm | |
26 | + }, | |
27 | + data () { | |
28 | + return { | |
29 | + title:"操作", | |
30 | + width:800, | |
31 | + visible: false, | |
32 | + disableSubmit: false | |
33 | + } | |
34 | + }, | |
35 | + methods: { | |
36 | + add () { | |
37 | + this.visible=true | |
38 | + this.$nextTick(()=>{ | |
39 | + this.$refs.realForm.add(); | |
40 | + }) | |
41 | + }, | |
42 | + edit (record) { | |
43 | + this.visible=true | |
44 | + this.$nextTick(()=>{ | |
45 | + this.$refs.realForm.edit(record); | |
46 | + }); | |
47 | + }, | |
48 | + close () { | |
49 | + this.$emit('close'); | |
50 | + this.visible = false; | |
51 | + }, | |
52 | + submitCallback(){ | |
53 | + this.$emit('ok'); | |
54 | + this.visible = false; | |
55 | + }, | |
56 | + handleOk () { | |
57 | + this.$refs.realForm.submitForm(); | |
58 | + }, | |
59 | + handleCancel () { | |
60 | + this.close() | |
61 | + } | |
62 | + } | |
63 | + } | |
64 | +</script> | |
65 | + | |
66 | +<style lang="less" scoped> | |
67 | +/** Button按钮间距 */ | |
68 | + .ant-btn { | |
69 | + margin-left: 30px; | |
70 | + margin-bottom: 30px; | |
71 | + float: right; | |
72 | + } | |
73 | + .drawer-footer{ | |
74 | + position: absolute; | |
75 | + bottom: -8px; | |
76 | + width: 100%; | |
77 | + border-top: 1px solid #e8e8e8; | |
78 | + padding: 10px 16px; | |
79 | + text-align: right; | |
80 | + left: 0; | |
81 | + background: #fff; | |
82 | + border-radius: 0 0 2px 2px; | |
83 | + } | |
84 | +</style> | |
0 | 85 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/monitor/modules/ApiLogModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + switchFullscreen | |
7 | + @ok="handleOk" | |
8 | + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |
9 | + @cancel="handleCancel" | |
10 | + cancelText="关闭"> | |
11 | + <api-log-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></api-log-form> | |
12 | + </j-modal> | |
13 | +</template> | |
14 | + | |
15 | +<script> | |
16 | + | |
17 | + import ApiLogForm from './ApiLogForm' | |
18 | + export default { | |
19 | + name: 'ApiLogModal', | |
20 | + components: { | |
21 | + ApiLogForm | |
22 | + }, | |
23 | + data () { | |
24 | + return { | |
25 | + title:'', | |
26 | + width:800, | |
27 | + visible: false, | |
28 | + disableSubmit: false | |
29 | + } | |
30 | + }, | |
31 | + methods: { | |
32 | + add () { | |
33 | + this.visible=true | |
34 | + this.$nextTick(()=>{ | |
35 | + this.$refs.realForm.add(); | |
36 | + }) | |
37 | + }, | |
38 | + edit (record) { | |
39 | + this.visible=true | |
40 | + this.$nextTick(()=>{ | |
41 | + this.$refs.realForm.edit(record); | |
42 | + }) | |
43 | + }, | |
44 | + close () { | |
45 | + this.$emit('close'); | |
46 | + this.visible = false; | |
47 | + }, | |
48 | + handleOk () { | |
49 | + this.$refs.realForm.submitForm(); | |
50 | + }, | |
51 | + submitCallback(){ | |
52 | + this.$emit('ok'); | |
53 | + this.visible = false; | |
54 | + }, | |
55 | + handleCancel () { | |
56 | + this.close() | |
57 | + } | |
58 | + } | |
59 | + } | |
60 | +</script> | |
0 | 61 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerDetailList.vue
... | ... | @@ -159,14 +159,9 @@ |
159 | 159 | // 表头 |
160 | 160 | columns: [ |
161 | 161 | { |
162 | - title: '#', | |
163 | - dataIndex: '', | |
164 | - key:'rowIndex', | |
165 | - width:60, | |
162 | + title:'组盘详情ID', | |
166 | 163 | align:"center", |
167 | - customRender:function (t,r,index) { | |
168 | - return parseInt(index)+1; | |
169 | - } | |
164 | + dataIndex: 'id' | |
170 | 165 | }, |
171 | 166 | { |
172 | 167 | title:'货主编码', |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptContainerHeaderList.vue
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptDetailList.vue
... | ... | @@ -112,14 +112,9 @@ |
112 | 112 | // 表头 |
113 | 113 | columns: [ |
114 | 114 | { |
115 | - title: '#', | |
116 | - dataIndex: '', | |
117 | - key:'rowIndex', | |
118 | - width:60, | |
115 | + title:'单据详情ID', | |
119 | 116 | align:"center", |
120 | - customRender:function (t,r,index) { | |
121 | - return parseInt(index)+1; | |
122 | - } | |
117 | + dataIndex: 'id' | |
123 | 118 | }, |
124 | 119 | { |
125 | 120 | title:'物料编码', |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/ReceiptHeaderList.vue
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/receipt/modules/ReceiptDetailModal.vue
... | ... | @@ -88,8 +88,8 @@ |
88 | 88 | ], |
89 | 89 | }, |
90 | 90 | url: { |
91 | - add: "/config/receiptHeader/addReceiptDetail", | |
92 | - edit: "/config/receiptHeader/editReceiptDetail", | |
91 | + add: "/receipt/receiptHeader/addReceiptDetail", | |
92 | + edit: "/receipt/receiptHeader/editReceiptDetail", | |
93 | 93 | } |
94 | 94 | |
95 | 95 | } |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskDetailList.vue
... | ... | @@ -112,14 +112,9 @@ |
112 | 112 | // 表头 |
113 | 113 | columns: [ |
114 | 114 | { |
115 | - title: '#', | |
116 | - dataIndex: '', | |
117 | - key:'rowIndex', | |
118 | - width:60, | |
115 | + title:'任务详情ID', | |
119 | 116 | align:"center", |
120 | - customRender:function (t,r,index) { | |
121 | - return parseInt(index)+1; | |
122 | - } | |
117 | + dataIndex: 'id' | |
123 | 118 | }, |
124 | 119 | { |
125 | 120 | title:'货主', |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/task/TaskHeaderList.vue
... | ... | @@ -132,12 +132,15 @@ |
132 | 132 | </template> |
133 | 133 | |
134 | 134 | <span slot="action" slot-scope="text, record"> |
135 | - <a @click="handleEdit(record)">编辑</a> | |
135 | + <a v-if="record.status < 100" @click="completeTask(record)">完成任务</a> | |
136 | 136 | |
137 | 137 | <a-divider type="vertical" /> |
138 | 138 | <a-dropdown> |
139 | 139 | <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
140 | 140 | <a-menu slot="overlay"> |
141 | + <a-menu-item> | |
142 | + <a @click="handleEdit(record)">编辑</a> | |
143 | + </a-menu-item> | |
141 | 144 | <a-menu-item> |
142 | 145 | <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
143 | 146 | <a>删除</a> |
... | ... | @@ -168,6 +171,7 @@ |
168 | 171 | import TaskDetailList from './TaskDetailList' |
169 | 172 | import {initDictOptions,filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
170 | 173 | import '@/assets/less/TableExpand.less' |
174 | + import {completeTaskByWMS} from '@/api/api' | |
171 | 175 | |
172 | 176 | export default { |
173 | 177 | name: "TaskHeaderList", |
... | ... | @@ -347,6 +351,21 @@ |
347 | 351 | this.loading = false; |
348 | 352 | }) |
349 | 353 | }, |
354 | + completeTask(record) { | |
355 | + this.loading = true; | |
356 | + const that = this; | |
357 | + this.model = Object.assign({}, record); | |
358 | + completeTaskByWMS(this.model).then((res) => { | |
359 | + this.loading = false; | |
360 | + if (res.success) { | |
361 | + this.$message.success(res.message); | |
362 | + } | |
363 | + else { | |
364 | + this.$message.error(res.message); | |
365 | + } | |
366 | + this.searchQuery(); | |
367 | + }); | |
368 | + }, | |
350 | 369 | getSuperFieldList(){ |
351 | 370 | let fieldList=[]; |
352 | 371 | fieldList.push({type:'int',value:'taskType',text:'任务类型',dictCode:'task_type'}) |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java
... | ... | @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
7 | 7 | import lombok.extern.slf4j.Slf4j; |
8 | 8 | import org.apache.commons.beanutils.PropertyUtils; |
9 | +import org.apache.commons.collections.MapUtils; | |
9 | 10 | import org.apache.shiro.SecurityUtils; |
10 | 11 | import org.jeecg.common.api.vo.Result; |
11 | 12 | import org.jeecg.common.system.query.QueryGenerator; |
... | ... | @@ -27,6 +28,7 @@ import javax.servlet.http.HttpServletRequest; |
27 | 28 | import javax.servlet.http.HttpServletResponse; |
28 | 29 | import java.io.IOException; |
29 | 30 | import java.util.*; |
31 | +import java.util.concurrent.Semaphore; | |
30 | 32 | import java.util.stream.Collectors; |
31 | 33 | |
32 | 34 | /** |
... | ... | @@ -199,4 +201,68 @@ public class JeecgController<T, S extends IService<T>> { |
199 | 201 | } |
200 | 202 | return Result.error("文件导入失败!"); |
201 | 203 | } |
204 | + | |
205 | + | |
206 | + //下发任务并发控制 | |
207 | + Map<String, Boolean> runningTaskMap = new HashMap<>(); | |
208 | + | |
209 | + //并发控制,一次只允许一个请求 | |
210 | + public Result handleQuest(String taskKey, MultiProcessListener multiProcessListener) { | |
211 | + Result result = null; | |
212 | + if(MapUtils.getBoolean(runningTaskMap, taskKey, false)) { | |
213 | + return Result.error("重复请求,清稍后重试"); | |
214 | + } | |
215 | + runningTaskMap.put(taskKey, true); | |
216 | + try { | |
217 | + result = multiProcessListener.doProcess(); | |
218 | + } catch (Exception e) { | |
219 | + e.printStackTrace(); | |
220 | + throw new RuntimeException(e); | |
221 | + } finally { | |
222 | + runningTaskMap.put(taskKey, false); | |
223 | + } | |
224 | + return result; | |
225 | + } | |
226 | + | |
227 | + Semaphore semaphore=new Semaphore(1); | |
228 | + //下发任务并发控制 | |
229 | + Map<String, Boolean> multiProcessMap = new HashMap<>(); | |
230 | + | |
231 | + public Result handleMultiProcess(String taskKey, MultiProcessListener multiProcessListener) { | |
232 | + Result result = null; | |
233 | + int max_time = 30 * 1000; | |
234 | + int now = 0; | |
235 | + boolean avail = true; | |
236 | + while(avail) { | |
237 | + boolean availablePermits = MapUtils.getBoolean(multiProcessMap, taskKey, false); | |
238 | + if(!availablePermits) { | |
239 | + avail = false; | |
240 | + try { | |
241 | + multiProcessMap.put(taskKey, true); | |
242 | + result = multiProcessListener.doProcess(); | |
243 | + } catch (Exception e) { | |
244 | + e.printStackTrace(); | |
245 | + throw new RuntimeException(e); | |
246 | + } finally { | |
247 | + multiProcessMap.put(taskKey, false); | |
248 | + } | |
249 | + } else { | |
250 | + result = Result.error("多线程处理异常, 待处理现场太多,等待时间超出30秒"); | |
251 | + try { | |
252 | + now = now + 200; | |
253 | + Thread.sleep(200); | |
254 | + } catch (InterruptedException e) { | |
255 | + e.printStackTrace(); | |
256 | + } | |
257 | + if(now >= max_time) { | |
258 | + avail = false; | |
259 | + } | |
260 | + } | |
261 | + } | |
262 | + return result; | |
263 | + } | |
264 | + | |
265 | + public interface MultiProcessListener { | |
266 | + Result doProcess(); | |
267 | + } | |
202 | 268 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/controller/WcsController.java
... | ... | @@ -6,6 +6,7 @@ import org.jeecg.common.api.vo.Result; |
6 | 6 | import org.jeecg.common.aspect.annotation.AutoLog; |
7 | 7 | import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; |
8 | 8 | import org.jeecg.modules.wms.api.wcs.service.WcsService; |
9 | +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | |
9 | 10 | import org.jeecg.modules.wms.framework.controller.BaseController; |
10 | 11 | import org.jeecg.utils.StringUtils; |
11 | 12 | import org.springframework.web.bind.annotation.*; |
... | ... | @@ -26,7 +27,7 @@ public class WcsController extends BaseController { |
26 | 27 | @PostMapping("/warecellAllocation") |
27 | 28 | @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST") |
28 | 29 | @ResponseBody |
29 | -// @ApiLogger(apiName = "仓位分配", from="WCS") | |
30 | + @ApiLogger(apiName = "仓位分配", from="WCS") | |
30 | 31 | public Result warecellAllocation(@RequestBody WarecellDomain warecellDomain) { |
31 | 32 | if (StringUtils.isEmpty(warecellDomain.getTaskNo())) { |
32 | 33 | return Result.error("任务号为空"); |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsService.java
... | ... | @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.api.wcs.service; |
2 | 2 | |
3 | 3 | import org.jeecg.common.api.vo.Result; |
4 | 4 | import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; |
5 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | |
5 | 6 | |
6 | 7 | /** |
7 | 8 | * @author 游杰 |
... | ... | @@ -11,4 +12,5 @@ public interface WcsService { |
11 | 12 | /**仓位分配*/ |
12 | 13 | Result warecellAllocation(WarecellDomain warecellDomain); |
13 | 14 | |
15 | + Result wcsTaskAssign(TaskHeader taskHeader); | |
14 | 16 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/wcs/service/WcsServiceImpl.java
... | ... | @@ -20,6 +20,7 @@ import org.jeecg.modules.wms.config.material.service.IMaterialService; |
20 | 20 | import org.jeecg.modules.wms.config.parameterConfiguration.service.IParameterConfigurationService; |
21 | 21 | import org.jeecg.modules.wms.config.zone.entity.Zone; |
22 | 22 | import org.jeecg.modules.wms.config.zone.service.IZoneService; |
23 | +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | |
23 | 24 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerDetail; |
24 | 25 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
25 | 26 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerDetailService; |
... | ... | @@ -131,6 +132,16 @@ public class WcsServiceImpl implements WcsService { |
131 | 132 | taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskHeaderId, taskNo); |
132 | 133 | List<TaskDetail> taskDetailList = taskDetailService.list(taskDetailLambdaQueryWrapper); |
133 | 134 | |
135 | + if(taskDetailList.size() > 0) { | |
136 | + String materialCode = taskDetailList.get(0).getMaterialCode(); | |
137 | + if(StringUtils.isNotEmpty(materialCode)) { | |
138 | + Material material = materialService.getMaterialByCode(materialCode); | |
139 | + if(material != null) { | |
140 | + materialAreaCode = material.getMaterialareaCode(); | |
141 | + } | |
142 | + } | |
143 | + } | |
144 | + | |
134 | 145 | locationCode = locationAllocationService.allocation(allocationRule, |
135 | 146 | locationTypeCodeList, high, zoneCode, roadWays, warehouseCode, containerCode, materialAreaCode); |
136 | 147 | if (StringUtils.isEmpty(locationCode)) { |
... | ... | @@ -155,12 +166,9 @@ public class WcsServiceImpl implements WcsService { |
155 | 166 | receiptContainerDetailList.add(receiptContainerDetail); |
156 | 167 | } |
157 | 168 | } |
158 | - receiptContainerDetailList = receiptContainerDetailList.stream().distinct().collect(Collectors.toList()); | |
159 | - if (receiptContainerDetailList != null && receiptContainerDetailList.size() > 0) { | |
160 | - String materialCode = receiptContainerDetailList.get(0).getMaterialCode(); | |
161 | - Material material = materialService.getMaterialByCode(materialCode); | |
162 | - materialAreaCode = material.getMaterialareaCode(); | |
163 | - } | |
169 | + //去重 | |
170 | + receiptContainerDetailList = receiptContainerDetailList.stream(). | |
171 | + distinct().collect(Collectors.toList()); | |
164 | 172 | |
165 | 173 | if (receiptContainerDetailList.size() > 0) { |
166 | 174 | //更新库位编码到组盘头表 |
... | ... | @@ -198,12 +206,14 @@ public class WcsServiceImpl implements WcsService { |
198 | 206 | } else { |
199 | 207 | Location outSideLocation = locationService.getOutSideNear(location); |
200 | 208 | if(outSideLocation != null) { |
201 | - TaskHeader outSideTaskHeader = taskHeaderService.getTaskHeaderByLocationCode(outSideLocation.getCode()); | |
209 | + TaskHeader outSideTaskHeader = taskHeaderService. | |
210 | + getUnCompleteTaskByLocationCode(outSideLocation.getCode(), warehouseCode); | |
202 | 211 | if (outSideTaskHeader != null) { |
203 | 212 | preTaskNo = outSideTaskHeader.getId(); |
204 | 213 | } |
205 | 214 | } |
206 | 215 | } |
216 | + | |
207 | 217 | taskHeader.setZoneCode(location.getZoneCode()); |
208 | 218 | taskHeader.setPreTaskNo(preTaskNo); |
209 | 219 | taskHeader.setWeight(Integer.parseInt(warecellDomain.getWeight())); |
... | ... | @@ -217,4 +227,139 @@ public class WcsServiceImpl implements WcsService { |
217 | 227 | wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); |
218 | 228 | return Result.OK(wcsTask); |
219 | 229 | } |
230 | + | |
231 | + @Override | |
232 | + @Transactional(rollbackFor = Exception.class) | |
233 | + @ApiLogger(apiName = "任务下发", from="WCS") | |
234 | + public Result wcsTaskAssign(TaskHeader taskHeader) { | |
235 | + if(taskHeader == null){ | |
236 | + return Result.error("wms任务为空"); | |
237 | + } | |
238 | + if(taskHeader.getId() == null){ | |
239 | + return Result.error("wms任务号Id为空"); | |
240 | + } | |
241 | + if(taskHeader.getTaskType() == null){ | |
242 | + return Result.error("wms任务类型为空"); | |
243 | + } | |
244 | + String containerCode = taskHeader.getContainerCode(); | |
245 | + if(StringUtils.isEmpty(containerCode)){ | |
246 | + return Result.error("wms任务中容器为空"); | |
247 | + } | |
248 | + int taskType = taskHeader.getTaskType(); | |
249 | + int preTaskNo = 0; | |
250 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
251 | + if(StringUtils.isEmpty(warehouseCode)){ | |
252 | + return Result.error("wms任务中仓库编码为空"); | |
253 | + } | |
254 | + String fromLocationCode = taskHeader.getFromLocationCode(); | |
255 | + String toLocationCode = taskHeader.getToLocationCode(); | |
256 | + Location fromLocation = locationService.getLocationByCode(fromLocationCode, warehouseCode); | |
257 | + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | |
258 | + boolean direction = true; // true 执行时是入库动作, false 执行时是出库动作 | |
259 | + switch(taskType) { | |
260 | + case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: | |
261 | + case QuantityConstant.TASK_TYPE_WHOLESHIPMENT: | |
262 | + case QuantityConstant.TASK_TYPE_SORTINGSHIPMENT: | |
263 | + case QuantityConstant.TASK_TYPE_EMPTYSHIPMENT: | |
264 | + case QuantityConstant.TASK_TYPE_CYCLECOUNT: | |
265 | + case QuantityConstant.TASK_TYPE_TRANSFER: | |
266 | + case QuantityConstant.TASK_TYPE_VIEW: | |
267 | + case QuantityConstant.TASK_TYPE_MANY_EMPTYSHIPMENT: | |
268 | + if(fromLocation == null) { | |
269 | + return Result.error("起始库位为空"); | |
270 | + } | |
271 | + direction = false; | |
272 | + break; | |
273 | + case QuantityConstant.TASK_TYPE_WHOLERECEIPT: | |
274 | + case QuantityConstant.TASK_TYPE_EMPTYRECEIPT: | |
275 | + case QuantityConstant.TASK_TYPE_MANY_EMPTYRECEIPT: | |
276 | + if(toLocation == null) { | |
277 | + return Result.error("终点库位为空"); | |
278 | + } | |
279 | + direction = true; | |
280 | + break; | |
281 | + default: | |
282 | + break; | |
283 | + } | |
284 | + | |
285 | + // 出库动作 | |
286 | + if (!direction) { | |
287 | + // 出库性质的任务圆库位不能为空 | |
288 | + if (StringUtils.isEmpty(fromLocationCode)) { | |
289 | + return Result.error("源库位为空"); | |
290 | + } | |
291 | + int rowFlag = fromLocation.getRowFlag(); | |
292 | + if(rowFlag == QuantityConstant.ROW_OUT) { | |
293 | + //找到对应内侧库位 | |
294 | + Location insideLocation = locationService.getInsideNear(fromLocation); | |
295 | + String insideLocationCode = insideLocation.getCode(); | |
296 | + //如果对应内侧库位有托盘 | |
297 | + if(StringUtils.isNotEmpty(insideLocation.getContainerCode())) { | |
298 | + //如果对应内侧库位有托盘数据,那么不可能会有入库类型的任务,因为正在执行的入库类型的任务 库位是不会有托盘数据的。 | |
299 | + TaskHeader taskHeader1 = taskHeaderService. | |
300 | + getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode); | |
301 | + if(taskHeader1 != null) { | |
302 | + preTaskNo = taskHeader1.getId(); | |
303 | + } else { | |
304 | + //找空闲库位,优先找外侧空闲库位,作为移库目的地 | |
305 | + Location destinationLocation = locationService.getEmptyLocation(insideLocation); | |
306 | + if (destinationLocation == null) { | |
307 | + return Result.error("移库没有剩余库位"); | |
308 | + } | |
309 | + Result result = taskHeaderService.createTransferTask( | |
310 | + insideLocation.getCode(), destinationLocation.getCode(), warehouseCode); | |
311 | + preTaskNo = (Integer) result.getResult(); | |
312 | + if (!result.isSuccess()) { | |
313 | + return Result.error("创建移库任务失败"); | |
314 | + } | |
315 | + //移库任务 | |
316 | + taskHeader.setPreTaskNo(preTaskNo); | |
317 | + taskHeaderService.updateById(taskHeader); | |
318 | + return Result.error("先执行移库任务"); | |
319 | + } | |
320 | + } else { | |
321 | + //如果是有任务,从这个库位入托盘,那么不能生成新的出库任务。必须等这个任务完成以后,重新生成新的移库后,这个任务才能执行。 | |
322 | + TaskHeader taskHeader1 = taskHeaderService. | |
323 | + getUnCompleteTaskByToLocationCode(insideLocationCode, warehouseCode); | |
324 | + if(taskHeader1 != null) { | |
325 | + return Result.error("执行外侧库位出库时,相应的内侧库位有入库类型任务,请先执行完内侧库位任务"); | |
326 | + } | |
327 | + //如果是有任务,从这个库位出托盘,那么等这个任务作为前置任务。 | |
328 | + taskHeader1 = taskHeaderService. | |
329 | + getUnCompleteTaskByFromLocationCode(insideLocationCode, warehouseCode); | |
330 | + if(taskHeader1 != null) { | |
331 | + preTaskNo = taskHeader1.getId(); | |
332 | + } | |
333 | + } | |
334 | + taskHeader.setPreTaskNo(preTaskNo); | |
335 | + taskHeaderService.updateById(taskHeader); | |
336 | + } | |
337 | + } | |
338 | + | |
339 | + WcsTask wcsTask = new WcsTask(); | |
340 | + wcsTask.setTaskNo(taskHeader.getId().toString()); | |
341 | + wcsTask.setWarehouseCode(warehouseCode); | |
342 | + wcsTask.setTaskType(taskType); | |
343 | + wcsTask.setFromPort(taskHeader.getFromPort()); | |
344 | + wcsTask.setToPort(taskHeader.getToPort()); | |
345 | + wcsTask.setContainerCode(taskHeader.getContainerCode()); | |
346 | + if (preTaskNo != 0) { | |
347 | + wcsTask.setPreTaskNo(String.valueOf(preTaskNo)); | |
348 | + } | |
349 | + if (StringUtils.isEmpty(fromLocationCode)) { | |
350 | + wcsTask.setFromLocationCode(QuantityConstant.EMPTY_STRING); | |
351 | + } else { | |
352 | + wcsTask.setFromLocationCode(fromLocationCode); | |
353 | + } | |
354 | + if (StringUtils.isEmpty(toLocationCode)) { | |
355 | + wcsTask.setToLocationCode(QuantityConstant.EMPTY_STRING); | |
356 | + } else { | |
357 | + wcsTask.setToLocationCode(toLocationCode); | |
358 | + } | |
359 | + wcsTask.setPriority(10); | |
360 | + wcsTask.setPlatform(QuantityConstant.PLATFORM_WMS); | |
361 | + | |
362 | + | |
363 | + return null; | |
364 | + } | |
220 | 365 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/IAddressService.java
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/address/service/impl/AddressServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.config.address.service.impl; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
3 | 5 | import org.jeecg.modules.wms.config.address.entity.Address; |
4 | 6 | import org.jeecg.modules.wms.config.address.mapper.AddressMapper; |
5 | 7 | import org.jeecg.modules.wms.config.address.service.IAddressService; |
... | ... | @@ -16,4 +18,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
16 | 18 | @Service |
17 | 19 | public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService { |
18 | 20 | |
21 | + @Override | |
22 | + public Address getAddressByUrl(String url, String warehouseCode) { | |
23 | + LambdaQueryWrapper<Address> addressLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
24 | + addressLambdaQueryWrapper.eq(Address::getUrl, url) | |
25 | + .eq(Address::getWarehouseCode, warehouseCode); | |
26 | + Address address = getOne(addressLambdaQueryWrapper); | |
27 | + return address; | |
28 | + } | |
19 | 29 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/ILocationService.java
... | ... | @@ -13,11 +13,14 @@ import java.util.List; |
13 | 13 | */ |
14 | 14 | public interface ILocationService extends IService<Location> { |
15 | 15 | |
16 | - Location getLocationByCode(String locationCode, String wareohuseCode); | |
16 | + Location getLocationByCode(String locationCode, String warehouseCode); | |
17 | 17 | |
18 | - List<Location> getLocationListByZoneCode(String zoneCode, String wareohuseCode); | |
18 | + List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode); | |
19 | 19 | |
20 | - boolean updateStatus(String locationCode, String status, String wareohuseCode); | |
20 | + boolean updateStatus(String locationCode, String status, String warehouseCode); | |
21 | + | |
22 | + boolean updateContainerCodeAndStatus(String locationCode | |
23 | + , String containerCode, String status, String warehouseCode); | |
21 | 24 | |
22 | 25 | Location getNear(Location location); |
23 | 26 | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/location/service/impl/LocationServiceImpl.java
... | ... | @@ -30,32 +30,44 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i |
30 | 30 | private ITaskHeaderService taskHeaderService; |
31 | 31 | |
32 | 32 | @Override |
33 | - public Location getLocationByCode(String locationCode, String wareohuseCode) { | |
33 | + public Location getLocationByCode(String locationCode, String warehouseCode) { | |
34 | 34 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
35 | 35 | locationLambdaQueryWrapper.eq(Location::getCode, locationCode) |
36 | 36 | .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) |
37 | - .eq(Location::getWarehouseCode, wareohuseCode); | |
37 | + .eq(Location::getWarehouseCode, warehouseCode); | |
38 | 38 | Location location = this.getOne(locationLambdaQueryWrapper); |
39 | 39 | return location; |
40 | 40 | } |
41 | 41 | |
42 | 42 | @Override |
43 | - public List<Location> getLocationListByZoneCode(String zoneCode, String wareohuseCode) { | |
43 | + public List<Location> getLocationListByZoneCode(String zoneCode, String warehouseCode) { | |
44 | 44 | LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery(); |
45 | 45 | locationLambdaQueryWrapper.eq(Location::getZoneCode, zoneCode) |
46 | 46 | .eq(Location::getEnable, QuantityConstant.STATUS_ENABLE) |
47 | - .eq(Location::getWarehouseCode, wareohuseCode); | |
47 | + .eq(Location::getWarehouseCode, warehouseCode); | |
48 | 48 | List<Location> locationList = this.list(locationLambdaQueryWrapper); |
49 | 49 | return locationList; |
50 | 50 | } |
51 | 51 | |
52 | 52 | @Override |
53 | - public boolean updateStatus(String locationCode, String status, String wareohuseCode) { | |
54 | - Location location = getLocationByCode(locationCode, wareohuseCode); | |
53 | + public boolean updateStatus(String locationCode, String status, String warehouseCode) { | |
54 | + Location location = getLocationByCode(locationCode, warehouseCode); | |
55 | 55 | if(location == null) { |
56 | 56 | return false; |
57 | 57 | } |
58 | - location.setStatus(QuantityConstant.STATUS_LOCATION_LOCK); | |
58 | + location.setStatus(status); | |
59 | + boolean result = updateById(location); | |
60 | + return result; | |
61 | + } | |
62 | + | |
63 | + @Override | |
64 | + public boolean updateContainerCodeAndStatus(String locationCode, String containerCode, String status, String warehouseCode) { | |
65 | + Location location = getLocationByCode(locationCode, warehouseCode); | |
66 | + if(location == null) { | |
67 | + return false; | |
68 | + } | |
69 | + location.setContainerCode(containerCode); | |
70 | + location.setStatus(status); | |
59 | 71 | boolean result = updateById(location); |
60 | 72 | return result; |
61 | 73 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/Convert.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework; | |
2 | + | |
3 | + | |
4 | +import org.jeecg.utils.StringUtils; | |
5 | +import org.jeecg.utils.support.CharsetKit; | |
6 | + | |
7 | +import java.math.BigDecimal; | |
8 | +import java.math.BigInteger; | |
9 | +import java.nio.ByteBuffer; | |
10 | +import java.nio.charset.Charset; | |
11 | +import java.text.NumberFormat; | |
12 | +import java.util.Set; | |
13 | + | |
14 | +/** | |
15 | + * 类型转换器 | |
16 | + * | |
17 | + * @author huaheng | |
18 | + * | |
19 | + */ | |
20 | +public class Convert | |
21 | +{ | |
22 | + /** | |
23 | + * 转换为字符串<br> | |
24 | + * 如果给定的值为null,或者转换失败,返回默认值<br> | |
25 | + * 转换失败不会报错 | |
26 | + * | |
27 | + * @param value 被转换的值 | |
28 | + * @param defaultValue 转换错误时的默认值 | |
29 | + * @return 结果 | |
30 | + */ | |
31 | + public static String toStr(Object value, String defaultValue) | |
32 | + { | |
33 | + if (null == value) | |
34 | + { | |
35 | + return defaultValue; | |
36 | + } | |
37 | + if (value instanceof String) | |
38 | + { | |
39 | + return (String) value; | |
40 | + } | |
41 | + return value.toString(); | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * 转换为字符串<br> | |
46 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> | |
47 | + * 转换失败不会报错 | |
48 | + * | |
49 | + * @param value 被转换的值 | |
50 | + * @return 结果 | |
51 | + */ | |
52 | + public static String toStr(Object value) | |
53 | + { | |
54 | + return toStr(value, null); | |
55 | + } | |
56 | + | |
57 | + /** | |
58 | + * 转换为字符<br> | |
59 | + * 如果给定的值为null,或者转换失败,返回默认值<br> | |
60 | + * 转换失败不会报错 | |
61 | + * | |
62 | + * @param value 被转换的值 | |
63 | + * @param defaultValue 转换错误时的默认值 | |
64 | + * @return 结果 | |
65 | + */ | |
66 | + public static Character toChar(Object value, Character defaultValue) | |
67 | + { | |
68 | + if (null == value) | |
69 | + { | |
70 | + return defaultValue; | |
71 | + } | |
72 | + if (value instanceof Character) | |
73 | + { | |
74 | + return (Character) value; | |
75 | + } | |
76 | + | |
77 | + final String valueStr = toStr(value, null); | |
78 | + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * 转换为字符<br> | |
83 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> | |
84 | + * 转换失败不会报错 | |
85 | + * | |
86 | + * @param value 被转换的值 | |
87 | + * @return 结果 | |
88 | + */ | |
89 | + public static Character toChar(Object value) | |
90 | + { | |
91 | + return toChar(value, null); | |
92 | + } | |
93 | + | |
94 | + /** | |
95 | + * 转换为byte<br> | |
96 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> | |
97 | + * 转换失败不会报错 | |
98 | + * | |
99 | + * @param value 被转换的值 | |
100 | + * @param defaultValue 转换错误时的默认值 | |
101 | + * @return 结果 | |
102 | + */ | |
103 | + public static Byte toByte(Object value, Byte defaultValue) | |
104 | + { | |
105 | + if (value == null) | |
106 | + { | |
107 | + return defaultValue; | |
108 | + } | |
109 | + if (value instanceof Byte) | |
110 | + { | |
111 | + return (Byte) value; | |
112 | + } | |
113 | + if (value instanceof Number) | |
114 | + { | |
115 | + return ((Number) value).byteValue(); | |
116 | + } | |
117 | + final String valueStr = toStr(value, null); | |
118 | + if (StringUtils.isEmpty(valueStr)) | |
119 | + { | |
120 | + return defaultValue; | |
121 | + } | |
122 | + try | |
123 | + { | |
124 | + return Byte.parseByte(valueStr); | |
125 | + } | |
126 | + catch (Exception e) | |
127 | + { | |
128 | + return defaultValue; | |
129 | + } | |
130 | + } | |
131 | + | |
132 | + /** | |
133 | + * 转换为byte<br> | |
134 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> | |
135 | + * 转换失败不会报错 | |
136 | + * | |
137 | + * @param value 被转换的值 | |
138 | + * @return 结果 | |
139 | + */ | |
140 | + public static Byte toByte(Object value) | |
141 | + { | |
142 | + return toByte(value, null); | |
143 | + } | |
144 | + | |
145 | + /** | |
146 | + * 转换为Short<br> | |
147 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> | |
148 | + * 转换失败不会报错 | |
149 | + * | |
150 | + * @param value 被转换的值 | |
151 | + * @param defaultValue 转换错误时的默认值 | |
152 | + * @return 结果 | |
153 | + */ | |
154 | + public static Short toShort(Object value, Short defaultValue) | |
155 | + { | |
156 | + if (value == null) | |
157 | + { | |
158 | + return defaultValue; | |
159 | + } | |
160 | + if (value instanceof Short) | |
161 | + { | |
162 | + return (Short) value; | |
163 | + } | |
164 | + if (value instanceof Number) | |
165 | + { | |
166 | + return ((Number) value).shortValue(); | |
167 | + } | |
168 | + final String valueStr = toStr(value, null); | |
169 | + if (StringUtils.isEmpty(valueStr)) | |
170 | + { | |
171 | + return defaultValue; | |
172 | + } | |
173 | + try | |
174 | + { | |
175 | + return Short.parseShort(valueStr.trim()); | |
176 | + } | |
177 | + catch (Exception e) | |
178 | + { | |
179 | + return defaultValue; | |
180 | + } | |
181 | + } | |
182 | + | |
183 | + /** | |
184 | + * 转换为Short<br> | |
185 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> | |
186 | + * 转换失败不会报错 | |
187 | + * | |
188 | + * @param value 被转换的值 | |
189 | + * @return 结果 | |
190 | + */ | |
191 | + public static Short toShort(Object value) | |
192 | + { | |
193 | + return toShort(value, null); | |
194 | + } | |
195 | + | |
196 | + /** | |
197 | + * 转换为Number<br> | |
198 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
199 | + * 转换失败不会报错 | |
200 | + * | |
201 | + * @param value 被转换的值 | |
202 | + * @param defaultValue 转换错误时的默认值 | |
203 | + * @return 结果 | |
204 | + */ | |
205 | + public static Number toNumber(Object value, Number defaultValue) | |
206 | + { | |
207 | + if (value == null) | |
208 | + { | |
209 | + return defaultValue; | |
210 | + } | |
211 | + if (value instanceof Number) | |
212 | + { | |
213 | + return (Number) value; | |
214 | + } | |
215 | + final String valueStr = toStr(value, null); | |
216 | + if (StringUtils.isEmpty(valueStr)) | |
217 | + { | |
218 | + return defaultValue; | |
219 | + } | |
220 | + try | |
221 | + { | |
222 | + return NumberFormat.getInstance().parse(valueStr); | |
223 | + } | |
224 | + catch (Exception e) | |
225 | + { | |
226 | + return defaultValue; | |
227 | + } | |
228 | + } | |
229 | + | |
230 | + /** | |
231 | + * 转换为Number<br> | |
232 | + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> | |
233 | + * 转换失败不会报错 | |
234 | + * | |
235 | + * @param value 被转换的值 | |
236 | + * @return 结果 | |
237 | + */ | |
238 | + public static Number toNumber(Object value) | |
239 | + { | |
240 | + return toNumber(value, null); | |
241 | + } | |
242 | + | |
243 | + /** | |
244 | + * 转换为int<br> | |
245 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
246 | + * 转换失败不会报错 | |
247 | + * | |
248 | + * @param value 被转换的值 | |
249 | + * @param defaultValue 转换错误时的默认值 | |
250 | + * @return 结果 | |
251 | + */ | |
252 | + public static Integer toInt(Object value, Integer defaultValue) | |
253 | + { | |
254 | + if (value == null) | |
255 | + { | |
256 | + return defaultValue; | |
257 | + } | |
258 | + if (value instanceof Integer) | |
259 | + { | |
260 | + return (Integer) value; | |
261 | + } | |
262 | + if (value instanceof Number) | |
263 | + { | |
264 | + return ((Number) value).intValue(); | |
265 | + } | |
266 | + final String valueStr = toStr(value, null); | |
267 | + if (StringUtils.isEmpty(valueStr)) | |
268 | + { | |
269 | + return defaultValue; | |
270 | + } | |
271 | + try | |
272 | + { | |
273 | + return Integer.parseInt(valueStr.trim()); | |
274 | + } | |
275 | + catch (Exception e) | |
276 | + { | |
277 | + return defaultValue; | |
278 | + } | |
279 | + } | |
280 | + | |
281 | + /** | |
282 | + * 转换为int<br> | |
283 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> | |
284 | + * 转换失败不会报错 | |
285 | + * | |
286 | + * @param value 被转换的值 | |
287 | + * @return 结果 | |
288 | + */ | |
289 | + public static Integer toInt(Object value) | |
290 | + { | |
291 | + return toInt(value, null); | |
292 | + } | |
293 | + | |
294 | + /** | |
295 | + * 转换为Integer数组<br> | |
296 | + * | |
297 | + * @param str 被转换的值 | |
298 | + * @return 结果 | |
299 | + */ | |
300 | + public static Integer[] toIntArray(String str) | |
301 | + { | |
302 | + return toIntArray(",", str); | |
303 | + } | |
304 | + | |
305 | + /** | |
306 | + * 转换为Long数组<br> | |
307 | + * | |
308 | + * @param str 被转换的值 | |
309 | + * @return 结果 | |
310 | + */ | |
311 | + public static Long[] toLongArray(String str) | |
312 | + { | |
313 | + return toLongArray(",", str); | |
314 | + } | |
315 | + | |
316 | + /** | |
317 | + * 转换为Integer数组<br> | |
318 | + * | |
319 | + * @param split 分隔符 | |
320 | + * @param split 被转换的值 | |
321 | + * @return 结果 | |
322 | + */ | |
323 | + public static Integer[] toIntArray(String split, String str) | |
324 | + { | |
325 | + if (StringUtils.isEmpty(str)) | |
326 | + { | |
327 | + return new Integer[] {}; | |
328 | + } | |
329 | + String[] arr = str.split(split); | |
330 | + final Integer[] ints = new Integer[arr.length]; | |
331 | + for (int i = 0; i < arr.length; i++) | |
332 | + { | |
333 | + final Integer v = toInt(arr[i], 0); | |
334 | + ints[i] = v; | |
335 | + } | |
336 | + return ints; | |
337 | + } | |
338 | + | |
339 | + /** | |
340 | + * 转换为Long数组<br> | |
341 | + * | |
342 | + * @param split 分隔符 | |
343 | + * @param str 被转换的值 | |
344 | + * @return 结果 | |
345 | + */ | |
346 | + public static Long[] toLongArray(String split, String str) | |
347 | + { | |
348 | + if (StringUtils.isEmpty(str)) | |
349 | + { | |
350 | + return new Long[] {}; | |
351 | + } | |
352 | + String[] arr = str.split(split); | |
353 | + final Long[] longs = new Long[arr.length]; | |
354 | + for (int i = 0; i < arr.length; i++) | |
355 | + { | |
356 | + final Long v = toLong(arr[i], null); | |
357 | + longs[i] = v; | |
358 | + } | |
359 | + return longs; | |
360 | + } | |
361 | + | |
362 | + /** | |
363 | + * 转换为String数组<br> | |
364 | + * | |
365 | + * @param str 被转换的值 | |
366 | + * @return 结果 | |
367 | + */ | |
368 | + public static String[] toStrArray(String str) | |
369 | + { | |
370 | + return toStrArray(",", str); | |
371 | + } | |
372 | + | |
373 | + /** | |
374 | + * 转换为String数组<br> | |
375 | + * | |
376 | + * @param split 分隔符 | |
377 | + * @param split 被转换的值 | |
378 | + * @return 结果 | |
379 | + */ | |
380 | + public static String[] toStrArray(String split, String str) | |
381 | + { | |
382 | + return str.split(split); | |
383 | + } | |
384 | + | |
385 | + /** | |
386 | + * 转换为long<br> | |
387 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
388 | + * 转换失败不会报错 | |
389 | + * | |
390 | + * @param value 被转换的值 | |
391 | + * @param defaultValue 转换错误时的默认值 | |
392 | + * @return 结果 | |
393 | + */ | |
394 | + public static long toLong(Object value, Integer defaultValue) | |
395 | + { | |
396 | + if (value == null) | |
397 | + { | |
398 | + return defaultValue; | |
399 | + } | |
400 | + if (value instanceof Integer) | |
401 | + { | |
402 | + return (Integer) value; | |
403 | + } | |
404 | + if (value instanceof Number) | |
405 | + { | |
406 | + return ((Number) value).longValue(); | |
407 | + } | |
408 | + final String valueStr = toStr(value, null); | |
409 | + if (StringUtils.isEmpty(valueStr)) | |
410 | + { | |
411 | + return defaultValue; | |
412 | + } | |
413 | + try | |
414 | + { | |
415 | + // 支持科学计数法 | |
416 | + return new BigDecimal(valueStr.trim()).longValue(); | |
417 | + } | |
418 | + catch (Exception e) | |
419 | + { | |
420 | + return defaultValue; | |
421 | + } | |
422 | + } | |
423 | + | |
424 | + /** | |
425 | + * 转换为long<br> | |
426 | + * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> | |
427 | + * 转换失败不会报错 | |
428 | + * | |
429 | + * @param value 被转换的值 | |
430 | + * @return 结果 | |
431 | + */ | |
432 | + public static Long toLong(Object value) | |
433 | + { | |
434 | + return toLong(value, null); | |
435 | + } | |
436 | + | |
437 | + /** | |
438 | + * 转换为double<br> | |
439 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
440 | + * 转换失败不会报错 | |
441 | + * | |
442 | + * @param value 被转换的值 | |
443 | + * @param defaultValue 转换错误时的默认值 | |
444 | + * @return 结果 | |
445 | + */ | |
446 | + public static Double toDouble(Object value, Double defaultValue) | |
447 | + { | |
448 | + if (value == null) | |
449 | + { | |
450 | + return defaultValue; | |
451 | + } | |
452 | + if (value instanceof Double) | |
453 | + { | |
454 | + return (Double) value; | |
455 | + } | |
456 | + if (value instanceof Number) | |
457 | + { | |
458 | + return ((Number) value).doubleValue(); | |
459 | + } | |
460 | + final String valueStr = toStr(value, null); | |
461 | + if (StringUtils.isEmpty(valueStr)) | |
462 | + { | |
463 | + return defaultValue; | |
464 | + } | |
465 | + try | |
466 | + { | |
467 | + // 支持科学计数法 | |
468 | + return new BigDecimal(valueStr.trim()).doubleValue(); | |
469 | + } | |
470 | + catch (Exception e) | |
471 | + { | |
472 | + return defaultValue; | |
473 | + } | |
474 | + } | |
475 | + | |
476 | + /** | |
477 | + * 转换为double<br> | |
478 | + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> | |
479 | + * 转换失败不会报错 | |
480 | + * | |
481 | + * @param value 被转换的值 | |
482 | + * @return 结果 | |
483 | + */ | |
484 | + public static Double toDouble(Object value) | |
485 | + { | |
486 | + return toDouble(value, null); | |
487 | + } | |
488 | + | |
489 | + /** | |
490 | + * 转换为Float<br> | |
491 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
492 | + * 转换失败不会报错 | |
493 | + * | |
494 | + * @param value 被转换的值 | |
495 | + * @param defaultValue 转换错误时的默认值 | |
496 | + * @return 结果 | |
497 | + */ | |
498 | + public static Float toFloat(Object value, Float defaultValue) | |
499 | + { | |
500 | + if (value == null) | |
501 | + { | |
502 | + return defaultValue; | |
503 | + } | |
504 | + if (value instanceof Float) | |
505 | + { | |
506 | + return (Float) value; | |
507 | + } | |
508 | + if (value instanceof Number) | |
509 | + { | |
510 | + return ((Number) value).floatValue(); | |
511 | + } | |
512 | + final String valueStr = toStr(value, null); | |
513 | + if (StringUtils.isEmpty(valueStr)) | |
514 | + { | |
515 | + return defaultValue; | |
516 | + } | |
517 | + try | |
518 | + { | |
519 | + return Float.parseFloat(valueStr.trim()); | |
520 | + } | |
521 | + catch (Exception e) | |
522 | + { | |
523 | + return defaultValue; | |
524 | + } | |
525 | + } | |
526 | + | |
527 | + /** | |
528 | + * 转换为Float<br> | |
529 | + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> | |
530 | + * 转换失败不会报错 | |
531 | + * | |
532 | + * @param value 被转换的值 | |
533 | + * @return 结果 | |
534 | + */ | |
535 | + public static Float toFloat(Object value) | |
536 | + { | |
537 | + return toFloat(value, null); | |
538 | + } | |
539 | + | |
540 | + /** | |
541 | + * 转换为boolean<br> | |
542 | + * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br> | |
543 | + * 转换失败不会报错 | |
544 | + * | |
545 | + * @param value 被转换的值 | |
546 | + * @param defaultValue 转换错误时的默认值 | |
547 | + * @return 结果 | |
548 | + */ | |
549 | + public static Boolean toBool(Object value, Boolean defaultValue) | |
550 | + { | |
551 | + if (value == null) | |
552 | + { | |
553 | + return defaultValue; | |
554 | + } | |
555 | + if (value instanceof Boolean) | |
556 | + { | |
557 | + return (Boolean) value; | |
558 | + } | |
559 | + String valueStr = toStr(value, null); | |
560 | + if (StringUtils.isEmpty(valueStr)) | |
561 | + { | |
562 | + return defaultValue; | |
563 | + } | |
564 | + valueStr = valueStr.trim().toLowerCase(); | |
565 | + switch (valueStr) | |
566 | + { | |
567 | + case "true": | |
568 | + return true; | |
569 | + case "false": | |
570 | + return false; | |
571 | + case "yes": | |
572 | + return true; | |
573 | + case "ok": | |
574 | + return true; | |
575 | + case "no": | |
576 | + return false; | |
577 | + case "1": | |
578 | + return true; | |
579 | + case "0": | |
580 | + return false; | |
581 | + default: | |
582 | + return defaultValue; | |
583 | + } | |
584 | + } | |
585 | + | |
586 | + /** | |
587 | + * 转换为boolean<br> | |
588 | + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> | |
589 | + * 转换失败不会报错 | |
590 | + * | |
591 | + * @param value 被转换的值 | |
592 | + * @return 结果 | |
593 | + */ | |
594 | + public static Boolean toBool(Object value) | |
595 | + { | |
596 | + return toBool(value, null); | |
597 | + } | |
598 | + | |
599 | + /** | |
600 | + * 转换为Enum对象<br> | |
601 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
602 | + * | |
603 | + * @param clazz Enum的Class | |
604 | + * @param value 值 | |
605 | + * @param defaultValue 默认值 | |
606 | + * @return Enum | |
607 | + */ | |
608 | + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) | |
609 | + { | |
610 | + if (value == null) | |
611 | + { | |
612 | + return defaultValue; | |
613 | + } | |
614 | + if (clazz.isAssignableFrom(value.getClass())) | |
615 | + { | |
616 | + @SuppressWarnings("unchecked") | |
617 | + E myE = (E) value; | |
618 | + return myE; | |
619 | + } | |
620 | + final String valueStr = toStr(value, null); | |
621 | + if (StringUtils.isEmpty(valueStr)) | |
622 | + { | |
623 | + return defaultValue; | |
624 | + } | |
625 | + try | |
626 | + { | |
627 | + return Enum.valueOf(clazz, valueStr); | |
628 | + } | |
629 | + catch (Exception e) | |
630 | + { | |
631 | + return defaultValue; | |
632 | + } | |
633 | + } | |
634 | + | |
635 | + /** | |
636 | + * 转换为Enum对象<br> | |
637 | + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> | |
638 | + * | |
639 | + * @param clazz Enum的Class | |
640 | + * @param value 值 | |
641 | + * @return Enum | |
642 | + */ | |
643 | + public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) | |
644 | + { | |
645 | + return toEnum(clazz, value, null); | |
646 | + } | |
647 | + | |
648 | + /** | |
649 | + * 转换为BigInteger<br> | |
650 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
651 | + * 转换失败不会报错 | |
652 | + * | |
653 | + * @param value 被转换的值 | |
654 | + * @param defaultValue 转换错误时的默认值 | |
655 | + * @return 结果 | |
656 | + */ | |
657 | + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) | |
658 | + { | |
659 | + if (value == null) | |
660 | + { | |
661 | + return defaultValue; | |
662 | + } | |
663 | + if (value instanceof BigInteger) | |
664 | + { | |
665 | + return (BigInteger) value; | |
666 | + } | |
667 | + if (value instanceof Integer) | |
668 | + { | |
669 | + return BigInteger.valueOf((Integer) value); | |
670 | + } | |
671 | + final String valueStr = toStr(value, null); | |
672 | + if (StringUtils.isEmpty(valueStr)) | |
673 | + { | |
674 | + return defaultValue; | |
675 | + } | |
676 | + try | |
677 | + { | |
678 | + return new BigInteger(valueStr); | |
679 | + } | |
680 | + catch (Exception e) | |
681 | + { | |
682 | + return defaultValue; | |
683 | + } | |
684 | + } | |
685 | + | |
686 | + /** | |
687 | + * 转换为BigInteger<br> | |
688 | + * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> | |
689 | + * 转换失败不会报错 | |
690 | + * | |
691 | + * @param value 被转换的值 | |
692 | + * @return 结果 | |
693 | + */ | |
694 | + public static BigInteger toBigInteger(Object value) | |
695 | + { | |
696 | + return toBigInteger(value, null); | |
697 | + } | |
698 | + | |
699 | + /** | |
700 | + * 转换为BigDecimal<br> | |
701 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
702 | + * 转换失败不会报错 | |
703 | + * | |
704 | + * @param value 被转换的值 | |
705 | + * @param defaultValue 转换错误时的默认值 | |
706 | + * @return 结果 | |
707 | + */ | |
708 | + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) | |
709 | + { | |
710 | + if (value == null) | |
711 | + { | |
712 | + return defaultValue; | |
713 | + } | |
714 | + if (value instanceof BigDecimal) | |
715 | + { | |
716 | + return (BigDecimal) value; | |
717 | + } | |
718 | + if (value instanceof Integer) | |
719 | + { | |
720 | + return new BigDecimal((Integer) value); | |
721 | + } | |
722 | + if (value instanceof Double) | |
723 | + { | |
724 | + return new BigDecimal((Double) value); | |
725 | + } | |
726 | + if (value instanceof Integer) | |
727 | + { | |
728 | + return new BigDecimal((Integer) value); | |
729 | + } | |
730 | + final String valueStr = toStr(value, null); | |
731 | + if (StringUtils.isEmpty(valueStr)) | |
732 | + { | |
733 | + return defaultValue; | |
734 | + } | |
735 | + try | |
736 | + { | |
737 | + return new BigDecimal(valueStr); | |
738 | + } | |
739 | + catch (Exception e) | |
740 | + { | |
741 | + return defaultValue; | |
742 | + } | |
743 | + } | |
744 | + | |
745 | + /** | |
746 | + * 转换为BigDecimal<br> | |
747 | + * 如果给定的值为空,或者转换失败,返回默认值<br> | |
748 | + * 转换失败不会报错 | |
749 | + * | |
750 | + * @param value 被转换的值 | |
751 | + * @return 结果 | |
752 | + */ | |
753 | + public static BigDecimal toBigDecimal(Object value) | |
754 | + { | |
755 | + return toBigDecimal(value, null); | |
756 | + } | |
757 | + | |
758 | + /** | |
759 | + * 将对象转为字符串<br> | |
760 | + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 | |
761 | + * | |
762 | + * @param obj 对象 | |
763 | + * @return 字符串 | |
764 | + */ | |
765 | + public static String utf8Str(Object obj) | |
766 | + { | |
767 | + return str(obj, CharsetKit.CHARSET_UTF_8); | |
768 | + } | |
769 | + | |
770 | + /** | |
771 | + * 将对象转为字符串<br> | |
772 | + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 | |
773 | + * | |
774 | + * @param obj 对象 | |
775 | + * @param charsetName 字符集 | |
776 | + * @return 字符串 | |
777 | + */ | |
778 | + public static String str(Object obj, String charsetName) | |
779 | + { | |
780 | + return str(obj, Charset.forName(charsetName)); | |
781 | + } | |
782 | + | |
783 | + /** | |
784 | + * 将对象转为字符串<br> | |
785 | + * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 | |
786 | + * | |
787 | + * @param obj 对象 | |
788 | + * @param charset 字符集 | |
789 | + * @return 字符串 | |
790 | + */ | |
791 | + public static String str(Object obj, Charset charset) | |
792 | + { | |
793 | + if (null == obj) | |
794 | + { | |
795 | + return null; | |
796 | + } | |
797 | + | |
798 | + if (obj instanceof String) | |
799 | + { | |
800 | + return (String) obj; | |
801 | + } | |
802 | + else if (obj instanceof byte[] || obj instanceof Byte[]) | |
803 | + { | |
804 | + return str((Byte[]) obj, charset); | |
805 | + } | |
806 | + else if (obj instanceof ByteBuffer) | |
807 | + { | |
808 | + return str((ByteBuffer) obj, charset); | |
809 | + } | |
810 | + return obj.toString(); | |
811 | + } | |
812 | + | |
813 | + /** | |
814 | + * 将byte数组转为字符串 | |
815 | + * | |
816 | + * @param bytes byte数组 | |
817 | + * @param charset 字符集 | |
818 | + * @return 字符串 | |
819 | + */ | |
820 | + public static String str(byte[] bytes, String charset) | |
821 | + { | |
822 | + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); | |
823 | + } | |
824 | + | |
825 | + /** | |
826 | + * 解码字节码 | |
827 | + * | |
828 | + * @param data 字符串 | |
829 | + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 | |
830 | + * @return 解码后的字符串 | |
831 | + */ | |
832 | + public static String str(byte[] data, Charset charset) | |
833 | + { | |
834 | + if (data == null) | |
835 | + { | |
836 | + return null; | |
837 | + } | |
838 | + | |
839 | + if (null == charset) | |
840 | + { | |
841 | + return new String(data); | |
842 | + } | |
843 | + return new String(data, charset); | |
844 | + } | |
845 | + | |
846 | + /** | |
847 | + * 将编码的byteBuffer数据转换为字符串 | |
848 | + * | |
849 | + * @param data 数据 | |
850 | + * @param charset 字符集,如果为空使用当前系统字符集 | |
851 | + * @return 字符串 | |
852 | + */ | |
853 | + public static String str(ByteBuffer data, String charset) | |
854 | + { | |
855 | + if (data == null) | |
856 | + { | |
857 | + return null; | |
858 | + } | |
859 | + | |
860 | + return str(data, Charset.forName(charset)); | |
861 | + } | |
862 | + | |
863 | + /** | |
864 | + * 将编码的byteBuffer数据转换为字符串 | |
865 | + * | |
866 | + * @param data 数据 | |
867 | + * @param charset 字符集,如果为空使用当前系统字符集 | |
868 | + * @return 字符串 | |
869 | + */ | |
870 | + public static String str(ByteBuffer data, Charset charset) | |
871 | + { | |
872 | + if (null == charset) | |
873 | + { | |
874 | + charset = Charset.defaultCharset(); | |
875 | + } | |
876 | + return charset.decode(data).toString(); | |
877 | + } | |
878 | + | |
879 | + // ----------------------------------------------------------------------- 全角半角转换 | |
880 | + /** | |
881 | + * 半角转全角 | |
882 | + * | |
883 | + * @param input String. | |
884 | + * @return 全角字符串. | |
885 | + */ | |
886 | + public static String toSBC(String input) | |
887 | + { | |
888 | + return toSBC(input, null); | |
889 | + } | |
890 | + | |
891 | + /** | |
892 | + * 半角转全角 | |
893 | + * | |
894 | + * @param input String | |
895 | + * @param notConvertSet 不替换的字符集合 | |
896 | + * @return 全角字符串. | |
897 | + */ | |
898 | + public static String toSBC(String input, Set<Character> notConvertSet) | |
899 | + { | |
900 | + char c[] = input.toCharArray(); | |
901 | + for (int i = 0; i < c.length; i++) | |
902 | + { | |
903 | + if (null != notConvertSet && notConvertSet.contains(c[i])) | |
904 | + { | |
905 | + // 跳过不替换的字符 | |
906 | + continue; | |
907 | + } | |
908 | + | |
909 | + if (c[i] == ' ') | |
910 | + { | |
911 | + c[i] = '\u3000'; | |
912 | + } | |
913 | + else if (c[i] < '\177') | |
914 | + { | |
915 | + c[i] = (char) (c[i] + 65248); | |
916 | + | |
917 | + } | |
918 | + } | |
919 | + return new String(c); | |
920 | + } | |
921 | + | |
922 | + /** | |
923 | + * 全角转半角 | |
924 | + * | |
925 | + * @param input String. | |
926 | + * @return 半角字符串 | |
927 | + */ | |
928 | + public static String toDBC(String input) | |
929 | + { | |
930 | + return toDBC(input, null); | |
931 | + } | |
932 | + | |
933 | + /** | |
934 | + * 替换全角为半角 | |
935 | + * | |
936 | + * @param text 文本 | |
937 | + * @param notConvertSet 不替换的字符集合 | |
938 | + * @return 替换后的字符 | |
939 | + */ | |
940 | + public static String toDBC(String text, Set<Character> notConvertSet) | |
941 | + { | |
942 | + char c[] = text.toCharArray(); | |
943 | + for (int i = 0; i < c.length; i++) | |
944 | + { | |
945 | + if (null != notConvertSet && notConvertSet.contains(c[i])) | |
946 | + { | |
947 | + // 跳过不替换的字符 | |
948 | + continue; | |
949 | + } | |
950 | + | |
951 | + if (c[i] == '\u3000') | |
952 | + { | |
953 | + c[i] = ' '; | |
954 | + } | |
955 | + else if (c[i] > '\uFF00' && c[i] < '\uFF5F') | |
956 | + { | |
957 | + c[i] = (char) (c[i] - 65248); | |
958 | + } | |
959 | + } | |
960 | + String returnString = new String(c); | |
961 | + | |
962 | + return returnString; | |
963 | + } | |
964 | + | |
965 | + /** | |
966 | + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 | |
967 | + * | |
968 | + * @param n 数字 | |
969 | + * @return 中文大写数字 | |
970 | + */ | |
971 | + public static String digitUppercase(double n) | |
972 | + { | |
973 | + String[] fraction = { "角", "分" }; | |
974 | + String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; | |
975 | + String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; | |
976 | + | |
977 | + String head = n < 0 ? "负" : ""; | |
978 | + n = Math.abs(n); | |
979 | + | |
980 | + String s = ""; | |
981 | + for (int i = 0; i < fraction.length; i++) | |
982 | + { | |
983 | + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); | |
984 | + } | |
985 | + if (s.length() < 1) | |
986 | + { | |
987 | + s = "整"; | |
988 | + } | |
989 | + int integerPart = (int) Math.floor(n); | |
990 | + | |
991 | + for (int i = 0; i < unit[0].length && integerPart > 0; i++) | |
992 | + { | |
993 | + String p = ""; | |
994 | + for (int j = 0; j < unit[1].length && n > 0; j++) | |
995 | + { | |
996 | + p = digit[integerPart % 10] + unit[1][j] + p; | |
997 | + integerPart = integerPart / 10; | |
998 | + } | |
999 | + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; | |
1000 | + } | |
1001 | + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", | |
1002 | + "零元整"); | |
1003 | + } | |
1004 | + | |
1005 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/ServletUtils.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework; | |
2 | + | |
3 | +import org.jeecg.utils.StringUtils; | |
4 | +import org.springframework.web.context.request.RequestAttributes; | |
5 | +import org.springframework.web.context.request.RequestContextHolder; | |
6 | +import org.springframework.web.context.request.ServletRequestAttributes; | |
7 | + | |
8 | +import javax.servlet.http.HttpServletRequest; | |
9 | +import javax.servlet.http.HttpServletResponse; | |
10 | +import javax.servlet.http.HttpSession; | |
11 | +import java.io.IOException; | |
12 | + | |
13 | +/** | |
14 | + * 客户端工具类 | |
15 | + * | |
16 | + * @author huaheng | |
17 | + */ | |
18 | +public class ServletUtils | |
19 | +{ | |
20 | + /** | |
21 | + * 获取String参数 | |
22 | + */ | |
23 | + public static String getParameter(String name) | |
24 | + { | |
25 | + return getRequest().getParameter(name); | |
26 | + } | |
27 | + | |
28 | + /** | |
29 | + * 获取String参数 | |
30 | + */ | |
31 | + public static String getParameter(String name, String defaultValue) | |
32 | + { | |
33 | + return Convert.toStr(getRequest().getParameter(name), defaultValue); | |
34 | + } | |
35 | + | |
36 | + /** | |
37 | + * 获取Integer参数 | |
38 | + */ | |
39 | + public static Integer getParameterToInt(String name) | |
40 | + { | |
41 | + return Convert.toInt(getRequest().getParameter(name)); | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * 获取Integer参数 | |
46 | + */ | |
47 | + public static Integer getParameterToInt(String name, Integer defaultValue) | |
48 | + { | |
49 | + return Convert.toInt(getRequest().getParameter(name), defaultValue); | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * 获取request | |
54 | + */ | |
55 | + public static HttpServletRequest getRequest() | |
56 | + { | |
57 | + return getRequestAttributes().getRequest(); | |
58 | + } | |
59 | + | |
60 | + /** | |
61 | + * 获取response | |
62 | + */ | |
63 | + public static HttpServletResponse getResponse() | |
64 | + { | |
65 | + return getRequestAttributes().getResponse(); | |
66 | + } | |
67 | + | |
68 | + /** | |
69 | + * 获取session | |
70 | + */ | |
71 | + public static HttpSession getSession() | |
72 | + { | |
73 | + return getRequest().getSession(); | |
74 | + } | |
75 | + | |
76 | + public static ServletRequestAttributes getRequestAttributes() | |
77 | + { | |
78 | + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); | |
79 | + return (ServletRequestAttributes) attributes; | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * 将字符串渲染到客户端 | |
84 | + * | |
85 | + * @param response 渲染对象 | |
86 | + * @param string 待渲染的字符串 | |
87 | + * @return null | |
88 | + */ | |
89 | + public static String renderString(HttpServletResponse response, String string) | |
90 | + { | |
91 | + try | |
92 | + { | |
93 | + response.setContentType("application/json"); | |
94 | + response.setCharacterEncoding("utf-8"); | |
95 | + response.getWriter().print(string); | |
96 | + } | |
97 | + catch (IOException e) | |
98 | + { | |
99 | + e.printStackTrace(); | |
100 | + } | |
101 | + return null; | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 是否是Ajax异步请求 | |
106 | + * | |
107 | + * @param request | |
108 | + */ | |
109 | + public static boolean isAjaxRequest(HttpServletRequest request) | |
110 | + { | |
111 | + | |
112 | + String accept = request.getHeader("accept"); | |
113 | + if (accept != null && accept.indexOf("application/json") != -1) | |
114 | + { | |
115 | + return true; | |
116 | + } | |
117 | + | |
118 | + String contentType = request.getHeader("Content-Type"); | |
119 | + if (contentType != null && contentType.indexOf("application/json") != -1) | |
120 | + { | |
121 | + return true; | |
122 | + } | |
123 | + | |
124 | + String xRequestedWith = request.getHeader("X-Requested-With"); | |
125 | + if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) | |
126 | + { | |
127 | + return true; | |
128 | + } | |
129 | + | |
130 | + String uri = request.getRequestURI(); | |
131 | + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) | |
132 | + { | |
133 | + return true; | |
134 | + } | |
135 | + | |
136 | + String ajax = request.getParameter("__ajax"); | |
137 | + if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) | |
138 | + { | |
139 | + return true; | |
140 | + } | |
141 | + | |
142 | + return false; | |
143 | + } | |
144 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/ApiLogAspect.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSON; | |
4 | +import com.alibaba.fastjson.JSONObject; | |
5 | +import okhttp3.Request; | |
6 | +import okhttp3.Response; | |
7 | +import org.apache.commons.lang.exception.ExceptionUtils; | |
8 | +import org.aspectj.lang.ProceedingJoinPoint; | |
9 | +import org.aspectj.lang.annotation.Around; | |
10 | +import org.aspectj.lang.annotation.Aspect; | |
11 | +import org.aspectj.lang.annotation.Pointcut; | |
12 | +import org.aspectj.lang.reflect.MethodSignature; | |
13 | +import org.jeecg.common.api.vo.Result; | |
14 | +import org.jeecg.modules.wms.config.address.entity.Address; | |
15 | +import org.jeecg.modules.wms.config.address.service.IAddressService; | |
16 | +import org.jeecg.modules.wms.framework.ServletUtils; | |
17 | +import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | |
18 | +import org.jeecg.modules.wms.framework.spring.SpringUtils; | |
19 | +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | |
20 | +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; | |
21 | +import org.jeecg.utils.StringUtils; | |
22 | +import org.jeecg.utils.constant.QuantityConstant; | |
23 | +import org.slf4j.Logger; | |
24 | +import org.slf4j.LoggerFactory; | |
25 | +import org.springframework.beans.factory.annotation.Autowired; | |
26 | +import org.springframework.http.HttpHeaders; | |
27 | +import org.springframework.scheduling.annotation.Async; | |
28 | +import org.springframework.scheduling.annotation.EnableAsync; | |
29 | +import org.springframework.stereotype.Component; | |
30 | +import org.springframework.web.context.request.RequestContextHolder; | |
31 | +import org.springframework.web.context.request.ServletRequestAttributes; | |
32 | + | |
33 | +import javax.servlet.http.HttpServletRequest; | |
34 | +import javax.servlet.http.HttpServletResponse; | |
35 | +import java.net.HttpURLConnection; | |
36 | +import java.net.URL; | |
37 | +import java.util.*; | |
38 | + | |
39 | +/** | |
40 | + * Api调用日志记录处理 | |
41 | + * | |
42 | + * @author huaheng | |
43 | + */ | |
44 | +@Aspect | |
45 | +@Component | |
46 | +@EnableAsync | |
47 | +public class ApiLogAspect | |
48 | +{ | |
49 | + private static final Logger log = LoggerFactory.getLogger(ApiLogAspect.class); | |
50 | + | |
51 | + private static IApiLogService apiLogService; | |
52 | + | |
53 | + private static IAddressService addressService; | |
54 | + | |
55 | + | |
56 | + @Autowired | |
57 | + public void setApiLogService(IApiLogService apiLogService){ | |
58 | + ApiLogAspect.apiLogService = apiLogService; | |
59 | + } | |
60 | + | |
61 | + @Autowired | |
62 | + public void setAddressService(IAddressService addressService){ | |
63 | + ApiLogAspect.addressService = addressService; | |
64 | + } | |
65 | + | |
66 | + // 配置织入点 | |
67 | + @Pointcut("@annotation(org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger)") | |
68 | + public void logPointCut() | |
69 | + { | |
70 | + } | |
71 | + | |
72 | + @Around("logPointCut() && @annotation(apiLogger)") | |
73 | + public Object around(ProceedingJoinPoint point, ApiLogger apiLogger) throws Throwable | |
74 | + { | |
75 | + if("WMS".equalsIgnoreCase(apiLogger.from())) | |
76 | + //实际上静态方法上的Aop注解无法拦截到 | |
77 | + { | |
78 | + return aroundWms2XXX(point, apiLogger); | |
79 | + } else { | |
80 | + return aroundXXX2Wms(point, apiLogger); | |
81 | + } | |
82 | + } | |
83 | + | |
84 | + /**处理xxx调用wms接口的日志**/ | |
85 | + private Object aroundXXX2Wms(ProceedingJoinPoint point, ApiLogger apiLogger){ | |
86 | + Object ret = null; | |
87 | + ApiLog log = initApiLog(apiLogger, point); | |
88 | + try{ | |
89 | + ret = point.proceed(); | |
90 | + }catch (Exception e){ | |
91 | + setApiLogException(log, e); | |
92 | + ret = Result.error(e.getMessage()); | |
93 | + }finally{ | |
94 | + finishApiLog(log, ret); | |
95 | + return ret; | |
96 | + } | |
97 | + } | |
98 | + | |
99 | + /**处理WMS调用xxx接口的日志**/ | |
100 | + private Object aroundWms2XXX(ProceedingJoinPoint point, ApiLogger apiLogger){ | |
101 | + Object ret = null; | |
102 | + ApiLog log = new ApiLog(); | |
103 | + | |
104 | + HttpURLConnection connection = null; | |
105 | + String body = null; | |
106 | + | |
107 | + try { | |
108 | + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); | |
109 | + connection = (HttpURLConnection) point.getArgs()[0]; | |
110 | + body = (String) point.getArgs()[1]; | |
111 | + initApiLog(connection, body); | |
112 | + }catch (Exception e){ | |
113 | + | |
114 | + } | |
115 | + | |
116 | + try{ | |
117 | + ret = point.proceed(); | |
118 | + }catch (Exception e){ | |
119 | + setApiLogException(log, e); | |
120 | + throw e; | |
121 | + }finally{ | |
122 | + if(ret != null) { | |
123 | + finishApiLog(log, connection, ret.toString()); | |
124 | + } | |
125 | + return ret; | |
126 | + } | |
127 | + } | |
128 | + | |
129 | + /** | |
130 | + * 记录响应头信息 | |
131 | + **/ | |
132 | + public static void finishApiLog(ApiLog log, HttpURLConnection connection, String body) { | |
133 | + try { | |
134 | + log.setResponseBody(body); | |
135 | + log.setResponseTime(new Date()); | |
136 | + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); | |
137 | + log.setDuration(duration.intValue()); | |
138 | + log.setHttpCode(connection.getResponseCode()); | |
139 | + | |
140 | + //响应头 | |
141 | + Set<String> keyset = connection.getHeaderFields().keySet(); | |
142 | + ArrayList<String> headerList = new ArrayList<>(); | |
143 | + Iterator<String> it = keyset.iterator(); | |
144 | + while (it.hasNext()) { | |
145 | + String name = it.next(); | |
146 | + String header = connection.getHeaderField(name); | |
147 | + if (name == null || "".equals(name)) { | |
148 | + //第一行没有name | |
149 | + //HTTP/1.1 200 OK | |
150 | + headerList.add(header); | |
151 | + } | |
152 | + else { | |
153 | + headerList.add(name + ": " + header); | |
154 | + } | |
155 | + } | |
156 | + log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); | |
157 | + Result json = JSON.parseObject(body, Result.class); | |
158 | + log.setRetCode(json.getCode()); | |
159 | + } catch (Exception e) { | |
160 | + e.printStackTrace(); | |
161 | + } finally { | |
162 | + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log); | |
163 | + } | |
164 | + } | |
165 | + | |
166 | + /** | |
167 | + * 根据url,从address表中判断调用的去向 | |
168 | + **/ | |
169 | + public static void parseUrl(ApiLog log, URL url, String warehouseCode) { | |
170 | + try { | |
171 | + String[] spList = url.toString().split("/"); | |
172 | + String apiName = spList[spList.length - 1]; | |
173 | + int index = url.toString().lastIndexOf(apiName); | |
174 | + String addUrl = url.toString().substring(0, index); | |
175 | + | |
176 | + Address address = addressService.getAddressByUrl(url.toString(), warehouseCode); | |
177 | + log.setApiName(apiName); | |
178 | + log.setRequestFrom("WMS"); | |
179 | + log.setResponseBy(address.getCode().toUpperCase()); | |
180 | + } catch (Exception e) { | |
181 | + e.printStackTrace(); | |
182 | + } | |
183 | + } | |
184 | + | |
185 | + | |
186 | + /** | |
187 | + * 记录WMS调用外接口的请求信息 | |
188 | + * 在HttpUtils.bodypost方法中直接调用本类static方法 | |
189 | + **/ | |
190 | + public static ApiLog initApiLog(String Method, String url, String body, HttpHeaders headers, String warehouseCode) { | |
191 | + ApiLog log = new ApiLog(); | |
192 | + try { | |
193 | + URL url1 = new URL(url); | |
194 | + log.setApiMethod(Method); | |
195 | + log.setUrl(url); | |
196 | + log.setRequestTime(new Date()); | |
197 | + parseUrl(log, url1, warehouseCode); | |
198 | + | |
199 | + //请求头 | |
200 | + Set<String> keySet = headers.keySet(); | |
201 | + ArrayList<String> headerList = new ArrayList<>(); | |
202 | + Iterator<String> it = keySet.iterator(); | |
203 | + while (it.hasNext()) { | |
204 | + String name = it.next(); | |
205 | + String header = String.valueOf(headers.getContentType()); | |
206 | + headerList.add(name + ": " + header); | |
207 | + } | |
208 | + | |
209 | + log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); | |
210 | + log.setRequestBody(body); | |
211 | + } catch (Exception e) { | |
212 | + e.printStackTrace(); | |
213 | + } | |
214 | + | |
215 | + return log; | |
216 | + } | |
217 | + | |
218 | + /**记录WMS调用外接口的请求信息 | |
219 | + * 在HttpUtils.bodypost方法中直接调用本类static方法**/ | |
220 | + public static ApiLog initApiLog(HttpURLConnection connection, String body){ | |
221 | + ApiLog log = new ApiLog(); | |
222 | + try { | |
223 | + log.setApiMethod(connection.getRequestMethod()); | |
224 | + log.setUrl(connection.getURL().toString()); | |
225 | + log.setRequestTime(new Date()); | |
226 | + parseUrl(log, connection.getURL()); | |
227 | + | |
228 | + //请求头 | |
229 | + Set<String> keySet = connection.getRequestProperties().keySet(); | |
230 | + ArrayList<String> headerList = new ArrayList<>(); | |
231 | + Iterator<String> it = keySet.iterator(); | |
232 | + while (it.hasNext()) { | |
233 | + String name = it.next(); | |
234 | + String header = connection.getRequestProperty(name); | |
235 | + headerList.add(name + ": " + header); | |
236 | + } | |
237 | + | |
238 | + log.setRequestHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); | |
239 | + log.setRequestBody(body); | |
240 | + }catch (Exception e){ | |
241 | + e.printStackTrace(); | |
242 | + } | |
243 | + | |
244 | + return log; | |
245 | + } | |
246 | + | |
247 | + /**记录WMS调用外接口的请求信息 | |
248 | + * 在HttpUtils.bodypost方法中直接调用本类static方法**/ | |
249 | + public static ApiLog initApiLog(Request request, String body){ | |
250 | + ApiLog log = new ApiLog(); | |
251 | + try { | |
252 | + log.setApiMethod(request.method()); | |
253 | + log.setUrl(request.url().toString()); | |
254 | + log.setRequestTime(new Date()); | |
255 | + parseUrl(log, request.url().url()); | |
256 | + log.setRequestHeader(request.headers().toString()); | |
257 | + log.setRequestBody(body); | |
258 | + }catch (Exception e){ | |
259 | + e.printStackTrace(); | |
260 | + } | |
261 | + return log; | |
262 | + } | |
263 | + | |
264 | + /**记录响应头信息**/ | |
265 | + public static void finishApiLog(ApiLog log, Response response, String body){ | |
266 | + try { | |
267 | + log.setResponseBody(body); | |
268 | + log.setResponseTime(new Date()); | |
269 | + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); | |
270 | + log.setDuration(duration.intValue()); | |
271 | + log.setHttpCode(response.code()); | |
272 | + | |
273 | + //响应头 | |
274 | + log.setResponseHeader(response.headers().toString()); | |
275 | + Result ajaxResult = null; | |
276 | + try{ | |
277 | + ajaxResult = JSON.parseObject(body, Result.class); | |
278 | + }catch(Exception ex){ | |
279 | + body = JSON.parse(body).toString(); | |
280 | + ajaxResult = JSON.parseObject(body, Result.class); | |
281 | + } | |
282 | + log.setRetCode(ajaxResult.getCode()); | |
283 | + }catch (Exception e){ | |
284 | + e.printStackTrace(); | |
285 | + }finally { | |
286 | + try { | |
287 | + if (StringUtils.isNotEmpty(log.getResponseBody()) && log.getResponseBody().length() > 2001) { | |
288 | + log.setResponseBody(log.getResponseBody().substring(0, 2000) + "\n太长了...后面省略。\n" + log.getResponseBody().length()); | |
289 | + } | |
290 | + }catch (Exception e){ | |
291 | + | |
292 | + } | |
293 | + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log); | |
294 | + } | |
295 | + } | |
296 | + | |
297 | + | |
298 | + | |
299 | + /**根据url,从address表中判断调用的去向**/ | |
300 | + public static void parseUrl(ApiLog log, URL url){ | |
301 | + try { | |
302 | + String[] spList = url.toString().split("/"); | |
303 | + String apiName = spList[spList.length - 1]; | |
304 | + int index = url.toString().lastIndexOf(apiName); | |
305 | + String addUrl = url.toString().substring(0, index); | |
306 | + | |
307 | + Address address = addressService.getAddressByUrl(url.toString(), QuantityConstant.DEFAULT_WAREHOUSE); | |
308 | + log.setApiName(apiName); | |
309 | + log.setRequestFrom("WMS"); | |
310 | + log.setResponseBy(address.getCode().toUpperCase()); | |
311 | + }catch (Exception e){ | |
312 | + e.printStackTrace(); | |
313 | + } | |
314 | + } | |
315 | + /** | |
316 | + * 记录响应头信息 | |
317 | + **/ | |
318 | + public static void finishApiLog(ApiLog log, HttpHeaders headers, String body) { | |
319 | + try { | |
320 | + log.setResponseBody(body); | |
321 | + log.setResponseTime(new Date()); | |
322 | + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); | |
323 | + log.setDuration(duration.intValue()); | |
324 | + log.setHttpCode(200); | |
325 | + | |
326 | + //响应头 | |
327 | + Set<String> keyset = headers.keySet(); | |
328 | + ArrayList<String> headerList = new ArrayList<>(); | |
329 | + Iterator<String> it = keyset.iterator(); | |
330 | + while (it.hasNext()) { | |
331 | + String name = it.next(); | |
332 | + String header = String.valueOf(headers.getContentType()); | |
333 | + if (name == null || "".equals(name)) | |
334 | + //第一行没有name | |
335 | + //HTTP/1.1 200 OK | |
336 | + headerList.add(header); | |
337 | + else | |
338 | + headerList.add(name + ": " + header); | |
339 | + } | |
340 | + log.setResponseHeader(org.apache.commons.lang3.StringUtils.join(headerList, "\n")); | |
341 | + Result json = JSON.parseObject(body, Result.class); | |
342 | + log.setRetCode(json.getCode()); | |
343 | + } catch (Exception e) { | |
344 | + e.printStackTrace(); | |
345 | + } finally { | |
346 | + SpringUtils.getBean(ApiLogAspect.class).saveApiLog(log); | |
347 | + } | |
348 | + } | |
349 | + | |
350 | + | |
351 | + private ApiLog initApiLog(ApiLogger apiLogger, ProceedingJoinPoint point){ | |
352 | + ApiLog log = new ApiLog(); | |
353 | + try{ | |
354 | + log.setRequestTime(new Date()); | |
355 | + log.setRequestFrom(apiLogger.from()); | |
356 | + log.setResponseBy(apiLogger.to()); | |
357 | + log.setApiName(apiLogger.apiName()); | |
358 | + | |
359 | + HttpServletRequest request = ServletUtils.getRequest(); | |
360 | + | |
361 | + String qryStr = request.getQueryString(); | |
362 | + String url = request.getRequestURL().toString(); | |
363 | + if(StringUtils.isNotEmpty(qryStr)) { | |
364 | + url = url + "?" + qryStr; | |
365 | + } | |
366 | + log.setUrl(url); | |
367 | + | |
368 | + log.setApiMethod(request.getMethod()); | |
369 | + log.setIp(request.getRemoteAddr()); | |
370 | + | |
371 | + rebuildRequestHeader(log); | |
372 | + | |
373 | + rebuildRequestBody(log, request); | |
374 | + | |
375 | + //如果reqeust中取不到post参数,就从接口方法参数中取json对象 | |
376 | + if(StringUtils.isEmpty(log.getRequestBody())) { | |
377 | + rebuildRequestBody(log, point); | |
378 | + } | |
379 | + | |
380 | + }catch (Exception e){ | |
381 | + e.printStackTrace(); | |
382 | + } | |
383 | + | |
384 | + return log; | |
385 | + } | |
386 | + | |
387 | + private void finishApiLog(ApiLog log, Object ret){ | |
388 | + try { | |
389 | + rebuildResponseHeader(log); | |
390 | + rebuildResponseBody(log, ret); | |
391 | + | |
392 | + log.setResponseTime(new Date()); | |
393 | + Long duration = log.getResponseTime().getTime() - log.getRequestTime().getTime(); | |
394 | + log.setDuration(duration.intValue()); | |
395 | + | |
396 | + HttpServletResponse resp = ServletUtils.getResponse(); | |
397 | + log.setHttpCode(resp.getStatus()); | |
398 | + | |
399 | + if (ret instanceof Result) { | |
400 | + int retCode = ((Result) ret).getCode(); | |
401 | + log.setRetCode(retCode); | |
402 | + } | |
403 | + }catch (Exception e){ | |
404 | + e.printStackTrace(); | |
405 | + }finally { | |
406 | + saveApiLog(log); | |
407 | + } | |
408 | + } | |
409 | + | |
410 | + public static void setApiLogException(ApiLog log, Exception e){ | |
411 | + try { | |
412 | + String exception = ExceptionUtils.getFullStackTrace(e); | |
413 | + String shortExpInfo = e.getMessage() + "\n" + org.apache.commons.lang3.StringUtils.left(exception, 1000); | |
414 | + log.setException(shortExpInfo); | |
415 | + }catch (Exception ex){ | |
416 | + ex.printStackTrace(); | |
417 | + } | |
418 | + } | |
419 | + | |
420 | + private void rebuildRequestHeader(ApiLog log){ | |
421 | + try { | |
422 | + HttpServletRequest req = ServletUtils.getRequest(); | |
423 | + Enumeration names = req.getHeaderNames(); | |
424 | + ArrayList<String> headerList = new ArrayList<>(); | |
425 | + while(names.hasMoreElements()){ | |
426 | + String name = (String)names.nextElement(); | |
427 | + String header = req.getHeader(name); | |
428 | + headerList.add(name + ": " + header); | |
429 | + } | |
430 | + String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n"); | |
431 | + log.setRequestHeader(headers); | |
432 | + }catch (Exception e){ | |
433 | + e.printStackTrace(); | |
434 | + } | |
435 | + } | |
436 | + | |
437 | + /**先从post参数中构造request body*/ | |
438 | + private void rebuildRequestBody(ApiLog log, HttpServletRequest request){ | |
439 | + try{ | |
440 | + Set<String> keySet = request.getParameterMap().keySet(); | |
441 | + Iterator<String> it = keySet.iterator(); | |
442 | + StringBuffer sbf = new StringBuffer(); | |
443 | + while(it.hasNext()){ | |
444 | + String key = it.next(); | |
445 | + String value = request.getParameter(key); | |
446 | + sbf.append(key).append("=").append(value); | |
447 | + if(it.hasNext()) { | |
448 | + sbf.append("&"); | |
449 | + } | |
450 | + } | |
451 | + log.setRequestBody(sbf.toString()); | |
452 | + }catch (Exception e){ | |
453 | + e.printStackTrace(); | |
454 | + } | |
455 | + } | |
456 | + | |
457 | + /** | |
458 | + * 根据接口中的参数构造request body | |
459 | + */ | |
460 | + private void rebuildRequestBody(ApiLog log, ProceedingJoinPoint point) | |
461 | + { | |
462 | + try { | |
463 | + if (point.getArgs().length == 1) { | |
464 | + log.setRequestBody(JSONObject.toJSONString(point.getArgs()[0])); | |
465 | + return; | |
466 | + } | |
467 | + | |
468 | + MethodSignature m = (MethodSignature) point.getSignature(); | |
469 | + HashMap<String, Object> map = new HashMap<>(); | |
470 | + Object[] args = point.getArgs(); | |
471 | + for (int i = 0; i < m.getParameterNames().length; i++) { | |
472 | + String name = m.getParameterNames()[i]; | |
473 | +// Class type = m.getParameterTypes()[i]; | |
474 | + map.put(name, args[i]); | |
475 | + } | |
476 | + | |
477 | + if(!map.isEmpty()) { | |
478 | + log.setRequestBody(JSONObject.toJSONString(map)); | |
479 | + } | |
480 | + }catch (Exception e){ | |
481 | + e.printStackTrace(); | |
482 | + } | |
483 | + } | |
484 | + | |
485 | + private void rebuildResponseHeader(ApiLog log){ | |
486 | + try { | |
487 | + HttpServletResponse resp = ServletUtils.getResponse(); | |
488 | + Collection names = resp.getHeaderNames(); | |
489 | + ArrayList<String> headerList = new ArrayList<>(); | |
490 | + Iterator<String> it = names.iterator(); | |
491 | + while(it.hasNext()){ | |
492 | + String name = it.next(); | |
493 | + String header = resp.getHeader(name); | |
494 | + headerList.add(name + ": " + header); | |
495 | + } | |
496 | + String headers = org.apache.commons.lang3.StringUtils.join(headerList, "\n"); | |
497 | + log.setResponseHeader(headers); | |
498 | + }catch (Exception e){ | |
499 | + e.printStackTrace(); | |
500 | + } | |
501 | + } | |
502 | + | |
503 | + private void rebuildResponseBody(ApiLog log, Object ret){ | |
504 | + try { | |
505 | + log.setResponseBody(JSONObject.toJSON(ret).toString()); | |
506 | + }catch (Exception e){ | |
507 | + e.printStackTrace(); | |
508 | + } | |
509 | + } | |
510 | + | |
511 | + @Async | |
512 | + public void saveApiLog(ApiLog log){ | |
513 | + try{ | |
514 | + apiLogService.saveOrUpdate(log); | |
515 | + }catch (Exception e){ | |
516 | + e.printStackTrace(); | |
517 | + } | |
518 | + } | |
519 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/annotation/ApiLogger.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj.lang.annotation; | |
2 | + | |
3 | +import java.lang.annotation.*; | |
4 | + | |
5 | +/** | |
6 | + * 第三方系统API请求调用日志注解 | |
7 | + * | |
8 | + * @author huaheng | |
9 | + * | |
10 | + */ | |
11 | +@Target({ ElementType.METHOD }) | |
12 | +@Retention(RetentionPolicy.RUNTIME) | |
13 | +@Documented | |
14 | +public @interface ApiLogger | |
15 | +{ | |
16 | + /** 接口名称 */ | |
17 | + String apiName() default ""; | |
18 | + | |
19 | + /** 接口调用方 */ | |
20 | + String from() default ""; | |
21 | + | |
22 | + /** 接口提供方 */ | |
23 | + String to() default "WMS"; | |
24 | + | |
25 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessStatus.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj.lang.constant; | |
2 | + | |
3 | +/** | |
4 | + * 操作状态 | |
5 | + * | |
6 | + * @author huaheng | |
7 | + * | |
8 | + */ | |
9 | +public class BusinessStatus | |
10 | +{ | |
11 | + /** 其它 */ | |
12 | + public static final String OTHER = "-1"; | |
13 | + | |
14 | + /** 成功 */ | |
15 | + public static final String SUCCESS = "0"; | |
16 | + | |
17 | + /** 失败 */ | |
18 | + public static final String FAIL = "1"; | |
19 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/BusinessType.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj.lang.constant; | |
2 | + | |
3 | +/** | |
4 | + * 业务操作类型 | |
5 | + * | |
6 | + * @author huaheng | |
7 | + * | |
8 | + */ | |
9 | +public class BusinessType | |
10 | +{ | |
11 | + /** 其它 */ | |
12 | + public static final String OTHER = "0"; | |
13 | + /** 新增 */ | |
14 | + public static final String INSERT = "1"; | |
15 | + /** 修改 */ | |
16 | + public static final String UPDATE = "2"; | |
17 | + /** 删除 */ | |
18 | + public static final String DELETE = "3"; | |
19 | + /** 授权 */ | |
20 | + public static final String GRANT = "4"; | |
21 | + /** 导出 */ | |
22 | + public static final String EXPORT = "5"; | |
23 | + /** 导入 */ | |
24 | + public static final String IMPORT = "6"; | |
25 | + /** 强退 */ | |
26 | + public static final String FORCE = "7"; | |
27 | + /** 生成代码 */ | |
28 | + public static final String GENCODE = "8"; | |
29 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/DataSourceName.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj.lang.constant; | |
2 | + | |
3 | +/** | |
4 | + * 多数据源别名 | |
5 | + * | |
6 | + * @author huaheng | |
7 | + * | |
8 | + */ | |
9 | +public class DataSourceName | |
10 | +{ | |
11 | + /** 主库 */ | |
12 | + public static final String MASTER = "master"; | |
13 | + | |
14 | + /** 从库 */ | |
15 | + public static final String SLAVE = "slave"; | |
16 | + | |
17 | + /** wcs库*/ | |
18 | + public static final String WCS = "wcs"; | |
19 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/OperatorType.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj.lang.constant; | |
2 | + | |
3 | +/** | |
4 | + * 操作人类别 | |
5 | + * | |
6 | + * @author huaheng | |
7 | + * | |
8 | + */ | |
9 | +public class OperatorType | |
10 | +{ | |
11 | + /** 其它 */ | |
12 | + public static final String OTHER = "0"; | |
13 | + | |
14 | + /** 后台用户 */ | |
15 | + public static final String MANAGE = "1"; | |
16 | + | |
17 | + /** 渠道用户 */ | |
18 | + public static final String CHANNEL = "2"; | |
19 | + | |
20 | + /** 手机端用户 */ | |
21 | + public static final String MOBILE = "3"; | |
22 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/aspectj/lang/constant/ProcessCode.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.aspectj.lang.constant; | |
2 | + | |
3 | +/** | |
4 | + * 任务流程编码 | |
5 | + * | |
6 | + * @author xcq | |
7 | + */ | |
8 | +public class ProcessCode { | |
9 | + /** 入库任务 */ | |
10 | + public static final String RECEIPT_TASK_CODE = "receipt_task"; | |
11 | + /** 出库任务 */ | |
12 | + public static final String SHIPMENT_TASK_CODE = "shipment_task"; | |
13 | + /** 入库单据 */ | |
14 | + public static final String RECEIPT_BILL_CODE = "receipt_bill"; | |
15 | + /** 出库单据 */ | |
16 | + public static final String SHIPMENT_BILL_CODE = "shipment_bill"; | |
17 | + /** 其他任务 */ | |
18 | + public static final String OTHER_TASK_CODE = "other_task"; | |
19 | + | |
20 | + /** 从头部取值 */ | |
21 | + public static final String METHOD_HEAD = "head"; | |
22 | + /** 从返回结果取值 */ | |
23 | + public static final String METHOD_RESULT = "result"; | |
24 | + /** 通过表查询取值 */ | |
25 | + public static final String METHOD_SELECT = "SELECT"; | |
26 | + | |
27 | + /** 出库单据预约 */ | |
28 | + public static final String MODIFICATION_EDIT = "modificationEdit"; | |
29 | + | |
30 | + /** 出库单据审核 */ | |
31 | + public static final String REVIEW = "review"; | |
32 | + /** 出库单据销售单回传 */ | |
33 | + public static final String PUSH_SALES_DELIVERY = "pushSalesDelivery"; | |
34 | + | |
35 | + /** 入库单据创建 */ | |
36 | + public static final String CREATE_RECEIPT_TASK = "createReceiptTask"; | |
37 | + /** 入库单据回传 */ | |
38 | + public static final String RECEIPT_METHOD = "receiptMethod"; | |
39 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSource.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.datasource; | |
2 | + | |
3 | +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; | |
4 | + | |
5 | +import javax.sql.DataSource; | |
6 | +import java.util.Map; | |
7 | + | |
8 | +/** | |
9 | + * 动态数据源 | |
10 | + * | |
11 | + * @author huaheng | |
12 | + */ | |
13 | +public class DynamicDataSource extends AbstractRoutingDataSource | |
14 | +{ | |
15 | + public DynamicDataSource(DataSource defaultTargetDataSource, Map<Object, Object> targetDataSources) | |
16 | + { | |
17 | + super.setDefaultTargetDataSource(defaultTargetDataSource); | |
18 | + super.setTargetDataSources(targetDataSources); | |
19 | + super.afterPropertiesSet(); | |
20 | + } | |
21 | + | |
22 | + @Override | |
23 | + protected Object determineCurrentLookupKey() | |
24 | + { | |
25 | + return DynamicDataSourceContextHolder.getDB(); | |
26 | + } | |
27 | + | |
28 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/datasource/DynamicDataSourceContextHolder.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.datasource; | |
2 | + | |
3 | +import org.slf4j.Logger; | |
4 | +import org.slf4j.LoggerFactory; | |
5 | + | |
6 | +/** | |
7 | + * 当前线程数据源 | |
8 | + * | |
9 | + * @author huaheng | |
10 | + */ | |
11 | +public class DynamicDataSourceContextHolder | |
12 | +{ | |
13 | + public static final Logger log = LoggerFactory.getLogger(DynamicDataSourceContextHolder.class); | |
14 | + | |
15 | + /** | |
16 | + * 使用ThreadLocal维护变量,ThreadLocal为每个使用该变量的线程提供独立的变量副本, | |
17 | + * 所以每一个线程都可以独立地改变自己的副本,而不会影响其它线程所对应的副本。 | |
18 | + */ | |
19 | + private static final ThreadLocal<String> CONTEXT_HOLDER = new ThreadLocal<>(); | |
20 | + | |
21 | + /** | |
22 | + * 设置数据源名 | |
23 | + */ | |
24 | + public static void setDB(String dbType) | |
25 | + { | |
26 | + log.info("切换到{}数据源", dbType); | |
27 | + CONTEXT_HOLDER.set(dbType); | |
28 | + } | |
29 | + | |
30 | + /** | |
31 | + * 获取数据源名 | |
32 | + */ | |
33 | + public static String getDB() | |
34 | + { | |
35 | + return CONTEXT_HOLDER.get(); | |
36 | + } | |
37 | + | |
38 | + /** | |
39 | + * 清理数据源名 | |
40 | + */ | |
41 | + public static void clearDB() | |
42 | + { | |
43 | + CONTEXT_HOLDER.remove(); | |
44 | + } | |
45 | + | |
46 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/framework/spring/SpringUtils.java
0 → 100644
1 | +package org.jeecg.modules.wms.framework.spring; | |
2 | + | |
3 | +import org.springframework.beans.BeansException; | |
4 | +import org.springframework.beans.factory.NoSuchBeanDefinitionException; | |
5 | +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; | |
6 | +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | |
7 | +import org.springframework.stereotype.Component; | |
8 | + | |
9 | +/** | |
10 | + * spring工具类 方便在非spring管理环境中获取bean | |
11 | + * | |
12 | + * @author huaheng | |
13 | + */ | |
14 | +@Component | |
15 | +public final class SpringUtils implements BeanFactoryPostProcessor | |
16 | +{ | |
17 | + /** Spring应用上下文环境 */ | |
18 | + private static ConfigurableListableBeanFactory beanFactory; | |
19 | + | |
20 | + @Override | |
21 | + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException | |
22 | + { | |
23 | + SpringUtils.beanFactory = beanFactory; | |
24 | + } | |
25 | + | |
26 | + /** | |
27 | + * 获取对象 | |
28 | + * | |
29 | + * @param name | |
30 | + * @return Object 一个以所给名字注册的bean的实例 | |
31 | + * @throws BeansException | |
32 | + * | |
33 | + */ | |
34 | + @SuppressWarnings("unchecked") | |
35 | + public static <T> T getBean(String name) throws BeansException | |
36 | + { | |
37 | + return (T) beanFactory.getBean(name); | |
38 | + } | |
39 | + | |
40 | + /** | |
41 | + * 获取类型为requiredType的对象 | |
42 | + * | |
43 | + * @param clz | |
44 | + * @return | |
45 | + * @throws BeansException | |
46 | + * | |
47 | + */ | |
48 | + public static <T> T getBean(Class<T> clz) throws BeansException | |
49 | + { | |
50 | + T result = (T) beanFactory.getBean(clz); | |
51 | + return result; | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true | |
56 | + * | |
57 | + * @param name | |
58 | + * @return boolean | |
59 | + */ | |
60 | + public static boolean containsBean(String name) | |
61 | + { | |
62 | + return beanFactory.containsBean(name); | |
63 | + } | |
64 | + | |
65 | + /** | |
66 | + * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) | |
67 | + * | |
68 | + * @param name | |
69 | + * @return boolean | |
70 | + * @throws NoSuchBeanDefinitionException | |
71 | + * | |
72 | + */ | |
73 | + public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException | |
74 | + { | |
75 | + return beanFactory.isSingleton(name); | |
76 | + } | |
77 | + | |
78 | + /** | |
79 | + * @param name | |
80 | + * @return Class 注册对象的类型 | |
81 | + * @throws NoSuchBeanDefinitionException | |
82 | + * | |
83 | + */ | |
84 | + public static Class<?> getType(String name) throws NoSuchBeanDefinitionException | |
85 | + { | |
86 | + return beanFactory.getType(name); | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 如果给定的bean名字在bean定义中有别名,则返回这些别名 | |
91 | + * | |
92 | + * @param name | |
93 | + * @return | |
94 | + * @throws NoSuchBeanDefinitionException | |
95 | + * | |
96 | + */ | |
97 | + public static String[] getAliases(String name) throws NoSuchBeanDefinitionException | |
98 | + { | |
99 | + return beanFactory.getAliases(name); | |
100 | + } | |
101 | + | |
102 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/controller/InventoryHeaderController.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.controller; | |
2 | + | |
3 | +import org.jeecg.common.system.query.QueryGenerator; | |
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; | |
7 | +import lombok.extern.slf4j.Slf4j; | |
8 | +import org.jeecg.common.system.base.controller.JeecgController; | |
9 | +import org.jeecg.common.api.vo.Result; | |
10 | +import org.jeecg.common.system.util.JwtUtil; | |
11 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
12 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
13 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
14 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | |
15 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | +import org.springframework.web.bind.annotation.*; | |
17 | +import javax.servlet.http.HttpServletRequest; | |
18 | +import javax.servlet.http.HttpServletResponse; | |
19 | +import org.springframework.web.servlet.ModelAndView; | |
20 | +import java.util.Arrays; | |
21 | +import org.jeecg.common.util.oConvertUtils; | |
22 | +import io.swagger.annotations.Api; | |
23 | +import io.swagger.annotations.ApiOperation; | |
24 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
25 | +import org.apache.shiro.SecurityUtils; | |
26 | +import org.jeecg.common.system.vo.LoginUser; | |
27 | +import org.jeecgframework.poi.excel.ExcelImportUtil; | |
28 | +import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
29 | +import org.jeecgframework.poi.excel.entity.ExportParams; | |
30 | +import org.jeecgframework.poi.excel.entity.ImportParams; | |
31 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
32 | +import org.springframework.web.multipart.MultipartFile; | |
33 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | |
34 | +import java.io.IOException; | |
35 | +import java.util.List; | |
36 | +import java.util.Map; | |
37 | +import java.util.stream.Collectors; | |
38 | + | |
39 | + /** | |
40 | + * @Description: 库存表 | |
41 | + * @Author: jeecg-boot | |
42 | + * @Date: 2022-11-16 | |
43 | + * @Version: V1.0 | |
44 | + */ | |
45 | +@Api(tags="库存表") | |
46 | +@RestController | |
47 | +@RequestMapping("/inventory/inventoryHeader") | |
48 | +@Slf4j | |
49 | +public class InventoryHeaderController extends JeecgController<InventoryHeader, IInventoryHeaderService> { | |
50 | + | |
51 | + @Autowired | |
52 | + private IInventoryHeaderService inventoryHeaderService; | |
53 | + | |
54 | + @Autowired | |
55 | + private IInventoryDetailService inventoryDetailService; | |
56 | + | |
57 | + | |
58 | + /*---------------------------------主表处理-begin-------------------------------------*/ | |
59 | + | |
60 | + /** | |
61 | + * 分页列表查询 | |
62 | + * @param inventoryHeader | |
63 | + * @param pageNo | |
64 | + * @param pageSize | |
65 | + * @param req | |
66 | + * @return | |
67 | + */ | |
68 | + //@AutoLog(value = "库存表-分页列表查询") | |
69 | + @ApiOperation(value="库存表-分页列表查询", notes="库存表-分页列表查询") | |
70 | + @GetMapping(value = "/list") | |
71 | + public Result<IPage<InventoryHeader>> queryPageList(InventoryHeader inventoryHeader, | |
72 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
73 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
74 | + HttpServletRequest req) { | |
75 | + QueryWrapper<InventoryHeader> queryWrapper = QueryGenerator.initQueryWrapper(inventoryHeader, req.getParameterMap()); | |
76 | + Page<InventoryHeader> page = new Page<InventoryHeader>(pageNo, pageSize); | |
77 | + IPage<InventoryHeader> pageList = inventoryHeaderService.page(page, queryWrapper); | |
78 | + return Result.OK(pageList); | |
79 | + } | |
80 | + | |
81 | + /** | |
82 | + * 添加 | |
83 | + * @param inventoryHeader | |
84 | + * @return | |
85 | + */ | |
86 | + @AutoLog(value = "库存表-添加") | |
87 | + @ApiOperation(value="库存表-添加", notes="库存表-添加") | |
88 | + @PostMapping(value = "/add") | |
89 | + public Result<String> add(@RequestBody InventoryHeader inventoryHeader, HttpServletRequest req) { | |
90 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
91 | + inventoryHeader.setWarehouseCode(warehouseCode); | |
92 | + inventoryHeaderService.save(inventoryHeader); | |
93 | + return Result.OK("添加成功!"); | |
94 | + } | |
95 | + | |
96 | + /** | |
97 | + * 编辑 | |
98 | + * @param inventoryHeader | |
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 InventoryHeader inventoryHeader, HttpServletRequest req) { | |
105 | + inventoryHeaderService.updateById(inventoryHeader); | |
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 | + inventoryHeaderService.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.inventoryHeaderService.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, InventoryHeader inventoryHeader) { | |
141 | + return super.exportXls(request, inventoryHeader, InventoryHeader.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, InventoryHeader.class); | |
151 | + } | |
152 | + /*---------------------------------主表处理-end-------------------------------------*/ | |
153 | + | |
154 | + | |
155 | + /*--------------------------------子表处理-库存详情-begin----------------------------------------------*/ | |
156 | + /** | |
157 | + * 通过主表ID查询 | |
158 | + * @return | |
159 | + */ | |
160 | + //@AutoLog(value = "库存详情-通过主表ID查询") | |
161 | + @ApiOperation(value="库存详情-通过主表ID查询", notes="库存详情-通过主表ID查询") | |
162 | + @GetMapping(value = "/listInventoryDetailByMainId") | |
163 | + public Result<IPage<InventoryDetail>> listInventoryDetailByMainId(InventoryDetail inventoryDetail, | |
164 | + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | |
165 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, | |
166 | + HttpServletRequest req) { | |
167 | + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, req.getParameterMap()); | |
168 | + Page<InventoryDetail> page = new Page<InventoryDetail>(pageNo, pageSize); | |
169 | + IPage<InventoryDetail> pageList = inventoryDetailService.page(page, queryWrapper); | |
170 | + return Result.OK(pageList); | |
171 | + } | |
172 | + | |
173 | + /** | |
174 | + * 添加 | |
175 | + * @param inventoryDetail | |
176 | + * @return | |
177 | + */ | |
178 | + @AutoLog(value = "库存详情-添加") | |
179 | + @ApiOperation(value="库存详情-添加", notes="库存详情-添加") | |
180 | + @PostMapping(value = "/addInventoryDetail") | |
181 | + public Result<String> addInventoryDetail(@RequestBody InventoryDetail inventoryDetail, HttpServletRequest req) { | |
182 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
183 | + inventoryDetail.setWarehouseCode(warehouseCode); | |
184 | + inventoryDetailService.save(inventoryDetail); | |
185 | + return Result.OK("添加成功!"); | |
186 | + } | |
187 | + | |
188 | + /** | |
189 | + * 编辑 | |
190 | + * @param inventoryDetail | |
191 | + * @return | |
192 | + */ | |
193 | + @AutoLog(value = "库存详情-编辑") | |
194 | + @ApiOperation(value="库存详情-编辑", notes="库存详情-编辑") | |
195 | + @RequestMapping(value = "/editInventoryDetail", method = {RequestMethod.PUT,RequestMethod.POST}) | |
196 | + public Result<String> editInventoryDetail(@RequestBody InventoryDetail inventoryDetail) { | |
197 | + inventoryDetailService.updateById(inventoryDetail); | |
198 | + return Result.OK("编辑成功!"); | |
199 | + } | |
200 | + | |
201 | + /** | |
202 | + * 通过id删除 | |
203 | + * @param id | |
204 | + * @return | |
205 | + */ | |
206 | + @AutoLog(value = "库存详情-通过id删除") | |
207 | + @ApiOperation(value="库存详情-通过id删除", notes="库存详情-通过id删除") | |
208 | + @DeleteMapping(value = "/deleteInventoryDetail") | |
209 | + public Result<String> deleteInventoryDetail(@RequestParam(name="id",required=true) String id) { | |
210 | + inventoryDetailService.removeById(id); | |
211 | + return Result.OK("删除成功!"); | |
212 | + } | |
213 | + | |
214 | + /** | |
215 | + * 批量删除 | |
216 | + * @param ids | |
217 | + * @return | |
218 | + */ | |
219 | + @AutoLog(value = "库存详情-批量删除") | |
220 | + @ApiOperation(value="库存详情-批量删除", notes="库存详情-批量删除") | |
221 | + @DeleteMapping(value = "/deleteBatchInventoryDetail") | |
222 | + public Result<String> deleteBatchInventoryDetail(@RequestParam(name="ids",required=true) String ids) { | |
223 | + this.inventoryDetailService.removeByIds(Arrays.asList(ids.split(","))); | |
224 | + return Result.OK("批量删除成功!"); | |
225 | + } | |
226 | + | |
227 | + /** | |
228 | + * 导出 | |
229 | + * @return | |
230 | + */ | |
231 | + @RequestMapping(value = "/exportInventoryDetail") | |
232 | + public ModelAndView exportInventoryDetail(HttpServletRequest request, InventoryDetail inventoryDetail) { | |
233 | + // Step.1 组装查询条件 | |
234 | + QueryWrapper<InventoryDetail> queryWrapper = QueryGenerator.initQueryWrapper(inventoryDetail, request.getParameterMap()); | |
235 | + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); | |
236 | + | |
237 | + // Step.2 获取导出数据 | |
238 | + List<InventoryDetail> pageList = inventoryDetailService.list(queryWrapper); | |
239 | + List<InventoryDetail> exportList = null; | |
240 | + | |
241 | + // 过滤选中数据 | |
242 | + String selections = request.getParameter("selections"); | |
243 | + if (oConvertUtils.isNotEmpty(selections)) { | |
244 | + List<String> selectionList = Arrays.asList(selections.split(",")); | |
245 | + exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); | |
246 | + } else { | |
247 | + exportList = pageList; | |
248 | + } | |
249 | + | |
250 | + // Step.3 AutoPoi 导出Excel | |
251 | + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | |
252 | + mv.addObject(NormalExcelConstants.FILE_NAME, "库存详情"); //此处设置的filename无效 ,前端会重更新设置一下 | |
253 | + mv.addObject(NormalExcelConstants.CLASS, InventoryDetail.class); | |
254 | + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("库存详情报表", "导出人:" + sysUser.getRealname(), "库存详情")); | |
255 | + mv.addObject(NormalExcelConstants.DATA_LIST, exportList); | |
256 | + return mv; | |
257 | + } | |
258 | + | |
259 | + /** | |
260 | + * 导入 | |
261 | + * @return | |
262 | + */ | |
263 | + @RequestMapping(value = "/importInventoryDetail/{mainId}") | |
264 | + public Result<?> importInventoryDetail(HttpServletRequest request, HttpServletResponse response, @PathVariable("mainId") Integer mainId) { | |
265 | + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | |
266 | + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); | |
267 | + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { | |
268 | + MultipartFile file = entity.getValue();// 获取上传文件对象 | |
269 | + ImportParams params = new ImportParams(); | |
270 | + params.setTitleRows(2); | |
271 | + params.setHeadRows(1); | |
272 | + params.setNeedSave(true); | |
273 | + try { | |
274 | + List<InventoryDetail> list = ExcelImportUtil.importExcel(file.getInputStream(), InventoryDetail.class, params); | |
275 | + for (InventoryDetail temp : list) { | |
276 | + temp.setInventoryHeaderId(mainId); | |
277 | + } | |
278 | + long start = System.currentTimeMillis(); | |
279 | + inventoryDetailService.saveBatch(list); | |
280 | + log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒"); | |
281 | + return Result.OK("文件导入成功!数据行数:" + list.size()); | |
282 | + } catch (Exception e) { | |
283 | + log.error(e.getMessage(), e); | |
284 | + return Result.error("文件导入失败:" + e.getMessage()); | |
285 | + } finally { | |
286 | + try { | |
287 | + file.getInputStream().close(); | |
288 | + } catch (IOException e) { | |
289 | + e.printStackTrace(); | |
290 | + } | |
291 | + } | |
292 | + } | |
293 | + return Result.error("文件导入失败!"); | |
294 | + } | |
295 | + | |
296 | + /*--------------------------------子表处理-库存详情-end----------------------------------------------*/ | |
297 | + | |
298 | + | |
299 | + | |
300 | + | |
301 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryDetail.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import com.baomidou.mybatisplus.annotation.IdType; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
7 | +import org.jeecg.common.aspect.annotation.Dict; | |
8 | +import lombok.Data; | |
9 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
10 | +import org.springframework.format.annotation.DateTimeFormat; | |
11 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
12 | +import java.util.Date; | |
13 | +import io.swagger.annotations.ApiModel; | |
14 | +import io.swagger.annotations.ApiModelProperty; | |
15 | +import java.io.UnsupportedEncodingException; | |
16 | + | |
17 | +/** | |
18 | + * @Description: 库存详情 | |
19 | + * @Author: jeecg-boot | |
20 | + * @Date: 2022-11-16 | |
21 | + * @Version: V1.0 | |
22 | + */ | |
23 | +@Data | |
24 | +@TableName("inventory_detail") | |
25 | +@ApiModel(value="inventory_detail对象", description="库存详情") | |
26 | +public class InventoryDetail 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 inventoryHeaderId; | |
36 | + /**仓库编码*/ | |
37 | + @Excel(name = "仓库编码", width = 15) | |
38 | + @ApiModelProperty(value = "仓库编码") | |
39 | + private String warehouseCode; | |
40 | + /**货主*/ | |
41 | + @Excel(name = "货主", width = 15) | |
42 | + @ApiModelProperty(value = "货主") | |
43 | + private String companyCode; | |
44 | + /**库区*/ | |
45 | + @Excel(name = "库区", width = 15) | |
46 | + @ApiModelProperty(value = "库区") | |
47 | + private String zoneCode; | |
48 | + /**容器编码*/ | |
49 | + @Excel(name = "容器编码", width = 15) | |
50 | + @ApiModelProperty(value = "容器编码") | |
51 | + private String containerCode; | |
52 | + /**库位编码*/ | |
53 | + @Excel(name = "库位编码", width = 15) | |
54 | + @ApiModelProperty(value = "库位编码") | |
55 | + private String locationCode; | |
56 | + /**物料编码*/ | |
57 | + @Excel(name = "物料编码", width = 15) | |
58 | + @ApiModelProperty(value = "物料编码") | |
59 | + private String materialCode; | |
60 | + /**物料名称*/ | |
61 | + @Excel(name = "物料名称", width = 15) | |
62 | + @ApiModelProperty(value = "物料名称") | |
63 | + private String materialName; | |
64 | + /**物料规格*/ | |
65 | + @Excel(name = "物料规格", width = 15) | |
66 | + @ApiModelProperty(value = "物料规格") | |
67 | + private String materialSpec; | |
68 | + /**物料单位*/ | |
69 | + @Excel(name = "物料单位", width = 15) | |
70 | + @ApiModelProperty(value = "物料单位") | |
71 | + private String materialUnit; | |
72 | + /**数量*/ | |
73 | + @Excel(name = "数量", width = 15) | |
74 | + @ApiModelProperty(value = "数量") | |
75 | + private java.math.BigDecimal qty; | |
76 | + /**任务锁定数量*/ | |
77 | + @Excel(name = "任务锁定数量", width = 15) | |
78 | + @ApiModelProperty(value = "任务锁定数量") | |
79 | + private java.math.BigDecimal taskQty; | |
80 | + /**库存状态*/ | |
81 | + @Excel(name = "库存状态", width = 15) | |
82 | + @Dict(dicCode = "inventory_status") | |
83 | + @ApiModelProperty(value = "库存状态") | |
84 | + private String inventoryStatus; | |
85 | + /**批次*/ | |
86 | + @Excel(name = "批次", width = 15) | |
87 | + @ApiModelProperty(value = "批次") | |
88 | + private String batch; | |
89 | + /**批号*/ | |
90 | + @Excel(name = "批号", width = 15) | |
91 | + @ApiModelProperty(value = "批号") | |
92 | + private String lot; | |
93 | + /**项目号*/ | |
94 | + @Excel(name = "项目号", width = 15) | |
95 | + @ApiModelProperty(value = "项目号") | |
96 | + private String project; | |
97 | + /**唯一号*/ | |
98 | + @Excel(name = "唯一号", width = 15) | |
99 | + @ApiModelProperty(value = "唯一号") | |
100 | + private String uniqueCode; | |
101 | + /**箱码*/ | |
102 | + @Excel(name = "箱码", width = 15) | |
103 | + @ApiModelProperty(value = "箱码") | |
104 | + private String boxCode; | |
105 | + /**入库日期*/ | |
106 | + @Excel(name = "入库日期", width = 15) | |
107 | + @ApiModelProperty(value = "入库日期") | |
108 | + private Date receiptDate; | |
109 | + /**库龄(天)*/ | |
110 | + @Excel(name = "库龄(天)", width = 15) | |
111 | + @ApiModelProperty(value = "库龄(天)") | |
112 | + private Integer inventoryAge; | |
113 | + /**备用字段1*/ | |
114 | + @Excel(name = "备用字段1", width = 15) | |
115 | + @ApiModelProperty(value = "备用字段1") | |
116 | + private String userdef1; | |
117 | + /**备用字段2*/ | |
118 | + @Excel(name = "备用字段2", width = 15) | |
119 | + @ApiModelProperty(value = "备用字段2") | |
120 | + private String userdef2; | |
121 | + /**备用字段3*/ | |
122 | + @Excel(name = "备用字段3", width = 15) | |
123 | + @ApiModelProperty(value = "备用字段3") | |
124 | + private String userdef3; | |
125 | + /**创建人*/ | |
126 | + @ApiModelProperty(value = "创建人") | |
127 | + private String createBy; | |
128 | + /**创建日期*/ | |
129 | + @ApiModelProperty(value = "创建日期") | |
130 | + private Date createTime; | |
131 | + /**更新人*/ | |
132 | + @ApiModelProperty(value = "更新人") | |
133 | + private String updateBy; | |
134 | + /**更新日期*/ | |
135 | + @ApiModelProperty(value = "更新日期") | |
136 | + private Date updateTime; | |
137 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/entity/InventoryHeader.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.io.UnsupportedEncodingException; | |
5 | +import java.util.Date; | |
6 | +import com.baomidou.mybatisplus.annotation.IdType; | |
7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
8 | +import com.baomidou.mybatisplus.annotation.TableName; | |
9 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
10 | +import lombok.Data; | |
11 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
12 | +import org.springframework.format.annotation.DateTimeFormat; | |
13 | +import org.jeecg.common.aspect.annotation.Dict; | |
14 | +import io.swagger.annotations.ApiModel; | |
15 | +import io.swagger.annotations.ApiModelProperty; | |
16 | + | |
17 | +/** | |
18 | + * @Description: 库存表 | |
19 | + * @Author: jeecg-boot | |
20 | + * @Date: 2022-11-16 | |
21 | + * @Version: V1.0 | |
22 | + */ | |
23 | +@Data | |
24 | +@TableName("inventory_header") | |
25 | +@ApiModel(value="inventory_header对象", description="库存表") | |
26 | +public class InventoryHeader 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 warehouseCode; | |
37 | + /**货主*/ | |
38 | + @Excel(name = "货主", width = 15) | |
39 | + @ApiModelProperty(value = "货主") | |
40 | + private String companyCode; | |
41 | + /**库区*/ | |
42 | + @Excel(name = "库区", width = 15) | |
43 | + @ApiModelProperty(value = "库区") | |
44 | + private String zoneCode; | |
45 | + /**容器号*/ | |
46 | + @Excel(name = "容器号", width = 15) | |
47 | + @ApiModelProperty(value = "容器号") | |
48 | + private String containerCode; | |
49 | + /**容器状态*/ | |
50 | + @Excel(name = "容器状态", width = 15, dicCode = "container_status") | |
51 | + @Dict(dicCode = "container_status") | |
52 | + @ApiModelProperty(value = "容器状态") | |
53 | + private String containerStatus; | |
54 | + /**库位号*/ | |
55 | + @Excel(name = "库位号", width = 15) | |
56 | + @ApiModelProperty(value = "库位号") | |
57 | + private String locationCode; | |
58 | + /**状态*/ | |
59 | + @Excel(name = "状态", width = 15, dicCode = "enable_status") | |
60 | + @Dict(dicCode = "enable_status") | |
61 | + @ApiModelProperty(value = "状态") | |
62 | + private Integer enable; | |
63 | + /**总数量*/ | |
64 | + @Excel(name = "总数量", width = 15) | |
65 | + @ApiModelProperty(value = "总数量") | |
66 | + private java.math.BigDecimal totalQty; | |
67 | + /**总行量*/ | |
68 | + @Excel(name = "总行量", width = 15) | |
69 | + @ApiModelProperty(value = "总行量") | |
70 | + private Integer totalLines; | |
71 | + @Excel(name = "总重量", width = 15) | |
72 | + @ApiModelProperty(value = "总重量") | |
73 | + private Integer totalWeight; | |
74 | + /**备用字段1*/ | |
75 | + @Excel(name = "备用字段1", width = 15) | |
76 | + @ApiModelProperty(value = "备用字段1") | |
77 | + private String userdef1; | |
78 | + /**备用字段2*/ | |
79 | + @Excel(name = "备用字段2", width = 15) | |
80 | + @ApiModelProperty(value = "备用字段2") | |
81 | + private String userdef2; | |
82 | + /**备用字段3*/ | |
83 | + @Excel(name = "备用字段3", width = 15) | |
84 | + @ApiModelProperty(value = "备用字段3") | |
85 | + private String userdef3; | |
86 | + /**创建人*/ | |
87 | + @ApiModelProperty(value = "创建人") | |
88 | + private String createBy; | |
89 | + /**创建日期*/ | |
90 | + @ApiModelProperty(value = "创建日期") | |
91 | + private Date createTime; | |
92 | + /**更新人*/ | |
93 | + @ApiModelProperty(value = "更新人") | |
94 | + private String updateBy; | |
95 | + /**更新日期*/ | |
96 | + @ApiModelProperty(value = "更新日期") | |
97 | + private Date updateTime; | |
98 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryDetailMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.mapper; | |
2 | + | |
3 | +import java.util.List; | |
4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
5 | +import org.apache.ibatis.annotations.Param; | |
6 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
7 | + | |
8 | +/** | |
9 | + * @Description: 库存详情 | |
10 | + * @Author: jeecg-boot | |
11 | + * @Date: 2022-11-16 | |
12 | + * @Version: V1.0 | |
13 | + */ | |
14 | +public interface InventoryDetailMapper extends BaseMapper<InventoryDetail> { | |
15 | + | |
16 | + public boolean deleteByMainId(@Param("mainId") String mainId); | |
17 | + | |
18 | + public List<InventoryDetail> selectByMainId(@Param("mainId") String mainId); | |
19 | + | |
20 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/InventoryHeaderMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.mapper; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.apache.ibatis.annotations.Param; | |
6 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
7 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
8 | + | |
9 | +/** | |
10 | + * @Description: 库存表 | |
11 | + * @Author: jeecg-boot | |
12 | + * @Date: 2022-11-16 | |
13 | + * @Version: V1.0 | |
14 | + */ | |
15 | +public interface InventoryHeaderMapper extends BaseMapper<InventoryHeader> { | |
16 | + | |
17 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryDetailMapper.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.inventory.inventoryHeader.mapper.InventoryDetailMapper"> | |
4 | + | |
5 | + <delete id="deleteByMainId" parameterType="java.lang.String"> | |
6 | + DELETE | |
7 | + FROM inventory_detail | |
8 | + WHERE | |
9 | + inventory_header_id = #{mainId} | |
10 | + </delete> | |
11 | + | |
12 | + <select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail"> | |
13 | + SELECT * | |
14 | + FROM inventory_detail | |
15 | + WHERE | |
16 | + inventory_header_id = #{mainId} | |
17 | + </select> | |
18 | +</mapper> | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/mapper/xml/InventoryHeaderMapper.xml
0 → 100644
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryDetailService.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.service; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
5 | + | |
6 | +import java.util.List; | |
7 | + | |
8 | +/** | |
9 | + * @Description: 库存详情 | |
10 | + * @Author: jeecg-boot | |
11 | + * @Date: 2022-11-16 | |
12 | + * @Version: V1.0 | |
13 | + */ | |
14 | +public interface IInventoryDetailService extends IService<InventoryDetail> { | |
15 | + | |
16 | + public List<InventoryDetail> selectByMainId(String mainId); | |
17 | + | |
18 | + List<InventoryDetail> getInventoryDetailListByInventoryHeaderId(Integer inventoryHeaderId); | |
19 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/IInventoryHeaderService.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.service; | |
2 | + | |
3 | +import com.alipay.api.domain.Inventory; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
6 | +import org.springframework.beans.factory.annotation.Autowired; | |
7 | +import java.io.Serializable; | |
8 | +import java.util.Collection; | |
9 | +import java.util.List; | |
10 | + | |
11 | +/** | |
12 | + * @Description: 库存表 | |
13 | + * @Author: jeecg-boot | |
14 | + * @Date: 2022-11-16 | |
15 | + * @Version: V1.0 | |
16 | + */ | |
17 | +public interface IInventoryHeaderService extends IService<InventoryHeader> { | |
18 | + | |
19 | + /** | |
20 | + * 删除一对多 | |
21 | + */ | |
22 | + public void delMain (String id); | |
23 | + | |
24 | + /** | |
25 | + * 批量删除一对多 | |
26 | + */ | |
27 | + public void delBatchMain (Collection<? extends Serializable> idList); | |
28 | + | |
29 | + InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode); | |
30 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryDetailServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
5 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
6 | +import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; | |
7 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +import java.lang.ref.WeakReference; | |
11 | +import java.util.List; | |
12 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
13 | +import org.springframework.beans.factory.annotation.Autowired; | |
14 | + | |
15 | +/** | |
16 | + * @Description: 库存详情 | |
17 | + * @Author: jeecg-boot | |
18 | + * @Date: 2022-11-16 | |
19 | + * @Version: V1.0 | |
20 | + */ | |
21 | +@Service | |
22 | +public class InventoryDetailServiceImpl extends ServiceImpl<InventoryDetailMapper, InventoryDetail> implements IInventoryDetailService { | |
23 | + | |
24 | + @Autowired | |
25 | + private InventoryDetailMapper inventoryDetailMapper; | |
26 | + | |
27 | + @Override | |
28 | + public List<InventoryDetail> selectByMainId(String mainId) { | |
29 | + return inventoryDetailMapper.selectByMainId(mainId); | |
30 | + } | |
31 | + | |
32 | + @Override | |
33 | + public List<InventoryDetail> getInventoryDetailListByInventoryHeaderId(Integer inventoryHeaderId) { | |
34 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
35 | + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId, inventoryHeaderId); | |
36 | + List<InventoryDetail> inventoryDetailList = list(inventoryDetailLambdaQueryWrapper); | |
37 | + return inventoryDetailList; | |
38 | + } | |
39 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryHeader/service/impl/InventoryHeaderServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryHeader.service.impl; | |
2 | + | |
3 | +import com.alipay.api.domain.Inventory; | |
4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
6 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
7 | +import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryDetailMapper; | |
8 | +import org.jeecg.modules.wms.inventory.inventoryHeader.mapper.InventoryHeaderMapper; | |
9 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | |
10 | +import org.springframework.stereotype.Service; | |
11 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
12 | +import org.springframework.beans.factory.annotation.Autowired; | |
13 | +import org.springframework.transaction.annotation.Transactional; | |
14 | +import java.io.Serializable; | |
15 | +import java.lang.ref.WeakReference; | |
16 | +import java.util.List; | |
17 | +import java.util.Collection; | |
18 | + | |
19 | +/** | |
20 | + * @Description: 库存表 | |
21 | + * @Author: jeecg-boot | |
22 | + * @Date: 2022-11-16 | |
23 | + * @Version: V1.0 | |
24 | + */ | |
25 | +@Service | |
26 | +public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMapper, InventoryHeader> implements IInventoryHeaderService { | |
27 | + | |
28 | + @Autowired | |
29 | + private InventoryHeaderMapper inventoryHeaderMapper; | |
30 | + @Autowired | |
31 | + private InventoryDetailMapper inventoryDetailMapper; | |
32 | + | |
33 | + @Override | |
34 | + @Transactional | |
35 | + public void delMain(String id) { | |
36 | + inventoryDetailMapper.deleteByMainId(id); | |
37 | + inventoryHeaderMapper.deleteById(id); | |
38 | + } | |
39 | + | |
40 | + @Override | |
41 | + @Transactional | |
42 | + public void delBatchMain(Collection<? extends Serializable> idList) { | |
43 | + for(Serializable id:idList) { | |
44 | + inventoryDetailMapper.deleteByMainId(id.toString()); | |
45 | + inventoryHeaderMapper.deleteById(id); | |
46 | + } | |
47 | + } | |
48 | + | |
49 | + @Override | |
50 | + public InventoryHeader getInventoryHeaderByContainerCode(String containerCode, String warehouseCode) { | |
51 | + LambdaQueryWrapper<InventoryHeader> inventoryHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
52 | + inventoryHeaderLambdaQueryWrapper.eq(InventoryHeader::getContainerCode, containerCode) | |
53 | + .eq(InventoryHeader::getWarehouseCode, warehouseCode); | |
54 | + InventoryHeader inventoryHeader = getOne(inventoryHeaderLambdaQueryWrapper); | |
55 | + return inventoryHeader; | |
56 | + } | |
57 | + | |
58 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/controller/InventoryTransactionController.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryTransaction.controller; | |
2 | + | |
3 | +import java.util.Arrays; | |
4 | +import java.util.List; | |
5 | +import java.util.Map; | |
6 | +import java.util.stream.Collectors; | |
7 | +import java.io.IOException; | |
8 | +import java.io.UnsupportedEncodingException; | |
9 | +import java.net.URLDecoder; | |
10 | +import javax.servlet.http.HttpServletRequest; | |
11 | +import javax.servlet.http.HttpServletResponse; | |
12 | +import org.jeecg.common.api.vo.Result; | |
13 | +import org.jeecg.common.system.query.QueryGenerator; | |
14 | +import org.jeecg.common.system.util.JwtUtil; | |
15 | +import org.jeecg.common.util.oConvertUtils; | |
16 | + | |
17 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
18 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
19 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
20 | +import lombok.extern.slf4j.Slf4j; | |
21 | + | |
22 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
23 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; | |
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.jeecg.common.system.base.controller.JeecgController; | |
30 | +import org.springframework.beans.factory.annotation.Autowired; | |
31 | +import org.springframework.web.bind.annotation.*; | |
32 | +import org.springframework.web.multipart.MultipartFile; | |
33 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | |
34 | +import org.springframework.web.servlet.ModelAndView; | |
35 | +import com.alibaba.fastjson.JSON; | |
36 | +import io.swagger.annotations.Api; | |
37 | +import io.swagger.annotations.ApiOperation; | |
38 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
39 | + | |
40 | + /** | |
41 | + * @Description: 库存交易记录 | |
42 | + * @Author: jeecg-boot | |
43 | + * @Date: 2022-11-17 | |
44 | + * @Version: V1.0 | |
45 | + */ | |
46 | +@Api(tags="库存交易记录") | |
47 | +@RestController | |
48 | +@RequestMapping("/inventory/inventoryTransaction") | |
49 | +@Slf4j | |
50 | +public class InventoryTransactionController extends JeecgController<InventoryTransaction, IInventoryTransactionService> { | |
51 | + @Autowired | |
52 | + private IInventoryTransactionService inventoryTransactionService; | |
53 | + | |
54 | + /** | |
55 | + * 分页列表查询 | |
56 | + * | |
57 | + * @param inventoryTransaction | |
58 | + * @param pageNo | |
59 | + * @param pageSize | |
60 | + * @param req | |
61 | + * @return | |
62 | + */ | |
63 | + //@AutoLog(value = "库存交易记录-分页列表查询") | |
64 | + @ApiOperation(value="库存交易记录-分页列表查询", notes="库存交易记录-分页列表查询") | |
65 | + @GetMapping(value = "/list") | |
66 | + public Result<IPage<InventoryTransaction>> queryPageList(InventoryTransaction inventoryTransaction, | |
67 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
68 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
69 | + HttpServletRequest req) { | |
70 | + QueryWrapper<InventoryTransaction> queryWrapper = QueryGenerator.initQueryWrapper(inventoryTransaction, req.getParameterMap()); | |
71 | + Page<InventoryTransaction> page = new Page<InventoryTransaction>(pageNo, pageSize); | |
72 | + IPage<InventoryTransaction> pageList = inventoryTransactionService.page(page, queryWrapper); | |
73 | + return Result.OK(pageList); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * 添加 | |
78 | + * | |
79 | + * @param inventoryTransaction | |
80 | + * @return | |
81 | + */ | |
82 | + @AutoLog(value = "库存交易记录-添加") | |
83 | + @ApiOperation(value="库存交易记录-添加", notes="库存交易记录-添加") | |
84 | + @PostMapping(value = "/add") | |
85 | + public Result<String> add(@RequestBody InventoryTransaction inventoryTransaction, HttpServletRequest req) { | |
86 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
87 | + inventoryTransaction.setWarehouseCode(warehouseCode); | |
88 | + inventoryTransactionService.save(inventoryTransaction); | |
89 | + return Result.OK("添加成功!"); | |
90 | + } | |
91 | + | |
92 | + /** | |
93 | + * 编辑 | |
94 | + * | |
95 | + * @param inventoryTransaction | |
96 | + * @return | |
97 | + */ | |
98 | + @AutoLog(value = "库存交易记录-编辑") | |
99 | + @ApiOperation(value="库存交易记录-编辑", notes="库存交易记录-编辑") | |
100 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |
101 | + public Result<String> edit(@RequestBody InventoryTransaction inventoryTransaction) { | |
102 | + inventoryTransactionService.updateById(inventoryTransaction); | |
103 | + return Result.OK("编辑成功!"); | |
104 | + } | |
105 | + | |
106 | + /** | |
107 | + * 通过id删除 | |
108 | + * | |
109 | + * @param id | |
110 | + * @return | |
111 | + */ | |
112 | + @AutoLog(value = "库存交易记录-通过id删除") | |
113 | + @ApiOperation(value="库存交易记录-通过id删除", notes="库存交易记录-通过id删除") | |
114 | + @DeleteMapping(value = "/delete") | |
115 | + public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |
116 | + inventoryTransactionService.removeById(id); | |
117 | + return Result.OK("删除成功!"); | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * 批量删除 | |
122 | + * | |
123 | + * @param ids | |
124 | + * @return | |
125 | + */ | |
126 | + @AutoLog(value = "库存交易记录-批量删除") | |
127 | + @ApiOperation(value="库存交易记录-批量删除", notes="库存交易记录-批量删除") | |
128 | + @DeleteMapping(value = "/deleteBatch") | |
129 | + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |
130 | + this.inventoryTransactionService.removeByIds(Arrays.asList(ids.split(","))); | |
131 | + return Result.OK("批量删除成功!"); | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * 通过id查询 | |
136 | + * | |
137 | + * @param id | |
138 | + * @return | |
139 | + */ | |
140 | + //@AutoLog(value = "库存交易记录-通过id查询") | |
141 | + @ApiOperation(value="库存交易记录-通过id查询", notes="库存交易记录-通过id查询") | |
142 | + @GetMapping(value = "/queryById") | |
143 | + public Result<InventoryTransaction> queryById(@RequestParam(name="id",required=true) String id) { | |
144 | + InventoryTransaction inventoryTransaction = inventoryTransactionService.getById(id); | |
145 | + if(inventoryTransaction==null) { | |
146 | + return Result.error("未找到对应数据"); | |
147 | + } | |
148 | + return Result.OK(inventoryTransaction); | |
149 | + } | |
150 | + | |
151 | + /** | |
152 | + * 导出excel | |
153 | + * | |
154 | + * @param request | |
155 | + * @param inventoryTransaction | |
156 | + */ | |
157 | + @RequestMapping(value = "/exportXls") | |
158 | + public ModelAndView exportXls(HttpServletRequest request, InventoryTransaction inventoryTransaction) { | |
159 | + return super.exportXls(request, inventoryTransaction, InventoryTransaction.class, "库存交易记录"); | |
160 | + } | |
161 | + | |
162 | + /** | |
163 | + * 通过excel导入数据 | |
164 | + * | |
165 | + * @param request | |
166 | + * @param response | |
167 | + * @return | |
168 | + */ | |
169 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |
170 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |
171 | + return super.importExcel(request, response, InventoryTransaction.class); | |
172 | + } | |
173 | + | |
174 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/entity/InventoryTransaction.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryTransaction.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.io.UnsupportedEncodingException; | |
5 | +import java.util.Date; | |
6 | +import java.math.BigDecimal; | |
7 | +import com.baomidou.mybatisplus.annotation.IdType; | |
8 | +import com.baomidou.mybatisplus.annotation.TableId; | |
9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
10 | +import lombok.Data; | |
11 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
12 | +import org.springframework.format.annotation.DateTimeFormat; | |
13 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
14 | +import org.jeecg.common.aspect.annotation.Dict; | |
15 | +import io.swagger.annotations.ApiModel; | |
16 | +import io.swagger.annotations.ApiModelProperty; | |
17 | +import lombok.EqualsAndHashCode; | |
18 | +import lombok.experimental.Accessors; | |
19 | + | |
20 | +/** | |
21 | + * @Description: 库存交易记录 | |
22 | + * @Author: jeecg-boot | |
23 | + * @Date: 2022-11-17 | |
24 | + * @Version: V1.0 | |
25 | + */ | |
26 | +@Data | |
27 | +@TableName("inventory_transaction") | |
28 | +@Accessors(chain = true) | |
29 | +@EqualsAndHashCode(callSuper = false) | |
30 | +@ApiModel(value="inventory_transaction对象", description="库存交易记录") | |
31 | +public class InventoryTransaction implements Serializable { | |
32 | + private static final long serialVersionUID = 1L; | |
33 | + | |
34 | + /**主键*/ | |
35 | + @TableId(type = IdType.AUTO) | |
36 | + @ApiModelProperty(value = "主键") | |
37 | + private Integer id; | |
38 | + /**仓库*/ | |
39 | + @Excel(name = "仓库", width = 15) | |
40 | + @ApiModelProperty(value = "仓库") | |
41 | + private String warehouseCode; | |
42 | + /**货主*/ | |
43 | + @Excel(name = "货主", width = 15) | |
44 | + @ApiModelProperty(value = "货主") | |
45 | + private String companyCode; | |
46 | + /**容器编码*/ | |
47 | + @Excel(name = "容器编码", width = 15) | |
48 | + @ApiModelProperty(value = "容器编码") | |
49 | + private String containerCode; | |
50 | + /**库位编码*/ | |
51 | + @Excel(name = "库位编码", width = 15) | |
52 | + @ApiModelProperty(value = "库位编码") | |
53 | + private String locationCode; | |
54 | + /**交易类型*/ | |
55 | + @Excel(name = "交易类型", width = 15, dicCode = "inventory_transaction_type") | |
56 | + @Dict(dicCode = "inventory_transaction_type") | |
57 | + @ApiModelProperty(value = "交易类型") | |
58 | + private Integer type; | |
59 | + /**出库单id*/ | |
60 | + @Excel(name = "出库单id", width = 15) | |
61 | + @ApiModelProperty(value = "出库单id") | |
62 | + private Integer shipmentId; | |
63 | + /**出库详情id*/ | |
64 | + @Excel(name = "出库详情id", width = 15) | |
65 | + @ApiModelProperty(value = "出库详情id") | |
66 | + private Integer shipmentDetailId; | |
67 | + /**出库组盘详情id*/ | |
68 | + @Excel(name = "出库组盘详情id", width = 15) | |
69 | + @ApiModelProperty(value = "出库组盘详情id") | |
70 | + private Integer shipmentContainerDetailId; | |
71 | + /**入库单id*/ | |
72 | + @Excel(name = "入库单id", width = 15) | |
73 | + @ApiModelProperty(value = "入库单id") | |
74 | + private Integer receiptId; | |
75 | + /**入库单详情id*/ | |
76 | + @Excel(name = "入库单详情id", width = 15) | |
77 | + @ApiModelProperty(value = "入库单详情id") | |
78 | + private Integer receiptDetailId; | |
79 | + /**入库组盘详情Id*/ | |
80 | + @Excel(name = "入库组盘详情Id", width = 15) | |
81 | + @ApiModelProperty(value = "入库组盘详情Id") | |
82 | + private Integer receiptContainerDetailId; | |
83 | + /**物料编码*/ | |
84 | + @Excel(name = "物料编码", width = 15) | |
85 | + @ApiModelProperty(value = "物料编码") | |
86 | + private String materialCode; | |
87 | + /**物料名称*/ | |
88 | + @Excel(name = "物料名称", width = 15) | |
89 | + @ApiModelProperty(value = "物料名称") | |
90 | + private String materialName; | |
91 | + /**物料规格*/ | |
92 | + @Excel(name = "物料规格", width = 15) | |
93 | + @ApiModelProperty(value = "物料规格") | |
94 | + private String materialSpec; | |
95 | + /**物料单位*/ | |
96 | + @Excel(name = "物料单位", width = 15) | |
97 | + @ApiModelProperty(value = "物料单位") | |
98 | + private String materialUnit; | |
99 | + /**库存状态*/ | |
100 | + @Excel(name = "库存状态", width = 15) | |
101 | + @ApiModelProperty(value = "库存状态") | |
102 | + private String inventoryStatus; | |
103 | + /**数量*/ | |
104 | + @Excel(name = "数量", width = 15) | |
105 | + @ApiModelProperty(value = "数量") | |
106 | + private BigDecimal qty; | |
107 | + /**批次*/ | |
108 | + @Excel(name = "批次", width = 15) | |
109 | + @ApiModelProperty(value = "批次") | |
110 | + private String batch; | |
111 | + /**批号*/ | |
112 | + @Excel(name = "批号", width = 15) | |
113 | + @ApiModelProperty(value = "批号") | |
114 | + private String lot; | |
115 | + /**项目号*/ | |
116 | + @Excel(name = "项目号", width = 15) | |
117 | + @ApiModelProperty(value = "项目号") | |
118 | + private String project; | |
119 | + /**唯一号*/ | |
120 | + @Excel(name = "唯一号", width = 15) | |
121 | + @ApiModelProperty(value = "唯一号") | |
122 | + private String uniqueCode; | |
123 | + /**备用字段1*/ | |
124 | + @Excel(name = "备用字段1", width = 15) | |
125 | + @ApiModelProperty(value = "备用字段1") | |
126 | + private String userdef1; | |
127 | + /**备用字段2*/ | |
128 | + @Excel(name = "备用字段2", width = 15) | |
129 | + @ApiModelProperty(value = "备用字段2") | |
130 | + private String userdef2; | |
131 | + /**备用字段3*/ | |
132 | + @Excel(name = "备用字段3", width = 15) | |
133 | + @ApiModelProperty(value = "备用字段3") | |
134 | + private String userdef3; | |
135 | + /**创建人*/ | |
136 | + @ApiModelProperty(value = "创建人") | |
137 | + private String createBy; | |
138 | + /**创建日期*/ | |
139 | + @ApiModelProperty(value = "创建日期") | |
140 | + private Date createTime; | |
141 | + /**更新人*/ | |
142 | + @ApiModelProperty(value = "更新人") | |
143 | + private String updateBy; | |
144 | + /**更新日期*/ | |
145 | + @ApiModelProperty(value = "更新日期") | |
146 | + private Date updateTime; | |
147 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/InventoryTransactionMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryTransaction.mapper; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.apache.ibatis.annotations.Param; | |
6 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
7 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
8 | + | |
9 | +/** | |
10 | + * @Description: 库存交易记录 | |
11 | + * @Author: jeecg-boot | |
12 | + * @Date: 2022-11-17 | |
13 | + * @Version: V1.0 | |
14 | + */ | |
15 | +public interface InventoryTransactionMapper extends BaseMapper<InventoryTransaction> { | |
16 | + | |
17 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/mapper/xml/InventoryTransactionMapper.xml
0 → 100644
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/IInventoryTransactionService.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryTransaction.service; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
5 | + | |
6 | +/** | |
7 | + * @Description: 库存交易记录 | |
8 | + * @Author: jeecg-boot | |
9 | + * @Date: 2022-11-17 | |
10 | + * @Version: V1.0 | |
11 | + */ | |
12 | +public interface IInventoryTransactionService extends IService<InventoryTransaction> { | |
13 | + | |
14 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/inventory/inventoryTransaction/service/impl/InventoryTransactionServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.inventory.inventoryTransaction.service.impl; | |
2 | + | |
3 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
4 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.mapper.InventoryTransactionMapper; | |
5 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
9 | + | |
10 | +/** | |
11 | + * @Description: 库存交易记录 | |
12 | + * @Author: jeecg-boot | |
13 | + * @Date: 2022-11-17 | |
14 | + * @Version: V1.0 | |
15 | + */ | |
16 | +@Service | |
17 | +public class InventoryTransactionServiceImpl extends ServiceImpl<InventoryTransactionMapper, InventoryTransaction> implements IInventoryTransactionService { | |
18 | + | |
19 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/controller/ApiLogController.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.apiLog.controller; | |
2 | + | |
3 | +import java.util.Arrays; | |
4 | +import java.util.List; | |
5 | +import java.util.Map; | |
6 | +import java.util.stream.Collectors; | |
7 | +import java.io.IOException; | |
8 | +import java.io.UnsupportedEncodingException; | |
9 | +import java.net.URLDecoder; | |
10 | +import javax.servlet.http.HttpServletRequest; | |
11 | +import javax.servlet.http.HttpServletResponse; | |
12 | +import org.jeecg.common.api.vo.Result; | |
13 | +import org.jeecg.common.system.query.QueryGenerator; | |
14 | +import org.jeecg.common.util.oConvertUtils; | |
15 | + | |
16 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
17 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
18 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
19 | +import lombok.extern.slf4j.Slf4j; | |
20 | + | |
21 | +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | |
22 | +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; | |
23 | +import org.jeecgframework.poi.excel.ExcelImportUtil; | |
24 | +import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
25 | +import org.jeecgframework.poi.excel.entity.ExportParams; | |
26 | +import org.jeecgframework.poi.excel.entity.ImportParams; | |
27 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
28 | +import org.jeecg.common.system.base.controller.JeecgController; | |
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 | +import com.alibaba.fastjson.JSON; | |
35 | +import io.swagger.annotations.Api; | |
36 | +import io.swagger.annotations.ApiOperation; | |
37 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
38 | + | |
39 | + /** | |
40 | + * @Description: 接口日志 | |
41 | + * @Author: jeecg-boot | |
42 | + * @Date: 2022-11-18 | |
43 | + * @Version: V1.0 | |
44 | + */ | |
45 | +@Api(tags="接口日志") | |
46 | +@RestController | |
47 | +@RequestMapping("/monitor/apiLog") | |
48 | +@Slf4j | |
49 | +public class ApiLogController extends JeecgController<ApiLog, IApiLogService> { | |
50 | + @Autowired | |
51 | + private IApiLogService apiLogService; | |
52 | + | |
53 | + /** | |
54 | + * 分页列表查询 | |
55 | + * | |
56 | + * @param apiLog | |
57 | + * @param pageNo | |
58 | + * @param pageSize | |
59 | + * @param req | |
60 | + * @return | |
61 | + */ | |
62 | + //@AutoLog(value = "接口日志-分页列表查询") | |
63 | + @ApiOperation(value="接口日志-分页列表查询", notes="接口日志-分页列表查询") | |
64 | + @GetMapping(value = "/list") | |
65 | + public Result<IPage<ApiLog>> queryPageList(ApiLog apiLog, | |
66 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
67 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
68 | + HttpServletRequest req) { | |
69 | + QueryWrapper<ApiLog> queryWrapper = QueryGenerator.initQueryWrapper(apiLog, req.getParameterMap()); | |
70 | + Page<ApiLog> page = new Page<ApiLog>(pageNo, pageSize); | |
71 | + IPage<ApiLog> pageList = apiLogService.page(page, queryWrapper); | |
72 | + return Result.OK(pageList); | |
73 | + } | |
74 | + | |
75 | + /** | |
76 | + * 添加 | |
77 | + * | |
78 | + * @param apiLog | |
79 | + * @return | |
80 | + */ | |
81 | + @AutoLog(value = "接口日志-添加") | |
82 | + @ApiOperation(value="接口日志-添加", notes="接口日志-添加") | |
83 | + @PostMapping(value = "/add") | |
84 | + public Result<String> add(@RequestBody ApiLog apiLog) { | |
85 | + apiLogService.save(apiLog); | |
86 | + return Result.OK("添加成功!"); | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 编辑 | |
91 | + * | |
92 | + * @param apiLog | |
93 | + * @return | |
94 | + */ | |
95 | + @AutoLog(value = "接口日志-编辑") | |
96 | + @ApiOperation(value="接口日志-编辑", notes="接口日志-编辑") | |
97 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |
98 | + public Result<String> edit(@RequestBody ApiLog apiLog) { | |
99 | + apiLogService.updateById(apiLog); | |
100 | + return Result.OK("编辑成功!"); | |
101 | + } | |
102 | + | |
103 | + /** | |
104 | + * 通过id删除 | |
105 | + * | |
106 | + * @param id | |
107 | + * @return | |
108 | + */ | |
109 | + @AutoLog(value = "接口日志-通过id删除") | |
110 | + @ApiOperation(value="接口日志-通过id删除", notes="接口日志-通过id删除") | |
111 | + @DeleteMapping(value = "/delete") | |
112 | + public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |
113 | + apiLogService.removeById(id); | |
114 | + return Result.OK("删除成功!"); | |
115 | + } | |
116 | + | |
117 | + /** | |
118 | + * 批量删除 | |
119 | + * | |
120 | + * @param ids | |
121 | + * @return | |
122 | + */ | |
123 | + @AutoLog(value = "接口日志-批量删除") | |
124 | + @ApiOperation(value="接口日志-批量删除", notes="接口日志-批量删除") | |
125 | + @DeleteMapping(value = "/deleteBatch") | |
126 | + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |
127 | + this.apiLogService.removeByIds(Arrays.asList(ids.split(","))); | |
128 | + return Result.OK("批量删除成功!"); | |
129 | + } | |
130 | + | |
131 | + /** | |
132 | + * 通过id查询 | |
133 | + * | |
134 | + * @param id | |
135 | + * @return | |
136 | + */ | |
137 | + //@AutoLog(value = "接口日志-通过id查询") | |
138 | + @ApiOperation(value="接口日志-通过id查询", notes="接口日志-通过id查询") | |
139 | + @GetMapping(value = "/queryById") | |
140 | + public Result<ApiLog> queryById(@RequestParam(name="id",required=true) String id) { | |
141 | + ApiLog apiLog = apiLogService.getById(id); | |
142 | + if(apiLog==null) { | |
143 | + return Result.error("未找到对应数据"); | |
144 | + } | |
145 | + return Result.OK(apiLog); | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 导出excel | |
150 | + * | |
151 | + * @param request | |
152 | + * @param apiLog | |
153 | + */ | |
154 | + @RequestMapping(value = "/exportXls") | |
155 | + public ModelAndView exportXls(HttpServletRequest request, ApiLog apiLog) { | |
156 | + return super.exportXls(request, apiLog, ApiLog.class, "接口日志"); | |
157 | + } | |
158 | + | |
159 | + /** | |
160 | + * 通过excel导入数据 | |
161 | + * | |
162 | + * @param request | |
163 | + * @param response | |
164 | + * @return | |
165 | + */ | |
166 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |
167 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |
168 | + return super.importExcel(request, response, ApiLog.class); | |
169 | + } | |
170 | + | |
171 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/entity/ApiLog.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.apiLog.entity; | |
2 | + | |
3 | +import java.io.Serializable; | |
4 | +import java.io.UnsupportedEncodingException; | |
5 | +import java.util.Date; | |
6 | +import java.math.BigDecimal; | |
7 | +import com.baomidou.mybatisplus.annotation.IdType; | |
8 | +import com.baomidou.mybatisplus.annotation.TableId; | |
9 | +import com.baomidou.mybatisplus.annotation.TableName; | |
10 | +import lombok.Data; | |
11 | +import com.fasterxml.jackson.annotation.JsonFormat; | |
12 | +import org.springframework.format.annotation.DateTimeFormat; | |
13 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
14 | +import org.jeecg.common.aspect.annotation.Dict; | |
15 | +import io.swagger.annotations.ApiModel; | |
16 | +import io.swagger.annotations.ApiModelProperty; | |
17 | +import lombok.EqualsAndHashCode; | |
18 | +import lombok.experimental.Accessors; | |
19 | + | |
20 | +/** | |
21 | + * @Description: 接口日志 | |
22 | + * @Author: jeecg-boot | |
23 | + * @Date: 2022-11-18 | |
24 | + * @Version: V1.0 | |
25 | + */ | |
26 | +@Data | |
27 | +@TableName("api_log") | |
28 | +@Accessors(chain = true) | |
29 | +@EqualsAndHashCode(callSuper = false) | |
30 | +@ApiModel(value="api_log对象", description="接口日志") | |
31 | +public class ApiLog implements Serializable { | |
32 | + private static final long serialVersionUID = 1L; | |
33 | + | |
34 | + /**主键*/ | |
35 | + @TableId(type = IdType.AUTO) | |
36 | + @ApiModelProperty(value = "主键") | |
37 | + private Integer id; | |
38 | + /**接口名称*/ | |
39 | + @Excel(name = "接口名称", width = 15) | |
40 | + @ApiModelProperty(value = "接口名称") | |
41 | + private String apiName; | |
42 | + /**请求类型*/ | |
43 | + @Excel(name = "请求类型", width = 15) | |
44 | + @ApiModelProperty(value = "请求类型") | |
45 | + private String apiMethod; | |
46 | + /**请求方地址*/ | |
47 | + @Excel(name = "请求方地址", width = 15) | |
48 | + @ApiModelProperty(value = "请求方地址") | |
49 | + private String ip; | |
50 | + /**请求方名称*/ | |
51 | + @Excel(name = "请求方名称", width = 15) | |
52 | + @ApiModelProperty(value = "请求方名称") | |
53 | + private String requestFrom; | |
54 | + /**响应方名称*/ | |
55 | + @Excel(name = "响应方名称", width = 15) | |
56 | + @ApiModelProperty(value = "响应方名称") | |
57 | + private String responseBy; | |
58 | + /**请求地址*/ | |
59 | + @Excel(name = "请求地址", width = 15) | |
60 | + @ApiModelProperty(value = "请求地址") | |
61 | + private String url; | |
62 | + /**请求时间*/ | |
63 | + @Excel(name = "请求时间", width = 15) | |
64 | + @ApiModelProperty(value = "请求时间") | |
65 | + private Date requestTime; | |
66 | + /**响应时间*/ | |
67 | + @Excel(name = "响应时间", width = 15) | |
68 | + @ApiModelProperty(value = "响应时间") | |
69 | + private Date responseTime; | |
70 | + /**请求头*/ | |
71 | + @Excel(name = "请求头", width = 15) | |
72 | + @ApiModelProperty(value = "请求头") | |
73 | + private String requestHeader; | |
74 | + /**请求内容*/ | |
75 | + @Excel(name = "请求内容", width = 15) | |
76 | + @ApiModelProperty(value = "请求内容") | |
77 | + private String requestBody; | |
78 | + /**响应头*/ | |
79 | + @Excel(name = "响应头", width = 15) | |
80 | + @ApiModelProperty(value = "响应头") | |
81 | + private String responseHeader; | |
82 | + /**响应内容*/ | |
83 | + @Excel(name = "响应内容", width = 15) | |
84 | + @ApiModelProperty(value = "响应内容") | |
85 | + private String responseBody; | |
86 | + /**响应耗时(毫秒)*/ | |
87 | + @Excel(name = "响应耗时(毫秒)", width = 15) | |
88 | + @ApiModelProperty(value = "响应耗时(毫秒)") | |
89 | + private Integer duration; | |
90 | + /**httpCode*/ | |
91 | + @Excel(name = "httpCode", width = 15) | |
92 | + @ApiModelProperty(value = "httpCode") | |
93 | + private Integer httpCode; | |
94 | + /**业务响应码*/ | |
95 | + @Excel(name = "业务响应码", width = 15) | |
96 | + @ApiModelProperty(value = "业务响应码") | |
97 | + private Integer retCode; | |
98 | + /**异常堆栈信息*/ | |
99 | + @Excel(name = "异常堆栈信息", width = 15) | |
100 | + @ApiModelProperty(value = "异常堆栈信息") | |
101 | + private String exception; | |
102 | + /**创建人*/ | |
103 | + @ApiModelProperty(value = "创建人") | |
104 | + private String createBy; | |
105 | + /**创建日期*/ | |
106 | + @ApiModelProperty(value = "创建日期") | |
107 | + private Date createTime; | |
108 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/ApiLogMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.apiLog.mapper; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.apache.ibatis.annotations.Param; | |
6 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
7 | +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | |
8 | + | |
9 | +/** | |
10 | + * @Description: 接口日志 | |
11 | + * @Author: jeecg-boot | |
12 | + * @Date: 2022-11-18 | |
13 | + * @Version: V1.0 | |
14 | + */ | |
15 | +public interface ApiLogMapper extends BaseMapper<ApiLog> { | |
16 | + | |
17 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/mapper/xml/ApiLogMapper.xml
0 → 100644
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/IApiLogService.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.apiLog.service; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | |
5 | + | |
6 | +/** | |
7 | + * @Description: 接口日志 | |
8 | + * @Author: jeecg-boot | |
9 | + * @Date: 2022-11-18 | |
10 | + * @Version: V1.0 | |
11 | + */ | |
12 | +public interface IApiLogService extends IService<ApiLog> { | |
13 | + | |
14 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/monitor/apiLog/service/impl/ApiLogServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.monitor.apiLog.service.impl; | |
2 | + | |
3 | +import org.jeecg.modules.wms.monitor.apiLog.entity.ApiLog; | |
4 | +import org.jeecg.modules.wms.monitor.apiLog.mapper.ApiLogMapper; | |
5 | +import org.jeecg.modules.wms.monitor.apiLog.service.IApiLogService; | |
6 | +import org.springframework.stereotype.Service; | |
7 | + | |
8 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
9 | + | |
10 | +/** | |
11 | + * @Description: 接口日志 | |
12 | + * @Author: jeecg-boot | |
13 | + * @Date: 2022-11-18 | |
14 | + * @Version: V1.0 | |
15 | + */ | |
16 | +@Service | |
17 | +public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements IApiLogService { | |
18 | + | |
19 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/IReceiptContainerHeaderService.java
... | ... | @@ -27,7 +27,10 @@ public interface IReceiptContainerHeaderService extends IService<ReceiptContaine |
27 | 27 | */ |
28 | 28 | public void delBatchMain (Collection<? extends Serializable> idList); |
29 | 29 | |
30 | + | |
30 | 31 | ReceiptContainerHeader getUnCompleteReceiptContainerByCode(String containerCode, String warehouseCode); |
31 | 32 | |
32 | 33 | public Result createTask(ReceiptContainerHeader receiptContainerHeader, String warehouseCode); |
34 | + | |
35 | + boolean updateStatusById(int status, int id); | |
33 | 36 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptContainerHeader/service/impl/ReceiptContainerHeaderServiceImpl.java
... | ... | @@ -222,4 +222,15 @@ public class ReceiptContainerHeaderServiceImpl extends ServiceImpl<ReceiptContai |
222 | 222 | return Result.OK("生成入库任务成功"); |
223 | 223 | } |
224 | 224 | |
225 | + @Override | |
226 | + public boolean updateStatusById(int status, int id) { | |
227 | + ReceiptContainerHeader receiptContainerHeader = getById(id); | |
228 | + if(receiptContainerHeader == null) { | |
229 | + return false; | |
230 | + } | |
231 | + receiptContainerHeader.setStatus(status); | |
232 | + boolean success = updateById(receiptContainerHeader); | |
233 | + return success; | |
234 | + } | |
235 | + | |
225 | 236 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiving/service/impl/ReceiveServiceImpl.java
... | ... | @@ -145,7 +145,7 @@ public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> imp |
145 | 145 | if(receiptHeader == null) { |
146 | 146 | throw new ServiceException("没有找到入库单,id:" + receiptDetail.getReceiptId()); |
147 | 147 | } |
148 | - if(receiptHeader.getWarehouseCode().equals(warehouseCode)) { | |
148 | + if(!receiptHeader.getWarehouseCode().equals(warehouseCode)) { | |
149 | 149 | throw new ServiceException("仓库编码不一致,不能操作"); |
150 | 150 | } |
151 | 151 | String materialCode = receiptDetail.getMaterialCode(); |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/controller/TaskHeaderController.java
1 | 1 | package org.jeecg.modules.wms.task.taskHeader.controller; |
2 | 2 | |
3 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
3 | 4 | import org.jeecg.common.system.query.QueryGenerator; |
4 | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
5 | 6 | import com.baomidou.mybatisplus.core.metadata.IPage; |
... | ... | @@ -7,10 +8,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
7 | 8 | import lombok.extern.slf4j.Slf4j; |
8 | 9 | import org.jeecg.common.system.base.controller.JeecgController; |
9 | 10 | import org.jeecg.common.api.vo.Result; |
11 | +import org.jeecg.modules.wms.framework.controller.BaseController; | |
10 | 12 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; |
11 | 13 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
12 | 14 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; |
13 | 15 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
16 | +import org.jeecg.utils.StringUtils; | |
14 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
15 | 18 | import org.springframework.web.bind.annotation.*; |
16 | 19 | import javax.servlet.http.HttpServletRequest; |
... | ... | @@ -291,6 +294,47 @@ public class TaskHeaderController extends JeecgController<TaskHeader, ITaskHeade |
291 | 294 | /*--------------------------------子表处理-任务详情-end----------------------------------------------*/ |
292 | 295 | |
293 | 296 | |
297 | + /** | |
298 | + * 完成任务 | |
299 | + */ | |
300 | + @AutoLog(value = "任务表-完成任务") | |
301 | + @ApiOperation(value="任务表-完成任务", notes="任务表-完成任务") | |
302 | + @PostMapping( "/completeTaskByWMS") | |
303 | + public Result completeTaskByWMS(@RequestBody TaskHeader taskHeader){ | |
304 | + if(taskHeader == null) { | |
305 | + return Result.error("taskHeader不能为空"); | |
306 | + } | |
307 | + Integer taskId = taskHeader.getId(); | |
308 | + Result result = handleMultiProcess("completeTaskByWMS", new MultiProcessListener() { | |
309 | + @Override | |
310 | + public Result doProcess() { | |
311 | + Result result = taskHeaderService.completeTaskByWMS(taskId); | |
312 | + return result; | |
313 | + } | |
314 | + }); | |
315 | + return result; | |
316 | + } | |
294 | 317 | |
295 | - | |
318 | + /** | |
319 | + * 执行任务 | |
320 | + */ | |
321 | + @AutoLog(value = "任务表-执行任务") | |
322 | + @ApiOperation(value="任务表-执行任务", notes="任务表-执行任务") | |
323 | + @PostMapping( "/execute") | |
324 | + public Result execute(@RequestBody TaskHeader taskHeader) { | |
325 | + { | |
326 | + if (taskHeader == null) { | |
327 | + return Result.error("taskHeader不能为空"); | |
328 | + } | |
329 | + Integer taskId = taskHeader.getId(); | |
330 | + Result result = handleMultiProcess("execute", new MultiProcessListener() { | |
331 | + @Override | |
332 | + public Result doProcess() { | |
333 | + Result result = taskHeaderService.sendTaskToWcs(taskId); | |
334 | + return result; | |
335 | + } | |
336 | + }); | |
337 | + return result; | |
338 | + } | |
339 | + } | |
296 | 340 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskDetailService.java
... | ... | @@ -16,4 +16,10 @@ public interface ITaskDetailService extends IService<TaskDetail> { |
16 | 16 | |
17 | 17 | public List<TaskDetail> selectByMainId(String mainId); |
18 | 18 | |
19 | + /** | |
20 | + * 根据任务头表id查询任务明细 | |
21 | + * @param id | |
22 | + * @return | |
23 | + */ | |
24 | + List<TaskDetail> getTaskDetailListByTaskId(Integer id); | |
19 | 25 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/ITaskHeaderService.java
... | ... | @@ -35,5 +35,9 @@ public interface ITaskHeaderService extends IService<TaskHeader> { |
35 | 35 | |
36 | 36 | TaskHeader getUnCompleteTaskByToLocationCode(String toLocationCode, String warehouseCode); |
37 | 37 | |
38 | - TaskHeader getTaskHeaderByLocationCode(String locationCode); | |
38 | + TaskHeader getUnCompleteTaskByLocationCode(String locationCode, String warehouseCode); | |
39 | + | |
40 | + Result completeTaskByWMS(Integer taskId); | |
41 | + | |
42 | + Result sendTaskToWcs(Integer taskId); | |
39 | 43 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskDetailServiceImpl.java
... | ... | @@ -38,6 +38,13 @@ public class TaskDetailServiceImpl extends ServiceImpl<TaskDetailMapper, TaskDet |
38 | 38 | return taskDetailMapper.selectByMainId(mainId); |
39 | 39 | } |
40 | 40 | |
41 | + @Override | |
42 | + public List<TaskDetail> getTaskDetailListByTaskId(Integer id) { | |
43 | + LambdaQueryWrapper<TaskDetail> taskDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
44 | + taskDetailLambdaQueryWrapper.eq(TaskDetail::getTaskHeaderId, id); | |
45 | + List<TaskDetail> taskDetailList = list(taskDetailLambdaQueryWrapper); | |
46 | + return taskDetailList; | |
47 | + } | |
41 | 48 | |
42 | 49 | |
43 | 50 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
... | ... | @@ -9,9 +9,23 @@ import org.jeecg.modules.wms.config.container.entity.Container; |
9 | 9 | import org.jeecg.modules.wms.config.container.service.IContainerService; |
10 | 10 | import org.jeecg.modules.wms.config.location.entity.Location; |
11 | 11 | import org.jeecg.modules.wms.config.location.service.ILocationService; |
12 | +import org.jeecg.modules.wms.config.material.entity.Material; | |
13 | +import org.jeecg.modules.wms.config.material.service.IMaterialService; | |
14 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
15 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryHeader; | |
16 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
17 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryHeaderService; | |
18 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.entity.InventoryTransaction; | |
19 | +import org.jeecg.modules.wms.inventory.inventoryTransaction.service.IInventoryTransactionService; | |
20 | +import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; | |
21 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | |
22 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; | |
23 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | |
24 | +import org.jeecg.modules.wms.task.taskHeader.entity.TaskDetail; | |
12 | 25 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
13 | 26 | import org.jeecg.modules.wms.task.taskHeader.mapper.TaskDetailMapper; |
14 | 27 | import org.jeecg.modules.wms.task.taskHeader.mapper.TaskHeaderMapper; |
28 | +import org.jeecg.modules.wms.task.taskHeader.service.ITaskDetailService; | |
15 | 29 | import org.jeecg.modules.wms.task.taskHeader.service.ITaskHeaderService; |
16 | 30 | import org.jeecg.utils.StringUtils; |
17 | 31 | import org.jeecg.utils.constant.QuantityConstant; |
... | ... | @@ -22,8 +36,12 @@ import org.springframework.transaction.annotation.Transactional; |
22 | 36 | |
23 | 37 | import javax.annotation.Resource; |
24 | 38 | import java.io.Serializable; |
39 | +import java.math.BigDecimal; | |
40 | +import java.util.ArrayList; | |
41 | +import java.util.Date; | |
25 | 42 | import java.util.List; |
26 | 43 | import java.util.Collection; |
44 | +import java.util.stream.Collectors; | |
27 | 45 | |
28 | 46 | /** |
29 | 47 | * @Description: 任务表 |
... | ... | @@ -43,7 +61,23 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
43 | 61 | @Resource |
44 | 62 | private ITaskHeaderService taskHeaderService; |
45 | 63 | @Resource |
64 | + private ITaskDetailService taskDetailService; | |
65 | + @Resource | |
46 | 66 | private IContainerService containerService; |
67 | + @Resource | |
68 | + private IInventoryHeaderService inventoryHeaderService; | |
69 | + @Resource | |
70 | + private IInventoryDetailService inventoryDetailService; | |
71 | + @Resource | |
72 | + private IInventoryTransactionService inventoryTransactionService; | |
73 | + @Resource | |
74 | + private IReceiptDetailService receiptDetailService; | |
75 | + @Resource | |
76 | + private IReceiptHeaderService receiptHeaderService; | |
77 | + @Resource | |
78 | + private IReceiptContainerHeaderService receiptContainerHeaderService; | |
79 | + @Resource | |
80 | + private IMaterialService materialService; | |
47 | 81 | |
48 | 82 | @Override |
49 | 83 | @Transactional |
... | ... | @@ -246,8 +280,264 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea |
246 | 280 | } |
247 | 281 | |
248 | 282 | @Override |
249 | - public TaskHeader getTaskHeaderByLocationCode(String locationCode) { | |
283 | + public TaskHeader getUnCompleteTaskByLocationCode(String locationCode, String warehouseCode) { | |
284 | + TaskHeader taskHeader = getUnCompleteTaskByFromLocationCode(locationCode, warehouseCode); | |
285 | + if(taskHeader == null) { | |
286 | + taskHeader = getUnCompleteTaskByToLocationCode(locationCode, warehouseCode); | |
287 | + } | |
288 | + return taskHeader; | |
289 | + } | |
290 | + | |
291 | + /** | |
292 | + * WMS完成任务 | |
293 | + */ | |
294 | + @Override | |
295 | + @Transactional(rollbackFor = Exception.class) | |
296 | + public Result completeTaskByWMS(Integer taskId) { | |
297 | + TaskHeader taskHeader = getById(taskId); | |
298 | + if(taskHeader == null) { | |
299 | + return Result.error("任务" + taskId + "未找到,执行中止"); | |
300 | + } | |
301 | + if (taskHeader.getStatus().equals(QuantityConstant.TASK_STATUS_COMPLETED)) { | |
302 | + return Result.ok("任务(" +taskId + ")任务已经是完成的!"); | |
303 | + } | |
304 | + if (StringUtils.isEmpty(taskHeader.getFromLocationCode()) | |
305 | + && StringUtils.isEmpty(taskHeader.getToLocationCode())) { | |
306 | + return Result.error("任务" + taskId + "没有库位,执行中止"); | |
307 | + } | |
308 | + Result result = null; | |
309 | + int taskType = taskHeader.getTaskType().intValue(); | |
310 | + switch (taskType) { | |
311 | + //整盘入库、补充入库 | |
312 | + case QuantityConstant.TASK_TYPE_WHOLERECEIPT: | |
313 | + case QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT: | |
314 | + result = completeReceiptTask(taskHeader); | |
315 | + break; | |
316 | + default: | |
317 | + throw new ServiceException("不支持的任务类型" + taskType); | |
318 | + } | |
319 | + return result; | |
320 | + } | |
321 | + | |
322 | + @Override | |
323 | + public Result sendTaskToWcs(Integer taskId) { | |
250 | 324 | return null; |
251 | 325 | } |
252 | 326 | |
327 | + @Transactional(rollbackFor = Exception.class) | |
328 | + public boolean combineInventoryDetail(TaskHeader taskHeader) { | |
329 | + boolean success = false; | |
330 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
331 | + String containerCode = taskHeader.getContainerCode(); | |
332 | + String toLocationCode = taskHeader.getToLocationCode(); | |
333 | + | |
334 | + InventoryHeader inventoryHeader = inventoryHeaderService. | |
335 | + getInventoryHeaderByContainerCode(containerCode, warehouseCode); | |
336 | + if(inventoryHeader == null) { | |
337 | + throw new ServiceException("合并库存时, 没有找到库存头"); | |
338 | + } | |
339 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService. | |
340 | + getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
341 | + if(inventoryDetailList.size() == 0) { | |
342 | + throw new ServiceException("合并库存时, 没有找到库存详情"); | |
343 | + } | |
344 | + if(inventoryDetailList.size() == 1) { | |
345 | + return true; | |
346 | + } | |
347 | + for (int i = 0; i < inventoryDetailList.size() - 1; i++) { | |
348 | + for (int j = inventoryDetailList.size() - 1; j > i; j--) { | |
349 | + InventoryDetail inventoryDetail1 = inventoryDetailList.get(i); | |
350 | + InventoryDetail inventoryDetail2 = inventoryDetailList.get(j); | |
351 | + if (inventoryDetail1.getMaterialCode().equals(inventoryDetail2.getMaterialCode()) | |
352 | + && inventoryDetail1.getBatch().equals(inventoryDetail2.getBatch()) | |
353 | + && inventoryDetail1.getLot().equals(inventoryDetail2.getLot()) | |
354 | + && inventoryDetail1.getProject().equals(inventoryDetail2.getProject())) { | |
355 | + BigDecimal totalQty = inventoryDetail1.getQty().add(inventoryDetail2.getQty()); | |
356 | + inventoryDetail1.setQty(totalQty); | |
357 | + success = inventoryDetailService.updateById(inventoryDetail1); | |
358 | + if(!success) { | |
359 | + throw new ServiceException("合并库存时, 更新库存详情失败:" + inventoryDetail1.getId()); | |
360 | + } | |
361 | + success = inventoryDetailService.removeById(inventoryDetail2); | |
362 | + if(!success) { | |
363 | + throw new ServiceException("合并库存时, 删除库存详情失败:" + inventoryDetail2.getId()); | |
364 | + } | |
365 | + inventoryDetailList.remove(j); | |
366 | + } | |
367 | + } | |
368 | + } | |
369 | + BigDecimal totalQty = new BigDecimal(0); | |
370 | + int totalLines = 0; | |
371 | + for (InventoryDetail inventoryDetail : inventoryDetailList) { | |
372 | + totalQty = totalQty.add(inventoryDetail.getQty()); | |
373 | + totalLines++; | |
374 | + } | |
375 | + Container container = containerService.getContainerByCode(containerCode, warehouseCode); | |
376 | + if(container == null) { | |
377 | + throw new ServiceException("合并库存时, 没有找到容器, 容器号为" + containerCode); | |
378 | + } | |
379 | + inventoryHeader.setTotalQty(totalQty); | |
380 | + inventoryHeader.setTotalLines(totalLines); | |
381 | + inventoryHeader.setContainerStatus(container.getStatus()); | |
382 | + success = inventoryHeaderService.updateById(inventoryHeader); | |
383 | + return success; | |
384 | + } | |
385 | + /** | |
386 | + * 完成入库任务 | |
387 | + * @param taskHeader 任务 | |
388 | + * @return AjaxResult 完成入库任务结果 | |
389 | + */ | |
390 | + @Transactional(rollbackFor = Exception.class) | |
391 | + public Result completeReceiptTask(TaskHeader taskHeader) { | |
392 | + String warehouseCode = taskHeader.getWarehouseCode(); | |
393 | + String fromLocationCode = taskHeader.getFromLocationCode(); | |
394 | + String toLocationCode = taskHeader.getToLocationCode(); | |
395 | + String zoneCode = taskHeader.getZoneCode(); | |
396 | + String containerCode = taskHeader.getContainerCode(); | |
397 | + int taskType = taskHeader.getTaskType(); | |
398 | + List<TaskDetail> taskDetailList = taskDetailService.getTaskDetailListByTaskId(taskHeader.getId()); | |
399 | + boolean success = false; | |
400 | + if (taskDetailList.isEmpty()) { | |
401 | + throw new ServiceException("任务明细为空"); | |
402 | + } | |
403 | + Location toLocation = locationService.getLocationByCode(toLocationCode, warehouseCode); | |
404 | + if(toLocation == null) { | |
405 | + throw new ServiceException("完成任务时,没有找到目的库位"); | |
406 | + } | |
407 | + InventoryHeader inventoryHeader = inventoryHeaderService | |
408 | + .getInventoryHeaderByContainerCode(containerCode, warehouseCode); | |
409 | + if(inventoryHeader != null) { | |
410 | + if (taskType == QuantityConstant.TASK_TYPE_SUPPLEMENTRECEIPT) { | |
411 | + inventoryHeader.setLocationCode(toLocationCode); | |
412 | + inventoryHeader.setZoneCode(zoneCode); | |
413 | + inventoryHeaderService.updateById(inventoryHeader); | |
414 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService. | |
415 | + getInventoryDetailListByInventoryHeaderId(inventoryHeader.getId()); | |
416 | + for(InventoryDetail inventoryDetail : inventoryDetailList) { | |
417 | + inventoryDetail.setLocationCode(toLocationCode); | |
418 | + inventoryDetail.setZoneCode(zoneCode); | |
419 | + inventoryDetailService.updateById(inventoryDetail); | |
420 | + } | |
421 | + } | |
422 | + } else { | |
423 | + inventoryHeader = new InventoryHeader(); | |
424 | + inventoryHeader.setWarehouseCode(warehouseCode); | |
425 | + inventoryHeader.setCompanyCode(taskHeader.getCompanyCode()); | |
426 | + inventoryHeader.setZoneCode(zoneCode); | |
427 | + inventoryHeader.setContainerCode(containerCode); | |
428 | + inventoryHeader.setLocationCode(toLocationCode); | |
429 | + inventoryHeader.setTotalWeight(taskHeader.getWeight()); | |
430 | + inventoryHeader.setContainerStatus(QuantityConstant.STATUS_CONTAINER_SOME); | |
431 | + inventoryHeader.setEnable(QuantityConstant.STATUS_ENABLE); | |
432 | + if (!inventoryHeaderService.save(inventoryHeader)) { | |
433 | + throw new ServiceException("添加库存头失败"); | |
434 | + } | |
435 | + } | |
436 | + | |
437 | + List<InventoryDetail> inventoryDetailList = new ArrayList<>(); | |
438 | + List<InventoryTransaction> inventoryTransactionList = new ArrayList<>(); | |
439 | + List<ReceiptDetail> receiptDetaiList = new ArrayList<>(); | |
440 | + for(TaskDetail taskDetail : taskDetailList) { | |
441 | + ReceiptDetail receiptDetail = receiptDetailService.getById(taskDetail.getReceiptDetailId()); | |
442 | + if(receiptDetail == null) { | |
443 | + throw new ServiceException("未找到id:" + taskDetail.getReceiptDetailId() + "入库单明细"); | |
444 | + } | |
445 | + BigDecimal taskQty = receiptDetail.getTaskQty(); | |
446 | + BigDecimal qty = receiptDetail.getQty(); | |
447 | + if(taskQty.compareTo(qty) >= 0) { | |
448 | + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED); | |
449 | + } else { | |
450 | + receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_SHELF); | |
451 | + } | |
452 | + receiptDetaiList.add(receiptDetail); | |
453 | + | |
454 | + BigDecimal receiptQty = taskDetail.getQty(); | |
455 | + InventoryDetail inventoryDetail = new InventoryDetail(); | |
456 | + inventoryDetail.setInventoryHeaderId(inventoryHeader.getId()); | |
457 | + inventoryDetail.setWarehouseCode(warehouseCode); | |
458 | + inventoryDetail.setCompanyCode(taskDetail.getCompanyCode()); | |
459 | + inventoryDetail.setZoneCode(zoneCode); | |
460 | + inventoryDetail.setContainerCode(taskHeader.getContainerCode()); | |
461 | + inventoryDetail.setLocationCode(toLocationCode); | |
462 | + inventoryDetail.setMaterialCode(taskDetail.getMaterialCode()); | |
463 | + inventoryDetail.setMaterialName(taskDetail.getMaterialName()); | |
464 | + inventoryDetail.setMaterialSpec(taskDetail.getMaterialSpec()); | |
465 | + inventoryDetail.setMaterialUnit(taskDetail.getMaterialUnit()); | |
466 | + inventoryDetail.setQty(receiptQty); | |
467 | + inventoryDetail.setInventoryStatus(taskDetail.getInventoryStatus()); | |
468 | + inventoryDetail.setBatch(taskDetail.getBatch()); | |
469 | + inventoryDetail.setLot(taskDetail.getLot()); | |
470 | + inventoryDetail.setProject(taskDetail.getProject()); | |
471 | + inventoryDetail.setReceiptDate(new Date()); | |
472 | + inventoryDetailList.add(inventoryDetail); | |
473 | + | |
474 | + InventoryTransaction inventoryTransaction = new InventoryTransaction(); | |
475 | + inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_RECEIPT); | |
476 | + inventoryTransaction.setWarehouseCode(taskDetail.getWarehouseCode()); | |
477 | + inventoryTransaction.setCompanyCode(taskDetail.getCompanyCode()); | |
478 | + inventoryTransaction.setContainerCode(containerCode); | |
479 | + inventoryTransaction.setLocationCode(toLocationCode); | |
480 | + inventoryTransaction.setMaterialCode(taskDetail.getMaterialCode()); | |
481 | + inventoryTransaction.setMaterialName(taskDetail.getMaterialName()); | |
482 | + inventoryTransaction.setMaterialSpec(taskDetail.getMaterialSpec()); | |
483 | + inventoryTransaction.setMaterialUnit(taskDetail.getMaterialUnit()); | |
484 | + inventoryTransaction.setReceiptId(taskDetail.getReceiptId()); | |
485 | + inventoryTransaction.setReceiptDetailId(taskDetail.getReceiptDetailId()); | |
486 | + inventoryTransaction.setReceiptContainerDetailId(taskDetail.getReceiptContainerDetailId()); | |
487 | + inventoryTransaction.setBatch(taskDetail.getBatch()); | |
488 | + inventoryTransaction.setLot(taskDetail.getLot()); | |
489 | + inventoryTransaction.setProject(taskDetail.getProject()); | |
490 | + inventoryTransaction.setInventoryStatus(taskDetail.getInventoryStatus()); | |
491 | + inventoryTransaction.setQty(receiptQty); | |
492 | + inventoryTransactionList.add(inventoryTransaction); | |
493 | + } | |
494 | + if(!receiptDetailService.updateBatchById(receiptDetaiList)) { | |
495 | + throw new ServiceException("完成入库任务时,更新入库单详情失败"); | |
496 | + } | |
497 | + List<Integer> receiptIdList = receiptDetaiList.stream().map(ReceiptDetail::getReceiptId) | |
498 | + .distinct().collect(Collectors.toList()); | |
499 | + for(Integer receiptId : receiptIdList) { | |
500 | + success = receiptHeaderService.updateReceiptHeaderStatus(receiptId); | |
501 | + if(!success) { | |
502 | + throw new ServiceException("完成入库任务时,更新入库单头失败"); | |
503 | + } | |
504 | + } | |
505 | + | |
506 | + success = receiptContainerHeaderService.updateStatusById(QuantityConstant.RECEIPT_CONTAINER_FINISHED, | |
507 | + taskHeader.getReceiptContainerHeaderId()); | |
508 | + if(!success) { | |
509 | + throw new ServiceException("完成入库任务时,更新入库组盘头表状态失败"); | |
510 | + } | |
511 | + | |
512 | + success = inventoryDetailService.saveBatch(inventoryDetailList); | |
513 | + if(!success) { | |
514 | + throw new ServiceException("完成入库任务时,保存库存详情失败"); | |
515 | + } | |
516 | + success = inventoryTransactionService.saveBatch(inventoryTransactionList); | |
517 | + if(!success) { | |
518 | + throw new ServiceException("完成入库任务时,保存库存交易失败"); | |
519 | + } | |
520 | + | |
521 | + success = locationService.updateContainerCodeAndStatus(toLocationCode, | |
522 | + containerCode, QuantityConstant.STATUS_LOCATION_EMPTY, warehouseCode); | |
523 | + if(!success) { | |
524 | + throw new ServiceException("完成入库任务时,更新库位失败"); | |
525 | + } | |
526 | + | |
527 | + taskHeader.setStatus(QuantityConstant.TASK_STATUS_COMPLETED); | |
528 | + success = taskHeaderService.updateById(taskHeader); | |
529 | + if(!success) { | |
530 | + throw new ServiceException("完成入库任务时,更新任务失败"); | |
531 | + } | |
532 | + success = containerService.updateLocationCodeAndStatus(containerCode, toLocationCode, | |
533 | + QuantityConstant.STATUS_CONTAINER_SOME, warehouseCode); | |
534 | + if(!success) { | |
535 | + throw new ServiceException("完成入库任务时,更新容器失败"); | |
536 | + } | |
537 | + if(!combineInventoryDetail(taskHeader)) { | |
538 | + throw new ServiceException("合并入库库存失败"); | |
539 | + } | |
540 | + return Result.ok("完成入库任务"); | |
541 | + } | |
542 | + | |
253 | 543 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/utils/constant/QuantityConstant.java
... | ... | @@ -64,7 +64,7 @@ public class QuantityConstant { |
64 | 64 | public static final Integer RECEIPT_HEADER_SHELF = 300; |
65 | 65 | |
66 | 66 | //过账 |
67 | - public static final Integer RECEIPT_HEADER_POSTING = 800; | |
67 | + public static final Integer RECEIPT_HEADER_COMPLETED = 800; | |
68 | 68 | |
69 | 69 | //回传 |
70 | 70 | public static final Integer RECEIPT_HEADER_RETURN = 900; |
... | ... |